|
|
|
@@ -14,6 +14,7 @@ import '../../../themes/styles_text.dart'; |
|
|
|
import '../../../utils/app_images.dart'; |
|
|
|
import '../../../utils/const_enum.dart'; |
|
|
|
import '../../../utils/helpers.dart'; |
|
|
|
import '../../../utils/local_storage.dart'; |
|
|
|
import '../../../utils/utils.dart'; |
|
|
|
import '../../../utils/validators.dart'; |
|
|
|
import '../../custom_widgets/button/primary_button_widget.dart'; |
|
|
|
@@ -34,10 +35,11 @@ class _LoginPageState extends State<LoginPage> { |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
if (kDebugMode) { |
|
|
|
loginBloc.usernameCtl.text = 'admin'; |
|
|
|
loginBloc.passwordCtl.text = 'khongcopass'; |
|
|
|
} |
|
|
|
// if (kDebugMode) { |
|
|
|
// loginBloc.usernameCtl.text = 'quanly1'; |
|
|
|
// loginBloc.passwordCtl.text = 'Abcd@1234'; |
|
|
|
// } |
|
|
|
prepareData(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
@@ -46,6 +48,11 @@ class _LoginPageState extends State<LoginPage> { |
|
|
|
loginBloc.dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
void prepareData() { |
|
|
|
var username = LocalStorage.getString(LocalStorageKey.username); |
|
|
|
loginBloc.usernameCtl.text = username; |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocListener<LoginCubit, LoginState>( |
|
|
|
@@ -244,33 +251,34 @@ class _LoginPageState extends State<LoginPage> { |
|
|
|
), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
ValueListenableBuilder<bool>( |
|
|
|
valueListenable: loginBloc.isRemember, |
|
|
|
builder: (context, isRemember, _) { |
|
|
|
return FlutterSwitch( |
|
|
|
width: 36.w, |
|
|
|
height: 19.h, |
|
|
|
toggleSize: 14.r, |
|
|
|
value: isRemember, |
|
|
|
borderRadius: 18.r, |
|
|
|
padding: 3.r, |
|
|
|
showOnOff: false, |
|
|
|
activeColor: AppColors.primary1, |
|
|
|
onToggle: (val) { |
|
|
|
onPressedRememberLogin(val); |
|
|
|
}, |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
const SizedBox( |
|
|
|
width: 10, |
|
|
|
), |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
'Ghi nhớ đăng nhập', |
|
|
|
style: StylesText.caption3, |
|
|
|
), |
|
|
|
), |
|
|
|
// ValueListenableBuilder<bool>( |
|
|
|
// valueListenable: loginBloc.isRemember, |
|
|
|
// builder: (context, isRemember, _) { |
|
|
|
// return FlutterSwitch( |
|
|
|
// width: 36.w, |
|
|
|
// height: 19.h, |
|
|
|
// toggleSize: 14.r, |
|
|
|
// value: isRemember, |
|
|
|
// borderRadius: 18.r, |
|
|
|
// padding: 3.r, |
|
|
|
// showOnOff: false, |
|
|
|
// activeColor: AppColors.primary1, |
|
|
|
// onToggle: (val) { |
|
|
|
// onPressedRememberLogin(val); |
|
|
|
// }, |
|
|
|
// ); |
|
|
|
// }, |
|
|
|
// ), |
|
|
|
// const SizedBox( |
|
|
|
// width: 10, |
|
|
|
// ), |
|
|
|
// Expanded( |
|
|
|
// child: Text( |
|
|
|
// 'Ghi nhớ đăng nhập', |
|
|
|
// style: StylesText.caption3, |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
Expanded(child: const SizedBox.shrink()), |
|
|
|
GhostButtonWidget( |
|
|
|
title: 'Quên Mật Khẩu', |
|
|
|
onPressed: () { |