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
+83 -61
View File
@@ -20,68 +20,90 @@ class LoginDesktopPage extends StatelessWidget {
body: Center(
child: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
child: SizedBox(
width: 526,
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
LoginLogo(width: 190.0.w(), height: 88.0.h()),
SizedBox(height: 32.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: 526,
child: Consumer<AuthViewModel>(
builder: (context, viewModel, _) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
LoginLogo(width: 190.0.w(), height: 88.0.h()),
SizedBox(height: 32.0.h()),
const LoginTitle(),
SizedBox(height: 32.0.h()),
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: AppStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(),
borderRedus: 12,
prefixIconPadding: 7.0.w(),
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: AppStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
prefixIconPadding: 7.0.w(),
isPassword: true,
obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(),
onToggleVisibility:
viewModel.togglePasswordVisibility,
borderRedus: 12,
),
SizedBox(height: 32.0.h()),
LoginTextField(
controller: viewModel.usernameController,
focusNode: viewModel.usernameFocus,
label: AppStrings.usernameLabel,
iconPath: AssetsManager.userIcon,
fieldHeight: 60.0.h(),
borderRedus: 4.0.w(),
prefixIconPadding: 4.0.w(),
),
SizedBox(height: 16.0.h()),
LoginTextField(
controller: viewModel.passwordController,
focusNode: viewModel.passwordFocus,
label: AppStrings.passwordLabel,
iconPath: AssetsManager.passwordIcon,
prefixIconPadding: 4.0.w(),
isPassword: true,
obscureText: viewModel.obscurePassword,
fieldHeight: 60.0.h(),
onToggleVisibility: viewModel.togglePasswordVisibility,
borderRedus: 4.0.w(),
),
SizedBox(height: 32.0.h()),
if (viewModel.isLoading)
const CircularProgressIndicator()
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed:
viewModel.isLoginEnabled
? () async {
await viewModel.login();
if (viewModel.loggedInUser != null) {
HomeRouteData().go(context);
} else if (viewModel.errorMessage != null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(viewModel.errorMessage!),
),
);
}
}
: null,
),
],
);
},
),
if (viewModel.isLoading)
BaseButton(
isEnabled: false,
onPressed: null,
isLoading: true,
)
else
BaseButton(
isEnabled: viewModel.isLoginEnabled,
onPressed:
viewModel.isLoginEnabled
? () async {
await viewModel.login();
if (viewModel.loggedInUser != null) {
HomeRouteData().go(context);
} else if (viewModel.errorMessage !=
null) {
ScaffoldMessenger.of(
context,
).showSnackBar(
SnackBar(
content: Text(
viewModel.errorMessage!,
),
),
);
}
}
: null,
),
],
);
},
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
child: Image.asset(
AssetsManager.webLoginImage,
width: 796.0.w(),
height: 944.0.h(),
fit: BoxFit.fitHeight,
),
),
],
),
),
),