|
|
|
|
@ -19,21 +19,21 @@ class LoginPage extends StatelessWidget {
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
AuthenticationViewModel authenticationViewModel;
|
|
|
|
|
|
|
|
|
|
login() async {
|
|
|
|
|
if (loginFormKey.currentState.validate()) {
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
await authenticationViewModel.login(loginRequest);
|
|
|
|
|
if (authenticationViewModel.isError) {
|
|
|
|
|
Utils.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
authenticationViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
login() async {
|
|
|
|
|
if (loginFormKey.currentState.validate()) {
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
await authenticationViewModel.login(loginRequest);
|
|
|
|
|
if (authenticationViewModel.isError) {
|
|
|
|
|
Utils.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AnimatedSwitcher(
|
|
|
|
|
duration: Duration(microseconds: 350),
|
|
|
|
|
child: AppScaffold(
|
|
|
|
|
@ -44,59 +44,59 @@ class LoginPage extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.80,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Icon(
|
|
|
|
|
DriverApp.logo,
|
|
|
|
|
size: 70,
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
right: projectViewModel.isArabic
|
|
|
|
|
? 0
|
|
|
|
|
: MediaQuery.of(context).size.width *
|
|
|
|
|
0.15,
|
|
|
|
|
left: !projectViewModel.isArabic
|
|
|
|
|
? 0
|
|
|
|
|
: MediaQuery.of(context).size.width *
|
|
|
|
|
0.15),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
"Driver",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 50, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Delivery",
|
|
|
|
|
style: TextStyle(fontSize: 36, letterSpacing: 1),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"APP",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 33,
|
|
|
|
|
letterSpacing: 33,
|
|
|
|
|
fontWeight: FontWeight.w400),
|
|
|
|
|
widthFactor: 0.80,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Icon(
|
|
|
|
|
DriverApp.logo,
|
|
|
|
|
size: 70,
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
right: projectViewModel.isArabic
|
|
|
|
|
? 0
|
|
|
|
|
: MediaQuery.of(context).size.width *
|
|
|
|
|
0.15,
|
|
|
|
|
left: !projectViewModel.isArabic
|
|
|
|
|
? 0
|
|
|
|
|
: MediaQuery.of(context).size.width *
|
|
|
|
|
0.15),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
"Driver",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 50, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Delivery",
|
|
|
|
|
style: TextStyle(fontSize: 36, letterSpacing: 1),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"APP",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 33,
|
|
|
|
|
letterSpacing: 33,
|
|
|
|
|
fontWeight: FontWeight.w400),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
@ -143,47 +143,48 @@ class LoginPage extends StatelessWidget {
|
|
|
|
|
// : Colors.transparent),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.enterCredentialsMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.symmetric(horizontal: 20),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.enterCredentialsMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: TextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).enterId,
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterYourID;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: TextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).enterId,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return TranslationBase.of(context)
|
|
|
|
|
.pleaseEnterYourID;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
loginRequest.userID = int.parse(value.trim());
|
|
|
|
|
},
|
|
|
|
|
@ -196,7 +197,7 @@ class LoginPage extends StatelessWidget {
|
|
|
|
|
child: TextFields(
|
|
|
|
|
borderRadiusValue: 6,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).enterPassword,
|
|
|
|
|
TranslationBase.of(context).enterPassword,
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return TranslationBase.of(context)
|
|
|
|
|
@ -228,15 +229,15 @@ class LoginPage extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(10),
|
|
|
|
|
|