mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 15:02:33 +01:00
Merge branch 'krille/redesign-login' into 'main'
design: Improve login design See merge request famedly/fluffychat!1013
This commit is contained in:
commit
ef0d54d11f
@ -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(
|
||||||
@ -38,15 +36,19 @@ class ConnectPageView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Material(
|
Material(
|
||||||
borderRadius: BorderRadius.circular(64),
|
borderRadius: BorderRadius.circular(64),
|
||||||
elevation: 10,
|
elevation: Theme.of(context)
|
||||||
|
.appBarTheme
|
||||||
|
.scrolledUnderElevation ??
|
||||||
|
4,
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
|
shadowColor: Theme.of(context).appBarTheme.shadowColor,
|
||||||
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,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
size: 64,
|
size: 64,
|
||||||
)
|
)
|
||||||
@ -93,10 +95,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),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -105,6 +104,10 @@ class ConnectPageView extends StatelessWidget {
|
|||||||
child: Hero(
|
child: Hero(
|
||||||
tag: 'loginButton',
|
tag: 'loginButton',
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
),
|
||||||
onPressed: controller.loading ? () {} : controller.signUp,
|
onPressed: controller.loading ? () {} : controller.signUp,
|
||||||
child: controller.loading
|
child: controller.loading
|
||||||
? const LinearProgressIndicator()
|
? const LinearProgressIndicator()
|
||||||
@ -112,45 +115,52 @@ class ConnectPageView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: 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(
|
||||||
const Expanded(
|
|
||||||
child: Divider(
|
child: Divider(
|
||||||
color: Colors.white,
|
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
)),
|
color: Theme.of(context).textTheme.subtitle1?.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
if (controller.supportsSso)
|
if (controller.supportsSso)
|
||||||
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
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primaryContainer,
|
||||||
|
foregroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onPrimaryContainer,
|
||||||
|
),
|
||||||
onPressed: () => controller
|
onPressed: () => controller
|
||||||
.ssoLoginAction(identityProviders.single.id!),
|
.ssoLoginAction(identityProviders.single.id!),
|
||||||
child: Text(identityProviders.single.name ??
|
child: Text(identityProviders.single.name ??
|
||||||
@ -175,6 +185,12 @@ class ConnectPageView extends StatelessWidget {
|
|||||||
child: Hero(
|
child: Hero(
|
||||||
tag: 'signinButton',
|
tag: 'signinButton',
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.primaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.onPrimaryContainer,
|
||||||
|
),
|
||||||
onPressed: controller.loading ? () {} : controller.login,
|
onPressed: controller.loading ? () {} : controller.login,
|
||||||
child: Text(L10n.of(context)!.login),
|
child: Text(L10n.of(context)!.login),
|
||||||
),
|
),
|
||||||
|
@ -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,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -180,12 +180,13 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> restoreBackup() async {
|
Future<void> restoreBackup() async {
|
||||||
|
final file =
|
||||||
|
await FilePickerCross.importFromStorage(fileExtension: '.fluffybackup');
|
||||||
|
if (file.fileName == null) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () async {
|
future: () async {
|
||||||
try {
|
try {
|
||||||
final file = await FilePickerCross.importFromStorage(
|
|
||||||
fileExtension: '.fluffybackup');
|
|
||||||
final client = Matrix.of(context).getLoginClient();
|
final client = Matrix.of(context).getLoginClient();
|
||||||
await client.importDump(file.toString());
|
await client.importDump(file.toString());
|
||||||
Matrix.of(context).initMatrix();
|
Matrix.of(context).initMatrix();
|
||||||
|
@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
|
||||||
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
||||||
import 'homeserver_picker.dart';
|
import 'homeserver_picker.dart';
|
||||||
|
|
||||||
@ -17,30 +16,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final benchmarkResults = controller.benchmarkResults;
|
final benchmarkResults = controller.benchmarkResults;
|
||||||
return LoginScaffold(
|
return LoginScaffold(
|
||||||
appBar: AppBar(
|
body: Column(
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: controller.restoreBackup,
|
|
||||||
tooltip: L10n.of(context)!.hydrate,
|
|
||||||
color: Colors.white,
|
|
||||||
icon: const Icon(Icons.restore_outlined),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
tooltip: L10n.of(context)!.privacy,
|
|
||||||
onPressed: () => launch(AppConfig.privacyUrl),
|
|
||||||
color: Colors.white,
|
|
||||||
icon: const Icon(Icons.shield_outlined),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
tooltip: L10n.of(context)!.about,
|
|
||||||
onPressed: () => PlatformInfos.showDialog(context),
|
|
||||||
color: Colors.white,
|
|
||||||
icon: const Icon(Icons.info_outlined),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: SafeArea(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
// display a prominent banner to import session for TOR browser
|
// display a prominent banner to import session for TOR browser
|
||||||
// users. This feature is just some UX sugar as TOR users are
|
// users. This feature is just some UX sugar as TOR users are
|
||||||
@ -70,7 +46,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
height: 200,
|
height: 190,
|
||||||
child: Image.asset('assets/info-logo.png'),
|
child: Image.asset('assets/info-logo.png'),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@ -84,10 +60,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).backgroundColor,
|
||||||
.colorScheme
|
|
||||||
.background
|
|
||||||
.withOpacity(0.75),
|
|
||||||
),
|
),
|
||||||
readOnly: !AppConfig.allowOtherHomeservers,
|
readOnly: !AppConfig.allowOtherHomeservers,
|
||||||
onSubmitted: (_) => controller.checkHomeserverAction(),
|
onSubmitted: (_) => controller.checkHomeserverAction(),
|
||||||
@ -100,7 +73,7 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
child: Material(
|
child: Material(
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(AppConfig.borderRadius),
|
BorderRadius.circular(AppConfig.borderRadius),
|
||||||
color: Colors.white.withAlpha(200),
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: benchmarkResults == null
|
child: benchmarkResults == null
|
||||||
? const Center(
|
? const Center(
|
||||||
@ -137,16 +110,50 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
AppConfig.applicationWelcomeMessage ??
|
||||||
|
L10n.of(context)!.welcomeText,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
SafeArea(
|
||||||
|
child: Container(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Hero(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
TextButton(
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
onPressed: controller.restoreBackup,
|
||||||
|
child: Text(L10n.of(context)!.hydrate),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => launch(AppConfig.privacyUrl),
|
||||||
|
child: Text(L10n.of(context)!.privacy),
|
||||||
|
),
|
||||||
|
Hero(
|
||||||
tag: 'loginButton',
|
tag: 'loginButton',
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.onPrimary,
|
||||||
|
),
|
||||||
onPressed: controller.isLoading
|
onPressed: controller.isLoading
|
||||||
? null
|
? null
|
||||||
: controller.checkHomeserverAction,
|
: controller.checkHomeserverAction,
|
||||||
@ -155,10 +162,12 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
: Text(L10n.of(context)!.connect),
|
: Text(L10n.of(context)!.connect),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -94,6 +86,10 @@ class LoginView extends StatelessWidget {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
),
|
||||||
onPressed: controller.loading
|
onPressed: controller.loading
|
||||||
? null
|
? null
|
||||||
: () => controller.login(context),
|
: () => controller.login(context),
|
||||||
@ -103,36 +99,41 @@ class LoginView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: 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(
|
||||||
const 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: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed:
|
onPressed:
|
||||||
controller.loading ? () {} : controller.passwordForgotten,
|
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),
|
child: Text(L10n.of(context)!.passwordForgotten),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -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
|
||||||
@ -110,6 +98,10 @@ class SignupPageView extends StatelessWidget {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
onPressed: controller.loading ? () {} : controller.signup,
|
onPressed: controller.loading ? () {} : controller.signup,
|
||||||
child: controller.loading
|
child: controller.loading
|
||||||
? const LinearProgressIndicator()
|
? const LinearProgressIndicator()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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;
|
||||||
@ -13,32 +15,47 @@ 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(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/login_wallpaper.png'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Material(
|
||||||
|
color: Theme.of(context).brightness == Brightness.light
|
||||||
|
? Theme.of(context).scaffoldBackgroundColor.withOpacity(0.9)
|
||||||
|
: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.75),
|
||||||
|
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 == null
|
||||||
|
? null
|
||||||
|
: AppBar(
|
||||||
|
automaticallyImplyLeading:
|
||||||
|
appBar?.automaticallyImplyLeading ?? true,
|
||||||
centerTitle: appBar?.centerTitle,
|
centerTitle: appBar?.centerTitle,
|
||||||
title: appBar?.title,
|
title: appBar?.title,
|
||||||
leading: appBar?.leading,
|
leading: appBar?.leading,
|
||||||
actions: appBar?.actions,
|
actions: appBar?.actions,
|
||||||
iconTheme: const IconThemeData(color: Colors.white),
|
|
||||||
elevation: 0,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
|
||||||
),
|
),
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
body: Container(
|
body: body,
|
||||||
decoration: const BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: AssetImage('assets/login_wallpaper.png'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: const BoxConstraints(maxWidth: 480),
|
|
||||||
child: body,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user