You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App_New/lib/presentation/authentication/login.dart

116 lines
5.1 KiB
Dart

2 months ago
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
2 months ago
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:sizer/sizer.dart';
2 months ago
class LoginScreen extends StatelessWidget {
const LoginScreen({super.key});
2 months ago
@override
Widget build(BuildContext context) {
2 months ago
return Sizer(// Wrap with Sizer
builder: (context, orientation, deviceType) {
return Scaffold(
appBar: CustomAppBar(
onBackPressed: () {
},
onLanguageChanged: (String value) {
print(value);
context.setLocale(value == 'en' ? Locale('ar', 'SA') : Locale('en', 'US'));
},
),
body: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus(); // Dismiss the keyboard when tapping outside
},
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(left: 6.w, right: 6.w),
2 months ago
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
2 months ago
Utils.showLottie(context: context, assetPath: AppAnimations.login, width: 45.w, height: 22.h, repeat: true, fit: BoxFit.cover),
SizedBox(height: 19.h), // Adjusted to sizer unit
2 months ago
Text(
LocaleKeys.welcomeToDrSulaiman.tr(),
style: context.dynamicTextStyle(
2 months ago
fontSize: 22.sp,
2 months ago
fontWeight: FontWeight.w600,
2 months ago
color: AppColors.textColor,
2 months ago
letterSpacing: -0.4,
height: 40 / 28,
),
),
2 months ago
SizedBox(height: 4.h), // Adjusted to sizer unit (approx 32px)
2 months ago
TextInputWidget(
labelText: "${LocaleKeys.nationalId.tr()} / ${LocaleKeys.fileNo.tr()}",
hintText: "xxxxxxxxx",
controller: TextEditingController(),
keyboardType: TextInputType.number,
isEnable: true,
prefix: null,
autoFocus: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
2 months ago
padding: EdgeInsets.symmetric(vertical: 1.h, horizontal: 2.w),
2 months ago
leadingIcon: AppAssets.student_card,
2 months ago
errorMessage: "Please enter a valid national ID or file number",
hasError: true,
2 months ago
),
2 months ago
SizedBox(height: 2.h), // Adjusted to sizer unit (approx 16px)
2 months ago
CustomButton(
text: LocaleKeys.login.tr(),
icon: AppAssets.login1,
iconColor: Colors.white,
onPressed: () {},
),
2 months ago
SizedBox(height: 1.8.h), // Adjusted to sizer unit (approx 14px)
2 months ago
Center(
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: context.dynamicTextStyle(
color: Colors.black,
2 months ago
fontSize: 14.sp, // Adjusted to sizer unit
height: 26 / 16, // This height is a ratio, may need re-evaluation
2 months ago
fontWeight: FontWeight.w500,
),
children: <TextSpan>[
TextSpan(text: LocaleKeys.dontHaveAccount.tr(), style: context.dynamicTextStyle()),
TextSpan(text: " "),
TextSpan(
text: LocaleKeys.registernow.tr(),
style: context.dynamicTextStyle(
2 months ago
color: AppColors.primaryRedColor,
fontSize: 14.sp, // Adjusted to sizer unit
height: 26 / 16, // Ratio
2 months ago
fontWeight: FontWeight.w500,
),
recognizer: TapGestureRecognizer()..onTap = () {},
),
],
),
2 months ago
).withVerticalPadding(2.h), // Adjusted to sizer unit
2 months ago
),
],
),
),
),
),
2 months ago
);
});
2 months ago
}
}