Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Krille Fear
1992cfe68d design: Improve login design 2022-10-16 12:37:38 +02:00
6 changed files with 84 additions and 102 deletions

View file

@ -19,13 +19,11 @@ class ConnectPageView extends StatelessWidget {
final identityProviders = controller.identityProviders; final identityProviders = controller.identityProviders;
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading: leading: controller.loading ? null : const BackButton(),
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
centerTitle: true, centerTitle: true,
title: Text( title: Text(
Matrix.of(context).getLoginClient().homeserver?.host ?? '', Matrix.of(context).getLoginClient().homeserver?.host ?? '',
style: const TextStyle(color: Colors.white),
), ),
), ),
body: ListView( body: ListView(
@ -43,7 +41,7 @@ class ConnectPageView extends StatelessWidget {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: CircleAvatar( child: CircleAvatar(
radius: 64, radius: 64,
backgroundColor: Colors.white.withAlpha(200), backgroundColor: Colors.white,
child: avatar == null child: avatar == null
? const Icon( ? const Icon(
Icons.person_outlined, Icons.person_outlined,
@ -93,10 +91,7 @@ class ConnectPageView extends StatelessWidget {
hintText: L10n.of(context)!.chooseAUsername, hintText: L10n.of(context)!.chooseAUsername,
errorText: controller.signupError, errorText: controller.signupError,
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
), ),
), ),
@ -114,26 +109,25 @@ class ConnectPageView extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
const Expanded( Expanded(
child: Divider( child: Divider(
color: Colors.white, thickness: 1,
thickness: 1, color: Theme.of(context).textTheme.subtitle1?.color,
)), ),
),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text( child: Text(
L10n.of(context)!.or, L10n.of(context)!.or,
style: const TextStyle( style: const TextStyle(fontSize: 18),
color: Colors.white, ),
fontSize: 18, ),
), Expanded(
child: Divider(
thickness: 1,
color: Theme.of(context).textTheme.subtitle1?.color,
), ),
), ),
const Expanded(
child: Divider(
color: Colors.white,
thickness: 1,
)),
], ],
), ),
], ],
@ -141,10 +135,7 @@ class ConnectPageView extends StatelessWidget {
identityProviders == null identityProviders == null
? const SizedBox( ? const SizedBox(
height: 74, height: 74,
child: Center( child: Center(child: CircularProgressIndicator.adaptive()),
child: CircularProgressIndicator.adaptive(
backgroundColor: Colors.white,
)),
) )
: Center( : Center(
child: identityProviders.length == 1 child: identityProviders.length == 1

View file

@ -52,7 +52,6 @@ class SsoButton extends StatelessWidget {
style: const TextStyle( style: const TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white,
), ),
), ),
], ],

View file

@ -18,23 +18,22 @@ class HomeserverPickerView extends StatelessWidget {
final benchmarkResults = controller.benchmarkResults; final benchmarkResults = controller.benchmarkResults;
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
title: Text(AppConfig.applicationName),
backgroundColor: Colors.transparent,
actions: [ actions: [
IconButton( IconButton(
onPressed: controller.restoreBackup, onPressed: controller.restoreBackup,
tooltip: L10n.of(context)!.hydrate, tooltip: L10n.of(context)!.hydrate,
color: Colors.white,
icon: const Icon(Icons.restore_outlined), icon: const Icon(Icons.restore_outlined),
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.privacy, tooltip: L10n.of(context)!.privacy,
onPressed: () => launch(AppConfig.privacyUrl), onPressed: () => launch(AppConfig.privacyUrl),
color: Colors.white,
icon: const Icon(Icons.shield_outlined), icon: const Icon(Icons.shield_outlined),
), ),
IconButton( IconButton(
tooltip: L10n.of(context)!.about, tooltip: L10n.of(context)!.about,
onPressed: () => PlatformInfos.showDialog(context), onPressed: () => PlatformInfos.showDialog(context),
color: Colors.white,
icon: const Icon(Icons.info_outlined), icon: const Icon(Icons.info_outlined),
), ),
], ],
@ -84,10 +83,7 @@ class HomeserverPickerView extends StatelessWidget {
hintText: L10n.of(context)!.enterYourHomeserver, hintText: L10n.of(context)!.enterYourHomeserver,
suffixIcon: const Icon(Icons.search), suffixIcon: const Icon(Icons.search),
errorText: controller.error, errorText: controller.error,
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
readOnly: !AppConfig.allowOtherHomeservers, readOnly: !AppConfig.allowOtherHomeservers,
onSubmitted: (_) => controller.checkHomeserverAction(), onSubmitted: (_) => controller.checkHomeserverAction(),

View file

@ -15,8 +15,7 @@ class LoginView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading: leading: controller.loading ? null : const BackButton(),
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
centerTitle: true, centerTitle: true,
title: Text( title: Text(
@ -25,7 +24,6 @@ class LoginView extends StatelessWidget {
.homeserver .homeserver
.toString() .toString()
.replaceFirst('https://', '')), .replaceFirst('https://', '')),
style: const TextStyle(color: Colors.white),
), ),
), ),
body: Builder(builder: (context) { body: Builder(builder: (context) {
@ -49,10 +47,7 @@ class LoginView extends StatelessWidget {
errorText: controller.usernameError, errorText: controller.usernameError,
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
hintText: L10n.of(context)!.emailOrUsername, hintText: L10n.of(context)!.emailOrUsername,
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
), ),
), ),
@ -82,10 +77,7 @@ class LoginView extends StatelessWidget {
onPressed: controller.toggleShowPassword, onPressed: controller.toggleShowPassword,
), ),
hintText: L10n.of(context)!.password, hintText: L10n.of(context)!.password,
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
), ),
), ),
@ -105,26 +97,25 @@ class LoginView extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
const Expanded( Expanded(
child: Divider( child: Divider(
color: Colors.white, thickness: 1,
thickness: 1, color: Theme.of(context).textTheme.subtitle1?.color,
)), ),
),
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text( child: Text(
L10n.of(context)!.or, L10n.of(context)!.or,
style: const TextStyle( style: const TextStyle(fontSize: 18),
color: Colors.white, ),
fontSize: 18, ),
), Expanded(
child: Divider(
thickness: 1,
color: Theme.of(context).textTheme.subtitle1?.color,
), ),
), ),
const Expanded(
child: Divider(
color: Colors.white,
thickness: 1,
)),
], ],
), ),
Padding( Padding(

View file

@ -13,13 +13,9 @@ class SignupPageView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LoginScaffold( return LoginScaffold(
appBar: AppBar( appBar: AppBar(
leading: leading: controller.loading ? null : const BackButton(),
controller.loading ? null : const BackButton(color: Colors.white),
automaticallyImplyLeading: !controller.loading, automaticallyImplyLeading: !controller.loading,
title: Text( title: Text(L10n.of(context)!.signUp),
L10n.of(context)!.signUp,
style: const TextStyle(color: Colors.white),
),
), ),
body: Form( body: Form(
key: controller.formKey, key: controller.formKey,
@ -50,10 +46,7 @@ class SignupPageView extends StatelessWidget {
), ),
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
hintText: L10n.of(context)!.chooseAStrongPassword, hintText: L10n.of(context)!.chooseAStrongPassword,
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
), ),
), ),
@ -72,10 +65,7 @@ class SignupPageView extends StatelessWidget {
prefixIcon: const Icon(Icons.repeat_outlined), prefixIcon: const Icon(Icons.repeat_outlined),
hintText: L10n.of(context)!.repeatPassword, hintText: L10n.of(context)!.repeatPassword,
errorStyle: const TextStyle(color: Colors.orange), errorStyle: const TextStyle(color: Colors.orange),
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme
.background
.withOpacity(0.75),
), ),
), ),
), ),
@ -93,10 +83,8 @@ class SignupPageView extends StatelessWidget {
prefixIcon: const Icon(Icons.mail_outlined), prefixIcon: const Icon(Icons.mail_outlined),
hintText: L10n.of(context)!.enterAnEmailAddress, hintText: L10n.of(context)!.enterAnEmailAddress,
errorText: controller.error, errorText: controller.error,
fillColor: Theme.of(context) fillColor: Theme.of(context).colorScheme.background,
.colorScheme errorMaxLines: 4,
.background
.withOpacity(0.75),
errorStyle: TextStyle( errorStyle: TextStyle(
color: controller.emailController.text.isEmpty color: controller.emailController.text.isEmpty
? Colors.orangeAccent ? Colors.orangeAccent

View file

@ -1,6 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart';
class LoginScaffold extends StatelessWidget { class LoginScaffold extends StatelessWidget {
final Widget body; final Widget body;
final AppBar? appBar; final AppBar? appBar;
@ -13,32 +16,46 @@ class LoginScaffold extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( final isMobileMode = !FluffyThemes.isColumnMode(context);
appBar: AppBar( return Container(
automaticallyImplyLeading: appBar?.automaticallyImplyLeading ?? true, decoration: const BoxDecoration(
centerTitle: appBar?.centerTitle, image: DecorationImage(
title: appBar?.title, image: AssetImage('assets/login_wallpaper.png'),
leading: appBar?.leading, fit: BoxFit.cover,
actions: appBar?.actions,
iconTheme: const IconThemeData(color: Colors.white),
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: SystemUiOverlayStyle.light,
),
extendBodyBehindAppBar: true,
extendBody: true,
body: Container(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage('assets/login_wallpaper.png'),
),
), ),
alignment: Alignment.center, ),
child: ConstrainedBox( child: Center(
constraints: const BoxConstraints(maxWidth: 480), child: Material(
child: body, color: Theme.of(context).brightness == Brightness.light
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.5),
borderRadius: isMobileMode
? null
: BorderRadius.circular(AppConfig.borderRadius),
elevation: isMobileMode ? 0 : 10,
clipBehavior: Clip.hardEdge,
shadowColor: Colors.black,
child: ConstrainedBox(
constraints: isMobileMode
? const BoxConstraints()
: const BoxConstraints(maxWidth: 480, maxHeight: 640),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
automaticallyImplyLeading:
appBar?.automaticallyImplyLeading ?? true,
centerTitle: appBar?.centerTitle,
title: appBar?.title,
leading: appBar?.leading,
actions: appBar?.actions,
backgroundColor: Colors.transparent,
systemOverlayStyle: SystemUiOverlayStyle.light,
),
extendBodyBehindAppBar: true,
extendBody: true,
body: body,
),
),
), ),
), ),
); );