This file contains hidden or 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
| child: new StoreConnector<AppState,LoginViewModel>( | |
| onInit: (store){ | |
| store.dispatch(new ClearErrorsAction()); | |
| store.dispatch(new CheckTokenAction()); | |
| }, | |
| onDidChange: (viewModel){ | |
| if(viewModel.tokenReqeust == true){ | |
| if(viewModel.token.isEmpty()){ | |
| // TODO run animation | |
| }else{ |
This file contains hidden or 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
| //onInit ^ StoreConnector | |
| onInit: (store){ | |
| store.dispatch(new ClearErrorsAction()); | |
| store.dispatch(new CheckTokenAction( | |
| hasTokenCallback: (){ | |
| }, | |
| noTokenCallback: (){ | |
| _animation.addStatusListener((status){ | |
| if(status == AnimationStatus.dismissed || status == AnimationStatus.completed){ |
This file contains hidden or 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 ValidationMiddleware extends MiddlewareClass<AppState>{ | |
| final String emailPattern = r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'; | |
| @override | |
| void call(Store<AppState> store, dynamic action, NextDispatcher next) { | |
| if(action is ValidateEmailAction){ | |
| validateEmail(action.screen,action.email, next); | |
| } |
This file contains hidden or 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
| Widget emailInput(LoginViewModel viewModel) => Padding( | |
| padding: const EdgeInsets.only(left: 65.0,right: 65.0,top: 26.0), | |
| child: Container( | |
| alignment: new Alignment(0.5, 0.5), | |
| height: 56.0, | |
| decoration: BoxDecoration( | |
| color: Color(semiTransparentGray), | |
| border: Border(bottom: BorderSide( | |
| color: new Color(_getColor(viewModel.status, viewModel.emailError, _emailNode)), | |
| width:1.0 |
This file contains hidden or 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
| Widget content(LoginViewModel viewModel, BoxConstraints constraints) => | |
| (viewModel.status != LoadingStatus.loading || viewModel?.type == ScreenState.WELCOME)? new Container( | |
| child: new Stack( | |
| fit: StackFit.expand, | |
| alignment: Alignment.topCenter, | |
| children: <Widget>[ | |
| new Align( | |
| alignment: Alignment.topCenter, | |
| child: new Transform( | |
| transform: new Matrix4.translationValues(0.0, _animation.value, 0.0), |
This file contains hidden or 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
| import 'package:redux/redux.dart'; | |
| import 'package:reduxsample/models/loading_status.dart'; | |
| import 'package:reduxsample/redux/app/app_state.dart'; | |
| import 'package:reduxsample/redux/auth/auth_actions.dart'; | |
| import 'package:reduxsample/redux/auth/screen_state.dart'; | |
| import 'package:reduxsample/redux/auth/screen.dart'; | |
| class LoginViewModel{ | |
| final LoadingStatus status; |
This file contains hidden or 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
| @override | |
| Widget build(BuildContext context) => new Scaffold( | |
| body: LayoutBuilder( | |
| builder: (context, constraints)=>SafeArea( | |
| child: new Container( | |
| color: Colors.black, | |
| child: new StoreConnector<AppState,LoginViewModel>( | |
| onInit: (store){ | |
| ... | |
| }, |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:redux/redux.dart'; | |
| ... | |
| void main() async{ | |
| SystemChrome.setPreferredOrientations([ | |
| DeviceOrientation.portraitDown, | |
| DeviceOrientation.portraitUp, | |
| ]); | |
| var store = await createStore(); |
This file contains hidden or 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
| import 'dart:async'; | |
| import 'package:redux/redux.dart'; | |
| import 'package:reduxsample/models/auth_request.dart'; | |
| import 'package:reduxsample/models/loading_status.dart'; | |
| import 'package:reduxsample/redux/app/app_state.dart'; | |
| import 'package:reduxsample/redux/auth/auth_actions.dart'; | |
| import 'package:reduxsample/redux/auth/screen.dart'; | |
| import 'package:reduxsample/utils/strings.dart'; | |
| class ValidationMiddleware extends MiddlewareClass<AppState>{ |
This file contains hidden or 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 ValidateEmailAction{ | |
| final String email; | |
| final Screen screen; | |
| ValidateEmailAction(this.email, this.screen); | |
| } | |
| class ChangeLoadingStatusAction{ | |
| final LoadingStatus status; | |
| ChangeLoadingStatusAction(this.status); | |
| } |
NewerOlder