bloc

Flutter State Management Examples

浪子不回头ぞ 提交于 2019-12-08 13:58:10
问题 In a complex app, sometimes a Global Variable 'attached' to a widget, can be changed by some 'EXTERNAL EVENT' such as (1) A timer that run in another thread, or (2) socket.io server emit event (3) Others ...... Let's call this global variable gintCount and the app has 3 pages, namely: Page 1: A 'Dynamic' page that need to display the latest value of gintCount. Page 2: Another 'Dynamic' page that need to display the latest value of gintCount, with a Text Input Field. Page 3: A 'Static' page

flutter - bloc - how can I use FutureBuilder in my Ui to properly implement Bloc Architecture

点点圈 提交于 2019-12-08 01:16:15
问题 I am newbie to flutter and Bloc architecture and I am trying to use Bloc for my login functionality. I am trying to make a call to a function in my Bloc file, but I do not know how to do that. also I would be glad if you could help me to see if there is any other problems in my use of Bloc. here is the code of my Ui: MaterialButton( color: Colors.deepPurple, minWidth: screenAwareSize(500, context), onPressed: () { _submitForm(authBloc, user, pass); }, void _submitForm(AuthBloc authBloc,

How to add animated transitions when changing Widget on BLoC pattern?

寵の児 提交于 2019-12-07 08:21:48
问题 so I was following bloc login tutorial, and while I managed to complete it, I'm still fairly new to Flutter & Dart. There is a portion of the code where, depending on the state, the code returns a different widget, instead of a new Scaffold. Since it's not using routes, the transition between pages looks choppy and akward. return BlocProvider<AuthenticationBloc>( bloc: authenticationBloc, child: MaterialApp( debugShowCheckedModeBanner: false, home: BlocBuilder<AuthenticationEvent,

How to add animated transitions when changing Widget on BLoC pattern?

可紊 提交于 2019-12-05 12:03:17
so I was following bloc login tutorial , and while I managed to complete it, I'm still fairly new to Flutter & Dart. There is a portion of the code where, depending on the state, the code returns a different widget, instead of a new Scaffold. Since it's not using routes, the transition between pages looks choppy and akward. return BlocProvider<AuthenticationBloc>( bloc: authenticationBloc, child: MaterialApp( debugShowCheckedModeBanner: false, home: BlocBuilder<AuthenticationEvent, AuthenticationState>( bloc: authenticationBloc, builder: (BuildContext context, AuthenticationState state) { if