chore: Follow up login page

pull/1298/head
Krille 11 months ago
parent eae7db7d71
commit 3cb88f3d49
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652

@ -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,134 +53,125 @@ class HomeserverPickerView extends StatelessWidget {
), ),
), ),
), ),
Image.asset( if (MediaQuery.of(context).size.height > 512)
'assets/banner_transparent.png', ConstrainedBox(
), constraints: BoxConstraints(
Padding( maxHeight: MediaQuery.of(context).size.height / 4,
padding: const EdgeInsets.only( ),
top: 16.0, child: Image.asset(
right: 8.0, 'assets/banner_transparent.png',
left: 8.0, alignment: Alignment.center,
bottom: 16.0, repeat: ImageRepeat.repeat,
),
), ),
child: Column( Padding(
crossAxisAlignment: CrossAxisAlignment.stretch, padding: const EdgeInsets.all(32.0),
mainAxisSize: MainAxisSize.min, child: TextField(
children: [ onChanged: controller.tryCheckHomeserverActionWithCooldown,
Padding( onEditingComplete:
padding: const EdgeInsets.all(16.0), controller.tryCheckHomeserverActionWithoutCooldown,
child: TextField( onSubmitted: controller.tryCheckHomeserverActionWithoutCooldown,
onChanged: controller.tryCheckHomeserverActionWithCooldown, onTap: controller.tryCheckHomeserverActionWithCooldown,
onEditingComplete: controller: controller.homeserverController,
controller.tryCheckHomeserverActionWithoutCooldown, autocorrect: false,
onSubmitted: keyboardType: TextInputType.url,
controller.tryCheckHomeserverActionWithoutCooldown, decoration: InputDecoration(
onTap: controller.tryCheckHomeserverActionWithCooldown, prefixIcon: controller.isLoading
controller: controller.homeserverController, ? Container(
autocorrect: false, width: 16,
keyboardType: TextInputType.url, height: 16,
decoration: InputDecoration( alignment: Alignment.center,
prefixIcon: controller.isLoading child: const SizedBox(
? Container( width: 16,
width: 16, height: 16,
height: 16, child: CircularProgressIndicator.adaptive(
alignment: Alignment.center, strokeWidth: 2,
child: const SizedBox( ),
width: 16, ),
height: 16, )
child: CircularProgressIndicator.adaptive( : const Icon(Icons.search_outlined),
strokeWidth: 2, filled: false,
), border: OutlineInputBorder(
), borderRadius: BorderRadius.circular(AppConfig.borderRadius),
) ),
: const Icon(Icons.search_outlined), hintText: AppConfig.defaultHomeserver,
filled: false, labelText: L10n.of(context)!.homeserver,
border: OutlineInputBorder( errorText: controller.error,
borderRadius: suffixIcon: IconButton(
BorderRadius.circular(AppConfig.borderRadius), onPressed: () {
), showDialog(
hintText: AppConfig.defaultHomeserver, context: context,
labelText: L10n.of(context)!.homeserver, builder: (context) => AlertDialog.adaptive(
errorText: controller.error, title: Text(L10n.of(context)!.whatIsAHomeserver),
suffixIcon: IconButton( content: Linkify(
onPressed: () { text: L10n.of(context)!.homeserverDescription,
showDialog( ),
context: context, actions: [
builder: (context) => AlertDialog.adaptive( TextButton(
title: Text(L10n.of(context)!.whatIsAHomeserver), onPressed: () => launchUrl(
content: Linkify( Uri.https('servers.joinmatrix.org'),
text: L10n.of(context)!.homeserverDescription, ),
), child: Text(
actions: [ L10n.of(context)!.discoverHomeservers,
TextButton(
onPressed: () => launchUrl(
Uri.https('servers.joinmatrix.org'),
),
child: Text(
L10n.of(context)!.discoverHomeservers,
),
),
TextButton(
onPressed: Navigator.of(context).pop,
child: Text(L10n.of(context)!.close),
),
],
), ),
); ),
}, TextButton(
icon: const Icon(Icons.info_outlined), onPressed: Navigator.of(context).pop,
child: Text(L10n.of(context)!.close),
),
],
), ),
), );
},
icon: const Icon(Icons.info_outlined),
),
),
),
),
if (MediaQuery.of(context).size.height > 512) const Spacer(),
ListView(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: 32.0,
vertical: 32.0,
),
children: [
TextButton(
style: TextButton.styleFrom(
textStyle: theme.textTheme.labelMedium,
foregroundColor: theme.colorScheme.secondary,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.restoreBackup,
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),
), ),
if (controller.supportsPasswordLogin || controller.supportsSso) const SizedBox(height: 8.0),
Padding( if (controller.supportsPasswordLogin || controller.supportsSso)
padding: const EdgeInsets.symmetric( ElevatedButton(
horizontal: 16.0, style: ElevatedButton.styleFrom(
vertical: 8.0, backgroundColor: theme.colorScheme.primary,
), foregroundColor: theme.colorScheme.onPrimary,
child: 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)!.connect),
),
), ),
if (controller.supportsPasswordLogin && controller.supportsSso) onPressed: controller.isLoggingIn || controller.isLoading
Padding( ? null
padding: const EdgeInsets.symmetric(horizontal: 16.0), : controller.supportsSso
child: TextButton( ? controller.ssoLoginAction
style: TextButton.styleFrom(
foregroundColor: theme.colorScheme.secondary,
textStyle: theme.textTheme.labelMedium,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.login, : controller.login,
child: Text(L10n.of(context)!.loginWithMatrixId), child: Text(L10n.of(context)!.next),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: TextButton(
style: TextButton.styleFrom(
textStyle: theme.textTheme.labelMedium,
foregroundColor: theme.colorScheme.secondary,
),
onPressed: controller.isLoggingIn || controller.isLoading
? null
: controller.restoreBackup,
child: Text(L10n.of(context)!.hydrate),
),
), ),
], ],
),
), ),
], ],
), ),

@ -41,15 +41,17 @@ 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(
mainAxisAlignment: MainAxisAlignment.center, child: _PrivacyButtons(
mainAxisAlignment: MainAxisAlignment.center,
),
), ),
) )
: null, : null,

Loading…
Cancel
Save