design: Improve login design

This commit is contained in:
Krille Fear 2022-10-16 12:37:38 +02:00 committed by Christian Pauly
commit 98d2ac021b
7 changed files with 272 additions and 237 deletions

View file

@ -15,8 +15,7 @@ class LoginView extends StatelessWidget {
Widget build(BuildContext context) {
return LoginScaffold(
appBar: AppBar(
leading:
controller.loading ? null : const BackButton(color: Colors.white),
leading: controller.loading ? null : const BackButton(),
automaticallyImplyLeading: !controller.loading,
centerTitle: true,
title: Text(
@ -25,7 +24,6 @@ class LoginView extends StatelessWidget {
.homeserver
.toString()
.replaceFirst('https://', '')),
style: const TextStyle(color: Colors.white),
),
),
body: Builder(builder: (context) {
@ -49,10 +47,7 @@ class LoginView extends StatelessWidget {
errorText: controller.usernameError,
errorStyle: const TextStyle(color: Colors.orange),
hintText: L10n.of(context)!.emailOrUsername,
fillColor: Theme.of(context)
.colorScheme
.background
.withOpacity(0.75),
fillColor: Theme.of(context).colorScheme.background,
),
),
),
@ -82,10 +77,7 @@ class LoginView extends StatelessWidget {
onPressed: controller.toggleShowPassword,
),
hintText: L10n.of(context)!.password,
fillColor: Theme.of(context)
.colorScheme
.background
.withOpacity(0.75),
fillColor: Theme.of(context).colorScheme.background,
),
),
),
@ -94,6 +86,10 @@ class LoginView extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(12.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
),
onPressed: controller.loading
? null
: () => controller.login(context),
@ -103,36 +99,41 @@ class LoginView extends StatelessWidget {
),
),
),
Row(
children: [
const Expanded(
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
children: [
Expanded(
child: Divider(
color: Colors.white,
thickness: 1,
)),
Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
L10n.of(context)!.or,
style: const TextStyle(
color: Colors.white,
fontSize: 18,
thickness: 1,
color: Theme.of(context).textTheme.subtitle1?.color,
),
),
),
const Expanded(
Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
L10n.of(context)!.or,
style: const TextStyle(fontSize: 18),
),
),
Expanded(
child: Divider(
color: Colors.white,
thickness: 1,
)),
],
thickness: 1,
color: Theme.of(context).textTheme.subtitle1?.color,
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(12.0),
child: ElevatedButton(
onPressed:
controller.loading ? () {} : controller.passwordForgotten,
style: ElevatedButton.styleFrom(foregroundColor: Colors.red),
style: ElevatedButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error,
backgroundColor: Theme.of(context).colorScheme.onError,
),
child: Text(L10n.of(context)!.passwordForgotten),
),
),