Server selection and login are on different pages. #33

Manually merged
Henry-Hiles merged 8 commits from istalri/nexus:better-login into better-login 2026-06-05 16:44:35 -04:00
2 changed files with 41 additions and 52 deletions
Showing only changes of commit 248b77e4c5 - Show all commits

CleanUp and last fixes

- Borders only get overwritten in error case
- Navigator.pop(context) -> Navigator.of(context).pop()
- Confirm homeserver und Sign in button disabled as long as error is active
istalri 2026-06-05 20:02:29 +02:00

View file

@ -50,7 +50,7 @@ class LoginPage extends HookConsumerWidget {
);
isLoggingIn.value = false;
} else {
Navigator.pop(context);
Navigator.of(context).pop();
}
passwordFocusNode.requestFocus();
isLoggingIn.value = false;
@ -60,7 +60,7 @@ class LoginPage extends HookConsumerWidget {
appBar: Appbar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
onPressed: () => Navigator.of(context).pop(),
istalri marked this conversation as resolved Outdated
- onPressed: () => Navigator.pop(context),
+ onPressed: Navigator.of(context).pop,
```diff - onPressed: () => Navigator.pop(context), + onPressed: Navigator.of(context).pop, ```
istalri marked this conversation as resolved Outdated
- onPressed: () => Navigator.of(context).pop(),
+ onPressed: Navigator.of(context).pop,
```diff - onPressed: () => Navigator.of(context).pop(), + onPressed: Navigator.of(context).pop, ```
),
Henry-Hiles marked this conversation as resolved Outdated

bad formatting here. make sure you format your code :)

bad formatting here. make sure you format your code :)

Yeah I totally forgot. Autoformatting is good? like ctrl + shift + i?

Yeah I totally forgot. Autoformatting is good? like ctrl + shift + i?

Yeah, that should work great. I have it set to format on save.

Yeah, that should work great. I have it set to format on save.
),
istalri marked this conversation as resolved

prefer Navigator.of(context).pop()

prefer `Navigator.of(context).pop()`
body: AlertDialog(
@ -81,22 +81,16 @@ class LoginPage extends HookConsumerWidget {
},
decoration: InputDecoration(
label: Text("Username"),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
focusedBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(color: theme.colorScheme.error),
)
: null,
enabledBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(color: theme.colorScheme.error),
)
: null,
),
controller: username,
),
@ -113,22 +107,16 @@ class LoginPage extends HookConsumerWidget {
selectAllOnFocus: true,
decoration: InputDecoration(
label: Text("Password"),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
focusedBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(color: theme.colorScheme.error),
)
: null,
enabledBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(color: theme.colorScheme.error),
)
: null,
),
controller: password,
obscureText: true,
@ -136,7 +124,10 @@ class LoginPage extends HookConsumerWidget {
],
),
actions: [
TextButton(onPressed: () => tryLogin(), child: Text("Sign In")),
TextButton(
onPressed: hasError.value ? null : () => tryLogin(),
child: Text("Sign In"),
),
],
),
);

View file

@ -113,28 +113,26 @@ class SelectServerPage extends HookConsumerWidget {
decoration: InputDecoration(
labelText: "Homeserver URL (e.g. matrix.org)",
hintText: "e.g. matrix.org",
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: hasError.value ? 4 : 2,
color: hasError.value
? theme.colorScheme.error
: theme.colorScheme.primary,
),
),
focusedBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(
color: theme.colorScheme.error,
),
)
: null,
enabledBorder: hasError.value
? OutlineInputBorder(
borderSide: BorderSide(
color: theme.colorScheme.error,
),
)
: null,
),
),
),
IconButton.filled(
tooltip: "Confirm homeserver choice",
onPressed: isLoading.value
onPressed: isLoading.value || hasError.value
? null
: () => setHomeserver(
Uri.tryParse(homeserverUrl.text),