mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-19 04:15:09 +00:00
chore: Follow up login page
This commit is contained in:
parent
eae7db7d71
commit
3cb88f3d49
2 changed files with 121 additions and 127 deletions
|
@ -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,135 +53,126 @@ class HomeserverPickerView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Image.asset(
|
if (MediaQuery.of(context).size.height > 512)
|
||||||
'assets/banner_transparent.png',
|
ConstrainedBox(
|
||||||
),
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: MediaQuery.of(context).size.height / 4,
|
||||||
|
),
|
||||||
|
child: Image.asset(
|
||||||
|
'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,
|
child: TextField(
|
||||||
right: 8.0,
|
onChanged: controller.tryCheckHomeserverActionWithCooldown,
|
||||||
left: 8.0,
|
onEditingComplete:
|
||||||
bottom: 16.0,
|
controller.tryCheckHomeserverActionWithoutCooldown,
|
||||||
),
|
onSubmitted: controller.tryCheckHomeserverActionWithoutCooldown,
|
||||||
child: Column(
|
onTap: controller.tryCheckHomeserverActionWithCooldown,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
controller: controller.homeserverController,
|
||||||
mainAxisSize: MainAxisSize.min,
|
autocorrect: false,
|
||||||
children: [
|
keyboardType: TextInputType.url,
|
||||||
Padding(
|
decoration: InputDecoration(
|
||||||
padding: const EdgeInsets.all(16.0),
|
prefixIcon: controller.isLoading
|
||||||
child: TextField(
|
? Container(
|
||||||
onChanged: controller.tryCheckHomeserverActionWithCooldown,
|
width: 16,
|
||||||
onEditingComplete:
|
height: 16,
|
||||||
controller.tryCheckHomeserverActionWithoutCooldown,
|
alignment: Alignment.center,
|
||||||
onSubmitted:
|
child: const SizedBox(
|
||||||
controller.tryCheckHomeserverActionWithoutCooldown,
|
width: 16,
|
||||||
onTap: controller.tryCheckHomeserverActionWithCooldown,
|
height: 16,
|
||||||
controller: controller.homeserverController,
|
child: CircularProgressIndicator.adaptive(
|
||||||
autocorrect: false,
|
strokeWidth: 2,
|
||||||
keyboardType: TextInputType.url,
|
),
|
||||||
decoration: InputDecoration(
|
),
|
||||||
prefixIcon: controller.isLoading
|
)
|
||||||
? Container(
|
: const Icon(Icons.search_outlined),
|
||||||
width: 16,
|
filled: false,
|
||||||
height: 16,
|
border: OutlineInputBorder(
|
||||||
alignment: Alignment.center,
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
child: const SizedBox(
|
),
|
||||||
width: 16,
|
hintText: AppConfig.defaultHomeserver,
|
||||||
height: 16,
|
labelText: L10n.of(context)!.homeserver,
|
||||||
child: CircularProgressIndicator.adaptive(
|
errorText: controller.error,
|
||||||
strokeWidth: 2,
|
suffixIcon: IconButton(
|
||||||
),
|
onPressed: () {
|
||||||
),
|
showDialog(
|
||||||
)
|
context: context,
|
||||||
: const Icon(Icons.search_outlined),
|
builder: (context) => AlertDialog.adaptive(
|
||||||
filled: false,
|
title: Text(L10n.of(context)!.whatIsAHomeserver),
|
||||||
border: OutlineInputBorder(
|
content: Linkify(
|
||||||
borderRadius:
|
text: L10n.of(context)!.homeserverDescription,
|
||||||
BorderRadius.circular(AppConfig.borderRadius),
|
),
|
||||||
),
|
actions: [
|
||||||
hintText: AppConfig.defaultHomeserver,
|
TextButton(
|
||||||
labelText: L10n.of(context)!.homeserver,
|
onPressed: () => launchUrl(
|
||||||
errorText: controller.error,
|
Uri.https('servers.joinmatrix.org'),
|
||||||
suffixIcon: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog.adaptive(
|
|
||||||
title: Text(L10n.of(context)!.whatIsAHomeserver),
|
|
||||||
content: Linkify(
|
|
||||||
text: L10n.of(context)!.homeserverDescription,
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
child: Text(
|
||||||
},
|
L10n.of(context)!.discoverHomeservers,
|
||||||
icon: const Icon(Icons.info_outlined),
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
child: Text(L10n.of(context)!.close),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
|
icon: const Icon(Icons.info_outlined),
|
||||||
),
|
),
|
||||||
if (controller.supportsPasswordLogin || controller.supportsSso)
|
),
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16.0,
|
|
||||||
vertical: 8.0,
|
|
||||||
),
|
|
||||||
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)
|
|
||||||
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(
|
|
||||||
textStyle: theme.textTheme.labelMedium,
|
|
||||||
foregroundColor: theme.colorScheme.secondary,
|
|
||||||
),
|
|
||||||
onPressed: controller.isLoggingIn || controller.isLoading
|
|
||||||
? null
|
|
||||||
: controller.restoreBackup,
|
|
||||||
child: Text(L10n.of(context)!.hydrate),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -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…
Reference in a new issue