chore: Follow up login page

This commit is contained in:
Krille 2024-08-28 08:43:21 +02:00
parent eae7db7d71
commit 3cb88f3d49
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 121 additions and 127 deletions

View file

@ -27,7 +27,8 @@ class HomeserverPickerView extends StatelessWidget {
title: Text(L10n.of(context)!.addAccount), title: Text(L10n.of(context)!.addAccount),
) )
: null, : null,
body: ListView( body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
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
@ -52,28 +53,24 @@ class HomeserverPickerView extends StatelessWidget {
), ),
), ),
), ),
Image.asset( if (MediaQuery.of(context).size.height > 512)
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height / 4,
),
child: Image.asset(
'assets/banner_transparent.png', 'assets/banner_transparent.png',
alignment: Alignment.center,
repeat: ImageRepeat.repeat,
),
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.all(32.0),
top: 16.0,
right: 8.0,
left: 8.0,
bottom: 16.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: TextField( child: TextField(
onChanged: controller.tryCheckHomeserverActionWithCooldown, onChanged: controller.tryCheckHomeserverActionWithCooldown,
onEditingComplete: onEditingComplete:
controller.tryCheckHomeserverActionWithoutCooldown, controller.tryCheckHomeserverActionWithoutCooldown,
onSubmitted: onSubmitted: controller.tryCheckHomeserverActionWithoutCooldown,
controller.tryCheckHomeserverActionWithoutCooldown,
onTap: controller.tryCheckHomeserverActionWithCooldown, onTap: controller.tryCheckHomeserverActionWithCooldown,
controller: controller.homeserverController, controller: controller.homeserverController,
autocorrect: false, autocorrect: false,
@ -95,8 +92,7 @@ class HomeserverPickerView extends StatelessWidget {
: const Icon(Icons.search_outlined), : const Icon(Icons.search_outlined),
filled: false, filled: false,
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: borderRadius: BorderRadius.circular(AppConfig.borderRadius),
BorderRadius.circular(AppConfig.borderRadius),
), ),
hintText: AppConfig.defaultHomeserver, hintText: AppConfig.defaultHomeserver,
labelText: L10n.of(context)!.homeserver, labelText: L10n.of(context)!.homeserver,
@ -132,42 +128,15 @@ class HomeserverPickerView extends StatelessWidget {
), ),
), ),
), ),
if (controller.supportsPasswordLogin || controller.supportsSso) if (MediaQuery.of(context).size.height > 512) const Spacer(),
Padding( ListView(
shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 16.0, horizontal: 32.0,
vertical: 8.0, vertical: 32.0,
), ),
child: ElevatedButton( children: [
style: ElevatedButton.styleFrom( TextButton(
backgroundColor: theme.colorScheme.primary,
foregroundColor: theme.colorScheme.onPrimary,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.supportsSso
? controller.ssoLoginAction
: controller.login,
child: Text(L10n.of(context)!.connect),
),
),
if (controller.supportsPasswordLogin && controller.supportsSso)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: TextButton(
style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.secondary,
textStyle: theme.textTheme.labelMedium,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.login,
child: Text(L10n.of(context)!.loginWithMatrixId),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: TextButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
textStyle: theme.textTheme.labelMedium, textStyle: theme.textTheme.labelMedium,
foregroundColor: theme.colorScheme.secondary, foregroundColor: theme.colorScheme.secondary,
@ -177,10 +146,33 @@ class HomeserverPickerView extends StatelessWidget {
: controller.restoreBackup, : controller.restoreBackup,
child: Text(L10n.of(context)!.hydrate), child: Text(L10n.of(context)!.hydrate),
), ),
if (controller.supportsPasswordLogin && controller.supportsSso)
TextButton(
style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.secondary,
textStyle: theme.textTheme.labelMedium,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.login,
child: Text(L10n.of(context)!.loginWithMatrixId),
),
const SizedBox(height: 8.0),
if (controller.supportsPasswordLogin || controller.supportsSso)
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.primary,
foregroundColor: theme.colorScheme.onPrimary,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.supportsSso
? controller.ssoLoginAction
: controller.login,
child: Text(L10n.of(context)!.next),
), ),
], ],
), ),
),
], ],
), ),
); );

View file

@ -41,16 +41,18 @@ class LoginScaffold extends StatelessWidget {
actions: appBar?.actions, actions: appBar?.actions,
backgroundColor: isMobileMode ? null : Colors.transparent, backgroundColor: isMobileMode ? null : Colors.transparent,
), ),
body: body, body: SafeArea(child: body),
backgroundColor: backgroundColor:
isMobileMode ? null : theme.colorScheme.surface.withOpacity(0.8), isMobileMode ? null : theme.colorScheme.surface.withOpacity(0.8),
bottomNavigationBar: isMobileMode bottomNavigationBar: isMobileMode
? Material( ? Material(
elevation: 4, elevation: 4,
shadowColor: theme.colorScheme.onSurface, shadowColor: theme.colorScheme.onSurface,
child: const _PrivacyButtons( child: const SafeArea(
child: _PrivacyButtons(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
), ),
),
) )
: null, : null,
); );