chore: Follow up design textfields

This commit is contained in:
Krille 2024-08-27 07:46:48 +02:00
commit aa3de2816b
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
13 changed files with 105 additions and 52 deletions

View file

@ -86,7 +86,17 @@ class HomeserverPickerController extends State<HomeserverPicker> {
Future<void> checkHomeserverAction([_]) async {
homeserverController.text =
homeserverController.text.trim().toLowerCase().replaceAll(' ', '-');
if (homeserverController.text == _lastCheckedUrl) return;
if (homeserverController.text.isEmpty) {
setState(() {
error = loginFlows = null;
isLoading = false;
Matrix.of(context).getLoginClient().homeserver = null;
});
return;
}
if (_lastCheckedUrl == homeserverController.text) return;
_lastCheckedUrl = homeserverController.text;
setState(() {
error = loginFlows = null;
@ -102,7 +112,12 @@ class HomeserverPickerController extends State<HomeserverPicker> {
final (_, _, loginFlows) = await client.checkHomeserver(homeserver);
this.loginFlows = loginFlows;
} catch (e) {
setState(() => error = (e).toLocalizedString(context));
setState(
() => error = (e).toLocalizedString(
context,
ExceptionContext.checkHomeserver,
),
);
} finally {
if (mounted) {
setState(() => isLoading = false);

View file

@ -76,6 +76,8 @@ class HomeserverPickerView extends StatelessWidget {
controller.tryCheckHomeserverActionWithoutCooldown,
onTap: controller.tryCheckHomeserverActionWithCooldown,
controller: controller.homeserverController,
autocorrect: false,
keyboardType: TextInputType.url,
decoration: InputDecoration(
prefixIcon: controller.isLoading
? Container(