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_nurses/lib/ui/login/login_page.dart

104 lines
3.7 KiB
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_nurses/classes/colors.dart';
import 'package:hmg_nurses/config/routes.dart';
import 'package:hmg_nurses/generated/locale_keys.g.dart';
import 'package:hmg_nurses/widgets/button/default_button.dart';
import 'package:hmg_nurses/widgets/cupertino_picker.dart';
import 'package:hmg_nurses/widgets/input_widget.dart';
import 'package:sizer/sizer.dart';
class LoginPage extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key);
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final loginFormKey = GlobalKey<FormState>();
var projectIdController = TextEditingController();
var userIdController = TextEditingController();
var passwordController = TextEditingController();
SizedBox buildSpacer20h() => SizedBox(height: 3.h);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10.h),
Padding(
padding: EdgeInsets.only(left: 8.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
LocaleKeys.welcomeTo.tr(),
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600, fontFamily: 'Poppins'),
),
Text(
LocaleKeys.drSulaiman.tr(),
style: TextStyle(color: MyColors.blackColor, fontWeight: FontWeight.bold, fontSize: 24.sp, fontFamily: 'Poppins'),
),
Text(
"Nurses App",
style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600, color: MyColors.redColor),
),
],
),
),
SizedBox(height: 4.h),
Form(
key: loginFormKey,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
buildSpacer20h(),
CustomTextField(LocaleKeys.userID.tr(), userIdController, isEnableBorder: true, ),
buildSpacer20h(),
CustomTextField(LocaleKeys.password.tr(), passwordController, isTextIsPassword: true),
buildSpacer20h(),
CustomTextField(
LocaleKeys.branch.tr(),
projectIdController,
hasSelection: true,
isEnable: false,
onClick: () => CustomCupertinoPicker.showCupertinoPicker(context, [], () {}),
),
buildSpacer20h()
]),
),
)
],
),
),
bottomSheet: Container(
height: 12.h,
color: MyColors.backgroundColor,
width: double.infinity,
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 4.w),
child: DefaultButton(LocaleKeys.login.tr(), () {
Navigator.pushNamed(context, AppRoutes.loginMethodsPage);
}, colors: const [MyColors.redColor, MyColors.redColor]),
),
SizedBox(height: 3.h)
],
),
),
),
),
);
}
}