This commit is contained in:
Phuoc Nguyen
2025-11-10 14:21:27 +07:00
parent 2a71c65577
commit 36bdf6613b
33 changed files with 2206 additions and 252 deletions

View File

@@ -41,13 +41,16 @@ class _LoginPageState extends ConsumerState<LoginPage> {
final _formKey = GlobalKey<FormState>();
// Controllers
final _phoneController = TextEditingController(text: "0988111111");
final _phoneController = TextEditingController(text: "0978113710");
final _passwordController = TextEditingController(text: "123456");
// Focus nodes
final _phoneFocusNode = FocusNode();
final _passwordFocusNode = FocusNode();
// Remember me checkbox state
bool _rememberMe = true;
@override
void dispose() {
_phoneController.dispose();
@@ -74,11 +77,12 @@ class _LoginPageState extends ConsumerState<LoginPage> {
.login(
phoneNumber: _phoneController.text.trim(),
password: _passwordController.text,
rememberMe: _rememberMe,
);
// Check if login was successful
final authState = ref.read(authProvider);
authState.when(
final authState = ref.read(authProvider)
..when(
data: (user) {
if (user != null && mounted) {
// Navigate to home on success
@@ -402,7 +406,45 @@ class _LoginPageState extends ConsumerState<LoginPage> {
},
),
const SizedBox(height: AppSpacing.lg),
const SizedBox(height: AppSpacing.sm),
// Remember Me Checkbox
Row(
children: [
Checkbox(
value: _rememberMe,
onChanged: isLoading
? null
: (value) {
setState(() {
_rememberMe = value ?? false;
});
},
activeColor: AppColors.primaryBlue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0),
),
),
GestureDetector(
onTap: isLoading
? null
: () {
setState(() {
_rememberMe = !_rememberMe;
});
},
child: const Text(
'Ghi nhớ đăng nhập',
style: TextStyle(
fontSize: 14.0,
color: AppColors.grey500,
),
),
),
],
),
const SizedBox(height: AppSpacing.md),
// Login Button
SizedBox(