|
@@ -1,4 +1,10 @@
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
+import 'package:flutter_auth/models/config.dart';
|
|
|
|
|
+import 'package:flutter_auth/pages/background.dart';
|
|
|
|
|
+import 'package:flutter_auth/pages/register_page.dart';
|
|
|
|
|
+import 'package:flutter_auth/views/already_have_an_account_check.dart';
|
|
|
|
|
+import 'package:flutter_auth/views/responsive.dart';
|
|
|
|
|
+import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
|
|
/// Description: login page
|
|
/// Description: login page
|
|
|
/// Time : 08/24/2023 Thursday
|
|
/// Time : 08/24/2023 Thursday
|
|
@@ -13,8 +19,142 @@ class LoginPage extends StatefulWidget {
|
|
|
class _LoginPageState extends State<LoginPage> {
|
|
class _LoginPageState extends State<LoginPage> {
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
- return Scaffold(
|
|
|
|
|
- appBar: AppBar(title: const Text('Login Page')),
|
|
|
|
|
- body: const Placeholder());
|
|
|
|
|
|
|
+ return Background(
|
|
|
|
|
+ child: SingleChildScrollView(
|
|
|
|
|
+ child: SafeArea(
|
|
|
|
|
+ child: Responsive(
|
|
|
|
|
+ mobile: buildLoginMobile(), desktop: buildLoginDesktop()),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildLoginDesktop() {
|
|
|
|
|
+ return Row(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Expanded(child: LoginTop()),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: Row(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ children: [
|
|
|
|
|
+ SizedBox(
|
|
|
|
|
+ width: 450,
|
|
|
|
|
+ child: LoginForm(),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ))
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildLoginMobile() {
|
|
|
|
|
+ return Column(
|
|
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
+ children: [
|
|
|
|
|
+ LoginTop(),
|
|
|
|
|
+ Row(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Spacer(),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ child: LoginForm(),
|
|
|
|
|
+ flex: 8,
|
|
|
|
|
+ ),
|
|
|
|
|
+ Spacer()
|
|
|
|
|
+ ],
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+class LoginForm extends StatelessWidget {
|
|
|
|
|
+ const LoginForm({super.key});
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
|
+ return Form(
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ TextFormField(
|
|
|
|
|
+ keyboardType: TextInputType.emailAddress,
|
|
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
|
|
+ cursorColor: kPrimaryColor,
|
|
|
|
|
+ onSaved: (email) {},
|
|
|
|
|
+ decoration: InputDecoration(
|
|
|
|
|
+ hintText: "Your email",
|
|
|
|
|
+ prefixIcon: Padding(
|
|
|
|
|
+ padding: const EdgeInsets.all(defaultPadding),
|
|
|
|
|
+ child: Icon(Icons.person),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Padding(
|
|
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: defaultPadding),
|
|
|
|
|
+ child: TextFormField(
|
|
|
|
|
+ textInputAction: TextInputAction.done,
|
|
|
|
|
+ obscureText: true,
|
|
|
|
|
+ cursorColor: kPrimaryColor,
|
|
|
|
|
+ decoration: InputDecoration(
|
|
|
|
|
+ hintText: "Your password",
|
|
|
|
|
+ prefixIcon: Padding(
|
|
|
|
|
+ padding: const EdgeInsets.all(defaultPadding),
|
|
|
|
|
+ child: Icon(Icons.lock),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ const SizedBox(height: defaultPadding),
|
|
|
|
|
+ Hero(
|
|
|
|
|
+ tag: "login_btn",
|
|
|
|
|
+ child: ElevatedButton(
|
|
|
|
|
+ onPressed: () {},
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ "Login".toUpperCase(),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ const SizedBox(height: defaultPadding),
|
|
|
|
|
+ AlreadyHaveAnAccountCheck(
|
|
|
|
|
+ press: () {
|
|
|
|
|
+ Navigator.push(
|
|
|
|
|
+ context,
|
|
|
|
|
+ MaterialPageRoute(
|
|
|
|
|
+ builder: (context) {
|
|
|
|
|
+ return RegisterPage();
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+class LoginTop extends StatelessWidget {
|
|
|
|
|
+ const LoginTop({super.key});
|
|
|
|
|
+
|
|
|
|
|
+ @override
|
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
|
+ return Column(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ Text(
|
|
|
|
|
+ "LOGIN",
|
|
|
|
|
+ style: TextStyle(fontWeight: FontWeight.bold),
|
|
|
|
|
+ ),
|
|
|
|
|
+ SizedBox(height: defaultPadding * 2),
|
|
|
|
|
+ Row(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ const Spacer(),
|
|
|
|
|
+ Expanded(
|
|
|
|
|
+ flex: 8,
|
|
|
|
|
+ child: SvgPicture.asset("assets/icons/login.svg"),
|
|
|
|
|
+ ),
|
|
|
|
|
+ const Spacer(),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ SizedBox(height: defaultPadding * 2),
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|