marco.pms.mobileapp/lib/view/auth/forgot_password_screen.dart

119 lines
4.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_lucide/flutter_lucide.dart';
import 'package:get/get.dart';
import 'package:marco/controller/auth/forgot_password_controller.dart';
import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
import 'package:marco/helpers/widgets/my_button.dart';
import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/helpers/widgets/my_text_style.dart';
import 'package:marco/view/layouts/auth_layout.dart';
import 'package:marco/images.dart';
import 'package:marco/helpers/theme/app_theme.dart';
class ForgotPasswordScreen extends StatefulWidget {
const ForgotPasswordScreen({super.key});
@override
State<ForgotPasswordScreen> createState() => _ForgotPasswordScreenState();
}
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with UIMixin {
ForgotPasswordController controller = Get.put(ForgotPasswordController());
@override
Widget build(BuildContext context) {
return AuthLayout(
child: GetBuilder(
init: controller,
builder: (controller) {
return Form(
key: controller.basicValidator.formKey,
child: SingleChildScrollView(
padding: MySpacing.xy(2, 40),
child: Container(
width: double.infinity,
padding: MySpacing.all(24),
decoration: BoxDecoration(
color: theme.colorScheme.primary.withOpacity(0.02),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: contentTheme.primary.withOpacity(0.5),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Image.asset(
Images.logoDark,
height: 120,
fit: BoxFit.contain,
),
),
MySpacing.height(10),
MyText.titleLarge("Forgot Password", fontWeight: 600),
MySpacing.height(12),
MyText.bodyMedium(
"Enter your email and we'll send you instructions to reset your password.",
fontWeight: 600,
xMuted: true,
),
MySpacing.height(12),
TextFormField(
validator: controller.basicValidator.getValidation('email'),
controller: controller.basicValidator.getController('email'),
keyboardType: TextInputType.emailAddress,
style: MyTextStyle.labelMedium(),
decoration: InputDecoration(
labelText: "Email Address",
labelStyle: MyTextStyle.bodySmall(xMuted: true),
border: OutlineInputBorder(borderSide: BorderSide.none),
filled: true,
fillColor: theme.cardColor,
prefixIcon: Icon(LucideIcons.mail, size: 16),
contentPadding: MySpacing.all(15),
isDense: true,
isCollapsed: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
),
),
MySpacing.height(20),
Center(
child: MyButton.rounded(
onPressed: controller.onForgotPassword,
elevation: 0,
padding: MySpacing.xy(20, 16),
backgroundColor: Colors.blueAccent,
child: MyText.labelMedium(
'Send Reset Link',
color: contentTheme.onPrimary,
),
),
),
Center(
child: MyButton.text(
onPressed: controller.gotoLogIn,
elevation: 0,
padding: MySpacing.x(16),
splashColor:
contentTheme.secondary.withValues(alpha: 0.1),
child: MyText.labelMedium(
'Back to log in',
color: contentTheme.secondary,
),
),
),
],
),
),
),
);
},
),
);
}
}