fixed some login design bug in table and desktop

This commit is contained in:
llsajjad
2025-08-10 14:42:04 +03:30
parent 55d7d96baf
commit 4d4fbd2da1
8 changed files with 224 additions and 91 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

+1
View File
@@ -6,6 +6,7 @@ class AssetsManager {
// login page // login page
static const logo = 'assets/pngs/logo.png'; static const logo = 'assets/pngs/logo.png';
static const webLoginImage = 'assets/pngs/web_login_image.png';
static const userIcon = 'assets/svgs/user_icon.svg'; static const userIcon = 'assets/svgs/user_icon.svg';
static const passwordIcon = 'assets/svgs/password_icon.svg'; static const passwordIcon = 'assets/svgs/password_icon.svg';
static const passwordVisibility = 'assets/svgs/password_visibility.svg'; static const passwordVisibility = 'assets/svgs/password_visibility.svg';
+1
View File
@@ -128,4 +128,5 @@ class AppColors {
static const Color lightBlue = Color(0xFFe8ecfc); static const Color lightBlue = Color(0xFFe8ecfc);
static const Color cyanAqua = Color(0xFFd6f4f8); static const Color cyanAqua = Color(0xFFd6f4f8);
static const Color cyanTeal = Color(0xFF24A6B4); static const Color cyanTeal = Color(0xFF24A6B4);
static const Color white = Color(0xFFFFFFFF);
} }
+34 -12
View File
@@ -20,7 +20,10 @@ class LoginDesktopPage extends StatelessWidget {
body: Center( body: Center(
child: SingleChildScrollView( child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()), padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: SizedBox( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: 526, width: 526,
child: Consumer<AuthViewModel>( child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) { builder: (context, viewModel, _) {
@@ -31,34 +34,37 @@ class LoginDesktopPage extends StatelessWidget {
SizedBox(height: 32.0.h()), SizedBox(height: 32.0.h()),
const LoginTitle(), const LoginTitle(),
SizedBox(height: 32.0.h()), SizedBox(height: 32.0.h()),
LoginTextField( LoginTextField(
controller: viewModel.usernameController, controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus, focusNode: viewModel.usernameFocus,
label: AppStrings.usernameLabel, label: AppStrings.usernameLabel,
iconPath: AssetsManager.userIcon, iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(), fieldHeight: 60.0.h(),
borderRedus: 4.0.w(), borderRedus: 12,
prefixIconPadding: 4.0.w(), prefixIconPadding: 7.0.w(),
), ),
SizedBox(height: 16.0.h()), SizedBox(height: 16.0.h()),
LoginTextField( LoginTextField(
controller: viewModel.passwordController, controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus, focusNode: viewModel.passwordFocus,
label: AppStrings.passwordLabel, label: AppStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon, iconPath: AssetsManager.passwordIcon,
prefixIconPadding: 4.0.w(), prefixIconPadding: 7.0.w(),
isPassword: true, isPassword: true,
obscureText: viewModel.obscurePassword, obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(), fieldHeight: 60.0.h(),
onToggleVisibility: viewModel.togglePasswordVisibility, onToggleVisibility:
borderRedus: 4.0.w(), viewModel.togglePasswordVisibility,
borderRedus: 12,
), ),
SizedBox(height: 32.0.h()), SizedBox(height: 32.0.h()),
if (viewModel.isLoading) if (viewModel.isLoading)
const CircularProgressIndicator() BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else else
BaseButton( BaseButton(
isEnabled: viewModel.isLoginEnabled, isEnabled: viewModel.isLoginEnabled,
@@ -68,10 +74,15 @@ class LoginDesktopPage extends StatelessWidget {
await viewModel.login(); await viewModel.login();
if (viewModel.loggedInUser != null) { if (viewModel.loggedInUser != null) {
HomeRouteData().go(context); HomeRouteData().go(context);
} else if (viewModel.errorMessage != null) { } else if (viewModel.errorMessage !=
ScaffoldMessenger.of(context).showSnackBar( null) {
ScaffoldMessenger.of(
context,
).showSnackBar(
SnackBar( SnackBar(
content: Text(viewModel.errorMessage!), content: Text(
viewModel.errorMessage!,
),
), ),
); );
} }
@@ -83,6 +94,17 @@ class LoginDesktopPage extends StatelessWidget {
}, },
), ),
), ),
Padding(
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
child: Image.asset(
AssetsManager.webLoginImage,
width: 796.0.w(),
height: 944.0.h(),
fit: BoxFit.fitHeight,
),
),
],
),
), ),
), ),
); );
+5 -1
View File
@@ -51,7 +51,11 @@ class LoginMobilePage extends StatelessWidget {
SizedBox(height: 32.0.h()), SizedBox(height: 32.0.h()),
if (viewModel.isLoading) if (viewModel.isLoading)
const CircularProgressIndicator() BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else else
BaseButton( BaseButton(
isEnabled: viewModel.isLoginEnabled, isEnabled: viewModel.isLoginEnabled,
+7 -3
View File
@@ -38,7 +38,7 @@ class LoginTabletPage extends StatelessWidget {
label: AppStrings.usernameLabel, label: AppStrings.usernameLabel,
iconPath: AssetsManager.userIcon, iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(), fieldHeight: 60.0.h(),
borderRedus: 4.0.w(), borderRedus: 12,
prefixIconPadding: 4.0.w(), prefixIconPadding: 4.0.w(),
), ),
SizedBox(height: 16.0.h()), SizedBox(height: 16.0.h()),
@@ -53,12 +53,16 @@ class LoginTabletPage extends StatelessWidget {
obscureText: viewModel.obscurePassword, obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(), fieldHeight: 60.0.h(),
onToggleVisibility: viewModel.togglePasswordVisibility, onToggleVisibility: viewModel.togglePasswordVisibility,
borderRedus: 4.0.w(), borderRedus: 12,
), ),
SizedBox(height: 32.0.h()), SizedBox(height: 32.0.h()),
if (viewModel.isLoading) if (viewModel.isLoading)
const CircularProgressIndicator() BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else else
BaseButton( BaseButton(
isEnabled: viewModel.isLoginEnabled, isEnabled: viewModel.isLoginEnabled,
+22 -1
View File
@@ -15,6 +15,7 @@ class BaseButton extends StatelessWidget {
final double? borderRadius; final double? borderRadius;
final double? elevation; final double? elevation;
final double? width; final double? width;
final bool isLoading;
const BaseButton({ const BaseButton({
required this.isEnabled, required this.isEnabled,
@@ -27,12 +28,32 @@ class BaseButton extends StatelessWidget {
this.borderRadius, this.borderRadius,
this.elevation, this.elevation,
this.width, this.width,
this.isLoading = false,
super.key, super.key,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return isLoading
? Container(
width: double.infinity,
height: 55.0.h(),
decoration: BoxDecoration(
color: AppColors.mainBlue,
borderRadius: BorderRadius.circular(28.0.w()),
),
child: Center(
child: SizedBox(
width: 30.0.w(),
height: 30.0.w(),
child: CircularProgressIndicator(
strokeWidth: 4.0,
color: AppColors.white,
),
),
),
)
: SizedBox(
width: width ?? double.infinity, width: width ?? double.infinity,
height: 55.0.h(), height: 55.0.h(),
child: ElevatedButton( child: ElevatedButton(
+80
View File
@@ -17,6 +17,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.7.1" version: "7.7.1"
archive:
dependency: transitive
description:
name: archive
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
url: "https://pub.dev"
source: hosted
version: "4.0.7"
args: args:
dependency: transitive dependency: transitive
description: description:
@@ -145,6 +153,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.19.1" version: "1.19.1"
color:
dependency: transitive
description:
name: color
sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb
url: "https://pub.dev"
source: hosted
version: "3.0.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@@ -177,6 +193,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.1" version: "3.1.1"
dartx:
dependency: transitive
description:
name: dartx
sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -230,6 +254,22 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_gen_core:
dependency: transitive
description:
name: flutter_gen_core
sha256: eda54fdc5de08e7eeea663eb8442aafc8660b5a13fda4e0c9e572c64e50195fb
url: "https://pub.dev"
source: hosted
version: "5.11.0"
flutter_gen_runner:
dependency: "direct dev"
description:
name: flutter_gen_runner
sha256: "669bf8b7a9b4acbdcb7fcc5e12bf638aca19acedf43341714cbca3bf3a219521"
url: "https://pub.dev"
source: hosted
version: "5.11.0"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
@@ -312,6 +352,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.2" version: "2.3.2"
hashcodes:
dependency: transitive
description:
name: hashcodes
sha256: "80f9410a5b3c8e110c4b7604546034749259f5d6dcca63e0d3c17c9258f1a651"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
http: http:
dependency: transitive dependency: transitive
description: description:
@@ -336,6 +384,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.2" version: "4.1.2"
image:
dependency: transitive
description:
name: image
sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928"
url: "https://pub.dev"
source: hosted
version: "4.5.4"
image_size_getter:
dependency: transitive
description:
name: image_size_getter
sha256: "7c26937e0ae341ca558b7556591fd0cc456fcc454583b7cb665d2f03e93e590f"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
io: io:
dependency: transitive dependency: transitive
description: description:
@@ -536,6 +600,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.1" version: "1.5.1"
posix:
dependency: transitive
description:
name: posix
sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -709,6 +781,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.4" version: "0.7.4"
time:
dependency: transitive
description:
name: time
sha256: "370572cf5d1e58adcb3e354c47515da3f7469dac3a95b447117e728e7be6f461"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
timing: timing:
dependency: transitive dependency: transitive
description: description: