Merge branch 'refilc:dev' into dev
This commit is contained in:
commit
c4e7ebc020
@ -1,10 +1,9 @@
|
|||||||
// import 'dart:async';
|
// import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:refilc/api/client.dart';
|
import 'package:refilc/api/client.dart';
|
||||||
import 'package:refilc/api/login.dart';
|
import 'package:refilc/api/login.dart';
|
||||||
import 'package:refilc/theme/colors/colors.dart';
|
import 'package:refilc/theme/colors/colors.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
||||||
import 'package:refilc_mobile_ui/common/custom_snack_bar.dart';
|
import 'package:refilc_mobile_ui/common/custom_snack_bar.dart';
|
||||||
import 'package:refilc_mobile_ui/common/system_chrome.dart';
|
import 'package:refilc_mobile_ui/common/system_chrome.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/absence/absence_display.dart';
|
import 'package:refilc_mobile_ui/common/widgets/absence/absence_display.dart';
|
||||||
@ -17,7 +16,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'login_screen.i18n.dart';
|
import 'login_screen.i18n.dart';
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:flutter_portal/flutter_portal.dart';
|
|
||||||
|
|
||||||
class LoginScreen extends StatefulWidget {
|
class LoginScreen extends StatefulWidget {
|
||||||
const LoginScreen({super.key, this.back = false});
|
const LoginScreen({super.key, this.back = false});
|
||||||
@ -85,366 +83,479 @@ class LoginScreenState extends State<LoginScreen> {
|
|||||||
precacheImage(const AssetImage('assets/images/showcase2.png'), context);
|
precacheImage(const AssetImage('assets/images/showcase2.png'), context);
|
||||||
precacheImage(const AssetImage('assets/images/showcase3.png'), context);
|
precacheImage(const AssetImage('assets/images/showcase3.png'), context);
|
||||||
precacheImage(const AssetImage('assets/images/showcase4.png'), context);
|
precacheImage(const AssetImage('assets/images/showcase4.png'), context);
|
||||||
|
bool selected = false;
|
||||||
|
|
||||||
return Portal(
|
return Scaffold(
|
||||||
child: Scaffold(
|
body: Container(
|
||||||
body: Container(
|
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
|
||||||
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
|
child: SingleChildScrollView(
|
||||||
child: SingleChildScrollView(
|
physics: const ClampingScrollPhysics(),
|
||||||
physics: const ClampingScrollPhysics(),
|
controller: _scrollController,
|
||||||
controller: _scrollController,
|
child: Container(
|
||||||
child: Container(
|
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
|
||||||
decoration: const BoxDecoration(color: Color(0xFFDAE4F7)),
|
width: MediaQuery.of(context).size.width,
|
||||||
width: MediaQuery.of(context).size.width,
|
height: MediaQuery.of(context).size.height,
|
||||||
height: MediaQuery.of(context).size.height,
|
child: SafeArea(
|
||||||
child: SafeArea(
|
child: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
// app icon
|
||||||
// app icon
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.only(left: 24, top: 20),
|
||||||
padding: const EdgeInsets.only(left: 24, top: 20),
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Image.asset(
|
||||||
Image.asset(
|
'assets/icons/ic_rounded.png',
|
||||||
'assets/icons/ic_rounded.png',
|
width: 30.0,
|
||||||
width: 30.0,
|
),
|
||||||
),
|
const SizedBox(width: 8),
|
||||||
const SizedBox(width: 8),
|
const Text(
|
||||||
const Text(
|
'reFilc',
|
||||||
'reFilc',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
color: Color(0xFF050B15),
|
||||||
color: Color(0xFF050B15),
|
fontSize: 18.0,
|
||||||
fontSize: 18.0,
|
fontWeight: FontWeight.bold,
|
||||||
fontWeight: FontWeight.bold,
|
fontFamily: 'Montserrat'),
|
||||||
fontFamily: 'Montserrat'),
|
),
|
||||||
),
|
Material(
|
||||||
Material(
|
type: MaterialType.transparency,
|
||||||
type: MaterialType.transparency,
|
child: showBack
|
||||||
child: showBack
|
? BackButton(color: AppColors.of(context).text)
|
||||||
? BackButton(
|
: const SizedBox(height: 48.0),
|
||||||
color: AppColors.of(context).text)
|
),
|
||||||
: const SizedBox(height: 48.0),
|
],
|
||||||
),
|
)),
|
||||||
],
|
Stack(
|
||||||
)),
|
alignment: Alignment.bottomCenter,
|
||||||
Stack(
|
children: [
|
||||||
alignment: Alignment.bottomCenter,
|
Column(
|
||||||
children: [
|
//login buttons and ui starts here
|
||||||
// Column(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
children: [
|
||||||
// children: [
|
const SizedBox(height: 21),
|
||||||
// const SizedBox(height: 21),
|
CarouselSlider(
|
||||||
// CarouselSlider(
|
options: CarouselOptions(
|
||||||
// options: CarouselOptions(
|
height: MediaQuery.of(context).size.height,
|
||||||
// height: MediaQuery.of(context).size.height,
|
viewportFraction: 1,
|
||||||
// viewportFraction: 1,
|
autoPlay: true,
|
||||||
// autoPlay: true,
|
autoPlayInterval: const Duration(seconds: 6),
|
||||||
// autoPlayInterval: const Duration(seconds: 6),
|
pauseAutoPlayOnTouch: true),
|
||||||
// pauseAutoPlayOnTouch: true),
|
items: [1, 2, 3, 4].map((i) {
|
||||||
// items: [1, 2, 3, 4].map((i) {
|
return Builder(
|
||||||
// return Builder(
|
builder: (BuildContext context) {
|
||||||
// builder: (BuildContext context) {
|
return Column(
|
||||||
// return Column(
|
crossAxisAlignment:
|
||||||
// crossAxisAlignment:
|
CrossAxisAlignment.start,
|
||||||
// CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
// mainAxisAlignment:
|
children: [
|
||||||
// MainAxisAlignment.start,
|
Padding(
|
||||||
// children: [
|
padding:
|
||||||
// Padding(
|
const EdgeInsets.only(left: 24),
|
||||||
// padding:
|
child: Column(
|
||||||
// const EdgeInsets.only(left: 24),
|
crossAxisAlignment:
|
||||||
// child: Column(
|
CrossAxisAlignment.start,
|
||||||
// crossAxisAlignment:
|
mainAxisAlignment:
|
||||||
// CrossAxisAlignment.start,
|
MainAxisAlignment.start,
|
||||||
// mainAxisAlignment:
|
children: [
|
||||||
// MainAxisAlignment.start,
|
Text(
|
||||||
// children: [
|
"welcome_title_$i".i18n,
|
||||||
// Text(
|
style: const TextStyle(
|
||||||
// "welcome_title_$i".i18n,
|
color: Color(0xFF050B15),
|
||||||
// style: const TextStyle(
|
fontSize: 19,
|
||||||
// color: Color(0xFF050B15),
|
fontFamily: 'Montserrat',
|
||||||
// fontSize: 19,
|
fontWeight: FontWeight.w700,
|
||||||
// fontFamily: 'Montserrat',
|
height: 1.3),
|
||||||
// fontWeight:
|
),
|
||||||
// FontWeight.w700,
|
const SizedBox(
|
||||||
// height: 1.3),
|
height: 14.375), //meth
|
||||||
// ),
|
Padding(
|
||||||
// const SizedBox(
|
padding: const EdgeInsets.only(
|
||||||
// height: 14.375), //meth
|
right: 20),
|
||||||
// Padding(
|
child: Text(
|
||||||
// padding:
|
"welcome_text_$i".i18n,
|
||||||
// const EdgeInsets.only(
|
style: const TextStyle(
|
||||||
// right: 20),
|
color: Color(0xFF050B15),
|
||||||
// child: Text(
|
fontFamily: 'FigTree',
|
||||||
// "welcome_text_$i".i18n,
|
fontWeight:
|
||||||
// style: const TextStyle(
|
FontWeight.w500,
|
||||||
// color:
|
fontSize: 17,
|
||||||
// Color(0xFF050B15),
|
height: 1.3),
|
||||||
// fontFamily: 'FigTree',
|
),
|
||||||
// fontWeight:
|
),
|
||||||
// FontWeight.w500,
|
],
|
||||||
// fontSize: 17,
|
)),
|
||||||
// height: 1.3),
|
const SizedBox(height: 15.625),
|
||||||
// ),
|
Padding(
|
||||||
// ),
|
padding: const EdgeInsets.only(
|
||||||
// ],
|
left: 16, right: 16),
|
||||||
// )),
|
child: Image.asset(
|
||||||
// const SizedBox(height: 15.625),
|
'assets/images/showcase$i.png'))
|
||||||
// Padding(
|
],
|
||||||
// padding: const EdgeInsets.only(
|
);
|
||||||
// left: 16, right: 16),
|
},
|
||||||
// child: Image.asset(
|
);
|
||||||
// 'assets/images/showcase$i.png'))
|
}).toList(),
|
||||||
// ],
|
),
|
||||||
// );
|
],
|
||||||
// },
|
),
|
||||||
// );
|
Container(
|
||||||
// }).toList(),
|
height: 300,
|
||||||
// ),
|
width: double.infinity,
|
||||||
// ],
|
decoration: const BoxDecoration(
|
||||||
// ),
|
gradient: LinearGradient(
|
||||||
// Container(
|
colors: [Color(0x00DAE4F7), Color(0xFFDAE4F7)],
|
||||||
// height: 250,
|
stops: [0, 0.12],
|
||||||
// width: double.infinity,
|
begin: Alignment.topCenter,
|
||||||
// decoration: const BoxDecoration(
|
end: Alignment.bottomCenter,
|
||||||
// gradient: LinearGradient(
|
),
|
||||||
// colors: [Color(0x00DAE4F7), Color(0xFFDAE4F7)],
|
),
|
||||||
// stops: [0, 0.1],
|
child: Padding(
|
||||||
// begin: Alignment.topCenter,
|
padding: EdgeInsets.only(top: 50, bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||||
// end: Alignment.bottomCenter,
|
child: Column(
|
||||||
// ),
|
children: [
|
||||||
// ),
|
SizedBox(
|
||||||
// child: Padding(
|
height: 48,
|
||||||
// padding: const EdgeInsets.only(top: 3),
|
width: double.infinity,
|
||||||
// child: Column(
|
child: Padding(
|
||||||
// children: [
|
padding: const EdgeInsets.symmetric(
|
||||||
// SizedBox(
|
horizontal: 16),
|
||||||
// height: 48,
|
child: FilledButton(
|
||||||
// width: double.infinity,
|
style: ButtonStyle(
|
||||||
// child: Padding(
|
shape: MaterialStateProperty.all<
|
||||||
// padding: const EdgeInsets.symmetric(
|
RoundedRectangleBorder>(
|
||||||
// horizontal: 16),
|
const RoundedRectangleBorder(
|
||||||
// child: FilledButton(
|
borderRadius: BorderRadius.all(
|
||||||
// style: ButtonStyle(
|
Radius.circular(12)),
|
||||||
// shape: MaterialStateProperty.all<
|
))),
|
||||||
// RoundedRectangleBorder>(
|
onPressed: () {
|
||||||
// const RoundedRectangleBorder(
|
showModalBottomSheet(
|
||||||
// borderRadius: BorderRadius.all(
|
backgroundColor: Colors.transparent,
|
||||||
// Radius.circular(12)),
|
context: context,
|
||||||
// ))),
|
builder: (BuildContext context) {
|
||||||
// onPressed: () {},
|
return Container(
|
||||||
// child: Text(
|
height: MediaQuery.of(context)
|
||||||
// "login".i18n,
|
.size
|
||||||
// style: const TextStyle(
|
.height *
|
||||||
// fontFamily: 'Montserrat',
|
0.5 + MediaQuery.of(context).viewInsets.bottom,
|
||||||
// fontSize: 20,
|
decoration: const BoxDecoration(
|
||||||
// fontWeight: FontWeight.w700),
|
color: Color(0xFFDAE4F7),
|
||||||
// )),
|
borderRadius: BorderRadius.only(
|
||||||
// ),
|
topRight:
|
||||||
// ),
|
Radius.circular(24.0),
|
||||||
// const SizedBox(height: 8),
|
topLeft:
|
||||||
// ],
|
Radius.circular(24.0),
|
||||||
// ),
|
),
|
||||||
// ),
|
),
|
||||||
// )
|
child: Column(
|
||||||
//
|
crossAxisAlignment:
|
||||||
//
|
CrossAxisAlignment.center,
|
||||||
// TODO: OLD LOGIN FROM HERE
|
mainAxisAlignment:
|
||||||
Column(
|
MainAxisAlignment.start,
|
||||||
//login buttons and ui starts here
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
padding:
|
||||||
children: [
|
const EdgeInsets.only(
|
||||||
Padding(
|
top: 18),
|
||||||
padding: const EdgeInsets.only(
|
child: Container(
|
||||||
left: 22.0,
|
decoration:
|
||||||
right: 22.0,
|
const BoxDecoration(
|
||||||
top: 0.0,
|
color:
|
||||||
),
|
Color(0xFFB9C8E5),
|
||||||
child: AutofillGroup(
|
borderRadius:
|
||||||
child: Column(
|
BorderRadius.only(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
topRight:
|
||||||
children: [
|
Radius.circular(
|
||||||
// username
|
2.0),
|
||||||
Padding(
|
topLeft:
|
||||||
padding:
|
Radius.circular(
|
||||||
const EdgeInsets.only(bottom: 6.0),
|
2.0),
|
||||||
child: Row(
|
),
|
||||||
mainAxisAlignment:
|
),
|
||||||
MainAxisAlignment.spaceBetween,
|
width: 40,
|
||||||
children: [
|
height: 4,
|
||||||
Expanded(
|
),
|
||||||
child: Text(
|
),
|
||||||
"username".i18n,
|
Container(
|
||||||
maxLines: 1,
|
width: double.infinity,
|
||||||
style: TextStyle(
|
child: AutofillGroup(
|
||||||
color: AppColors.of(context)
|
child: Column(
|
||||||
.loginPrimary,
|
crossAxisAlignment:
|
||||||
fontWeight: FontWeight.w500,
|
CrossAxisAlignment
|
||||||
fontSize: 12.0,
|
.end,
|
||||||
),
|
children: [
|
||||||
),
|
// username
|
||||||
),
|
Padding(
|
||||||
Expanded(
|
padding:
|
||||||
child: Text(
|
const EdgeInsets
|
||||||
"usernameHint".i18n,
|
.only(
|
||||||
maxLines: 1,
|
bottom:
|
||||||
textAlign: TextAlign.right,
|
6.0),
|
||||||
style: TextStyle(
|
child: Row(
|
||||||
color: AppColors.of(context)
|
mainAxisAlignment:
|
||||||
.loginSecondary,
|
MainAxisAlignment
|
||||||
fontWeight: FontWeight.w500,
|
.spaceBetween,
|
||||||
fontSize: 12.0,
|
children: [
|
||||||
),
|
Expanded(
|
||||||
),
|
child: Text(
|
||||||
),
|
"username"
|
||||||
],
|
.i18n,
|
||||||
),
|
maxLines:
|
||||||
),
|
1,
|
||||||
Padding(
|
style:
|
||||||
padding:
|
TextStyle(
|
||||||
const EdgeInsets.only(bottom: 12.0),
|
color: AppColors.of(context)
|
||||||
child: LoginInput(
|
.loginPrimary,
|
||||||
style: LoginInputStyle.username,
|
fontWeight:
|
||||||
controller: usernameController,
|
FontWeight.w500,
|
||||||
),
|
fontSize:
|
||||||
),
|
12.0,
|
||||||
|
),
|
||||||
// password
|
),
|
||||||
Padding(
|
),
|
||||||
padding:
|
Expanded(
|
||||||
const EdgeInsets.only(bottom: 6.0),
|
child: Text(
|
||||||
child: Row(
|
"usernameHint"
|
||||||
mainAxisAlignment:
|
.i18n,
|
||||||
MainAxisAlignment.spaceBetween,
|
maxLines:
|
||||||
children: [
|
1,
|
||||||
Expanded(
|
textAlign:
|
||||||
child: Text(
|
TextAlign
|
||||||
"password".i18n,
|
.right,
|
||||||
maxLines: 1,
|
style:
|
||||||
style: TextStyle(
|
TextStyle(
|
||||||
color: AppColors.of(context)
|
color: AppColors.of(context)
|
||||||
.loginPrimary,
|
.loginSecondary,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight:
|
||||||
fontSize: 12.0,
|
FontWeight.w500,
|
||||||
),
|
fontSize:
|
||||||
),
|
12.0,
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
child: Text(
|
),
|
||||||
"passwordHint".i18n,
|
],
|
||||||
maxLines: 1,
|
),
|
||||||
textAlign: TextAlign.right,
|
),
|
||||||
style: TextStyle(
|
Padding(
|
||||||
color: AppColors.of(context)
|
padding:
|
||||||
.loginSecondary,
|
const EdgeInsets
|
||||||
fontWeight: FontWeight.w500,
|
.only(
|
||||||
fontSize: 12.0,
|
bottom:
|
||||||
),
|
12.0),
|
||||||
),
|
child: LoginInput(
|
||||||
),
|
style:
|
||||||
],
|
LoginInputStyle
|
||||||
),
|
.username,
|
||||||
),
|
controller:
|
||||||
Padding(
|
usernameController,
|
||||||
padding:
|
),
|
||||||
const EdgeInsets.only(bottom: 12.0),
|
),
|
||||||
child: LoginInput(
|
|
||||||
style: LoginInputStyle.password,
|
// password
|
||||||
controller: passwordController,
|
Padding(
|
||||||
),
|
padding:
|
||||||
),
|
const EdgeInsets
|
||||||
|
.only(
|
||||||
// school
|
bottom:
|
||||||
Padding(
|
6.0),
|
||||||
padding:
|
child: Row(
|
||||||
const EdgeInsets.only(bottom: 6.0),
|
mainAxisAlignment:
|
||||||
child: Text(
|
MainAxisAlignment
|
||||||
"school".i18n,
|
.spaceBetween,
|
||||||
maxLines: 1,
|
children: [
|
||||||
style: TextStyle(
|
Expanded(
|
||||||
color: AppColors.of(context)
|
child: Text(
|
||||||
.loginPrimary,
|
"password"
|
||||||
fontWeight: FontWeight.w500,
|
.i18n,
|
||||||
fontSize: 12.0,
|
maxLines:
|
||||||
),
|
1,
|
||||||
),
|
style:
|
||||||
),
|
TextStyle(
|
||||||
SchoolInput(
|
color: AppColors.of(context)
|
||||||
scroll: _scrollController,
|
.loginPrimary,
|
||||||
controller: schoolController,
|
fontWeight:
|
||||||
),
|
FontWeight.w500,
|
||||||
],
|
fontSize:
|
||||||
),
|
12.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.only(
|
Expanded(
|
||||||
top: 35.0,
|
child: Text(
|
||||||
left: 22.0,
|
"passwordHint"
|
||||||
right: 22.0,
|
.i18n,
|
||||||
),
|
maxLines:
|
||||||
child: Visibility(
|
1,
|
||||||
visible: _loginState != LoginState.inProgress,
|
textAlign:
|
||||||
replacement: const Padding(
|
TextAlign
|
||||||
padding: EdgeInsets.symmetric(vertical: 6.0),
|
.right,
|
||||||
child: CircularProgressIndicator(
|
style:
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
TextStyle(
|
||||||
Colors.white),
|
color: AppColors.of(context)
|
||||||
),
|
.loginSecondary,
|
||||||
),
|
fontWeight:
|
||||||
child: LoginButton(
|
FontWeight.w500,
|
||||||
child: Text("login".i18n,
|
fontSize:
|
||||||
maxLines: 1,
|
12.0,
|
||||||
style: const TextStyle(
|
),
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
fontSize: 20.0,
|
),
|
||||||
)),
|
],
|
||||||
onPressed: () => _loginAPI(context: context),
|
),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
),
|
padding:
|
||||||
],
|
const EdgeInsets
|
||||||
),
|
.only(
|
||||||
// TODO: OLD LOGIN FROM HERE
|
bottom:
|
||||||
],
|
12.0),
|
||||||
),
|
child: LoginInput(
|
||||||
|
style:
|
||||||
if (_loginState == LoginState.missingFields ||
|
LoginInputStyle
|
||||||
_loginState == LoginState.invalidGrant ||
|
.password,
|
||||||
_loginState == LoginState.failed)
|
controller:
|
||||||
Padding(
|
passwordController,
|
||||||
padding: const EdgeInsets.only(
|
),
|
||||||
top: 8.0, left: 12.0, right: 12.0),
|
),
|
||||||
child: Text(
|
|
||||||
[
|
// school
|
||||||
"missing_fields",
|
Padding(
|
||||||
"invalid_grant",
|
padding:
|
||||||
"error"
|
const EdgeInsets
|
||||||
][_loginState.index]
|
.only(
|
||||||
.i18n,
|
bottom:
|
||||||
style: const TextStyle(
|
6.0),
|
||||||
color: Colors.red,
|
child: Text(
|
||||||
fontWeight: FontWeight.w500,
|
"school".i18n,
|
||||||
|
maxLines: 1,
|
||||||
|
style:
|
||||||
|
TextStyle(
|
||||||
|
color: AppColors.of(
|
||||||
|
context)
|
||||||
|
.loginPrimary,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.w500,
|
||||||
|
fontSize:
|
||||||
|
12.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SchoolInput(
|
||||||
|
scroll:
|
||||||
|
_scrollController,
|
||||||
|
controller:
|
||||||
|
schoolController,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 22.0,
|
||||||
|
right: 22.0,
|
||||||
|
top: 0.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(
|
||||||
|
top: 35.0,
|
||||||
|
left: 22.0,
|
||||||
|
right: 22.0,
|
||||||
|
),
|
||||||
|
child: Visibility(
|
||||||
|
visible: _loginState !=
|
||||||
|
LoginState
|
||||||
|
.inProgress,
|
||||||
|
replacement:
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets
|
||||||
|
.symmetric(
|
||||||
|
vertical:
|
||||||
|
6.0),
|
||||||
|
child:
|
||||||
|
CircularProgressIndicator(
|
||||||
|
valueColor:
|
||||||
|
AlwaysStoppedAnimation<
|
||||||
|
Color>(
|
||||||
|
Colors
|
||||||
|
.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: LoginButton(
|
||||||
|
child: Text(
|
||||||
|
"login".i18n,
|
||||||
|
maxLines: 1,
|
||||||
|
style:
|
||||||
|
const TextStyle(
|
||||||
|
fontWeight:
|
||||||
|
FontWeight
|
||||||
|
.bold,
|
||||||
|
fontSize: 20.0,
|
||||||
|
)),
|
||||||
|
onPressed: () =>
|
||||||
|
_loginAPI(
|
||||||
|
context:
|
||||||
|
context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
"login".i18n,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'Montserrat',
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// privacy policy
|
],
|
||||||
GestureDetector(
|
),
|
||||||
onTap: () => PrivacyView.show(context),
|
|
||||||
|
if (_loginState == LoginState.missingFields ||
|
||||||
|
_loginState == LoginState.invalidGrant ||
|
||||||
|
_loginState == LoginState.failed)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 8.0, left: 12.0, right: 12.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'privacy'.i18n,
|
[
|
||||||
style: TextStyle(
|
"missing_fields",
|
||||||
color: AppColors.of(context).loginSecondary,
|
"invalid_grant",
|
||||||
|
"error"
|
||||||
|
][_loginState.index]
|
||||||
|
.i18n,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.red,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: 14.0,
|
|
||||||
),
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
// privacy policy
|
||||||
),
|
GestureDetector(
|
||||||
|
onTap: () => PrivacyView.show(context),
|
||||||
|
child: Text(
|
||||||
|
'privacy'.i18n,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).loginSecondary,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 14.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user