Merge branch 'login_page' into 'development'

Login page

See merge request Cloud_Solution/driver-app!6
merge-requests/10/merge
Elham 6 years ago
commit 74763c85a2

@ -16,7 +16,7 @@ class AuthenticationViewModel extends BaseViewModel {
if (state == ViewState.Busy || state == ViewState.BusyLocal) { if (state == ViewState.Busy || state == ViewState.BusyLocal) {
return APP_STATUS.LOADING; return APP_STATUS.LOADING;
} else { } else {
if (user != null) { if ( user != null) {
return APP_STATUS.AUTHENTICATED; return APP_STATUS.AUTHENTICATED;
} else { } else {
return APP_STATUS.UNAUTHENTICATED; return APP_STATUS.UNAUTHENTICATED;

@ -13,6 +13,7 @@ import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:driverapp/widgets/input/text_field.dart'; import 'package:driverapp/widgets/input/text_field.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -28,9 +29,8 @@ class LoginPage extends StatelessWidget {
duration: Duration(microseconds: 350), duration: Duration(microseconds: 350),
child: BaseView<AuthenticationViewModel>( child: BaseView<AuthenticationViewModel>(
builder: (_, model, widget) => Scaffold( builder: (_, model, widget) => Scaffold(
//baseViewModel: model, body: SingleChildScrollView(
child: Center(
body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -144,11 +144,13 @@ class LoginPage extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Text( Expanded(
child: Text(
TranslationBase.of(context).enterCredentialsMsg, TranslationBase.of(context).enterCredentialsMsg,
style: TextStyle( style: TextStyle(
fontSize: 13, color: Colors.grey), fontSize: 13, color: Colors.grey),
), ),
),
SizedBox( SizedBox(
height: 10, height: 10,
) )
@ -160,7 +162,6 @@ class LoginPage extends StatelessWidget {
), ),
Container( Container(
child: TextFields( child: TextFields(
onChanged: (value) => {},
hintText: TranslationBase.of(context).enterId, hintText: TranslationBase.of(context).enterId,
validator: (value) { validator: (value) {
if (value.isEmpty) { if (value.isEmpty) {
@ -180,7 +181,6 @@ class LoginPage extends StatelessWidget {
Container( Container(
child: TextFields( child: TextFields(
borderRadiusValue: 6, borderRadiusValue: 6,
onChanged: (value) => {},
hintText: hintText:
TranslationBase.of(context).enterPassword, TranslationBase.of(context).enterPassword,
validator: (value) { validator: (value) {
@ -220,13 +220,9 @@ class LoginPage extends StatelessWidget {
), ),
SizedBox( SizedBox(
height: 10, height: 10,
) ),Container(
],
),
),
bottomSheet: Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
height: MediaQuery.of(context).size.height * 0.12, height: MediaQuery.of(context).size.height * 0.22,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SecondaryButton( SecondaryButton(
@ -241,7 +237,12 @@ class LoginPage extends StatelessWidget {
height: 30, height: 30,
) )
], ],
)), ))
],
),
),
),
), ),
), ),
); );
@ -253,7 +254,6 @@ class LoginPage extends StatelessWidget {
await model.login(loginRequest); await model.login(loginRequest);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
// Show error
} else { } else {
Navigator.push( Navigator.push(
context, MaterialPageRoute(builder: (context) => DashboardScreen())); context, MaterialPageRoute(builder: (context) => DashboardScreen()));

Loading…
Cancel
Save