This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoyaltyAddPage extends StatelessWidget { | |
const LoyaltyAddPage({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return WillPopScope( | |
onWillPop: () { | |
BlocProvider.of<NavigatorBloc>(context).add(NavigatorEventPop()); | |
return Future(() => true); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MockLoyaltyCardRepository extends Mock implements LoyaltyCardRepository {} | |
class UnhandledEvent extends LoyaltyEvent {} | |
void main() { | |
final loyaltyCard1 = LoyaltyCard.fromParams('Card1','12345'); | |
group('Given a Loyalty cards BLoC', () { | |
final mockLoyaltyCardRepository = MockLoyaltyCardRepository(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoyaltyListPage extends StatefulWidget { | |
LoyaltyListPage({Key key}) : super(key: key); | |
@override | |
_LoyaltyListPageState createState() => _LoyaltyListPageState(); | |
} | |
class _LoyaltyListPageState extends State<LoyaltyListPage> { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main()... | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//EVENTS | |
abstract class LoyaltyEvent extends Equatable { | |
@override | |
List<Object> get props => []; | |
} | |
class Fetch extends LoyaltyEvent {} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoyaltyBloc extends Bloc<LoyaltyEvent, LoyaltyState>{ | |
final LoyaltyCardRepository loyaltyCardRepository; | |
LoyaltyBloc({@required this.loyaltyCardRepository}); | |
@override | |
LoyaltyState get initialState => LoyaltyEmpty(); | |
@override | |
Stream<LoyaltyState> mapEventToState(LoyaltyEvent event) async* { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
dependencies: | |
equatable: ^1.1.1 | |
bloc: ^3.0.0 | |
flutter_bloc: ^3.2.0 | |
... |
NewerOlder