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

@ -2760,5 +2760,6 @@
"loginWithMatrixId": "Login with Matrix-ID", "loginWithMatrixId": "Login with Matrix-ID",
"discoverHomeservers": "Discover homeservers", "discoverHomeservers": "Discover homeservers",
"whatIsAHomeserver": "What is a homeserver?", "whatIsAHomeserver": "What is a homeserver?",
"homeserverDescription": "All your data is stored on the homeserver, just like an email provider. You can choose which homeserver you want to use, while you can still communicate with everyone. Learn more at at https://matrix.org." "homeserverDescription": "All your data is stored on the homeserver, just like an email provider. You can choose which homeserver you want to use, while you can still communicate with everyone. Learn more at at https://matrix.org.",
"doesNotSeemToBeAValidHomeserver": "Doesn't seem to be a compatible homeserver. Wrong URL?"
} }

View file

@ -34,6 +34,7 @@ class ChatMembersView extends StatelessWidget {
(room.summary.mInvitedMemberCount ?? 0); (room.summary.mInvitedMemberCount ?? 0);
final error = controller.error; final error = controller.error;
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -90,6 +91,16 @@ class ChatMembersView extends StatelessWidget {
controller: controller.filterController, controller: controller.filterController,
onChanged: controller.setFilter, onChanged: controller.setFilter,
decoration: InputDecoration( decoration: InputDecoration(
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
prefixIcon: const Icon(Icons.search_outlined), prefixIcon: const Icon(Icons.search_outlined),
hintText: L10n.of(context)!.search, hintText: L10n.of(context)!.search,
), ),

View file

@ -31,6 +31,8 @@ class ChatSearchView extends StatelessWidget {
); );
} }
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
@ -59,6 +61,16 @@ class ChatSearchView extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.search, hintText: L10n.of(context)!.search,
suffixIcon: const Icon(Icons.search_outlined), suffixIcon: const Icon(Icons.search_outlined),
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
), ),
), ),
), ),

View file

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

View file

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

View file

@ -29,6 +29,7 @@ class InvitationSelectionView extends StatelessWidget {
} }
final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name; final groupName = room.name.isEmpty ? L10n.of(context)!.group : room.name;
final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: const Center(child: BackButton()), leading: const Center(child: BackButton()),
@ -44,6 +45,16 @@ class InvitationSelectionView extends StatelessWidget {
child: TextField( child: TextField(
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
decoration: InputDecoration( decoration: InputDecoration(
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
hintText: L10n.of(context)!.inviteContactToGroup(groupName), hintText: L10n.of(context)!.inviteContactToGroup(groupName),
prefixIcon: controller.loading prefixIcon: controller.loading
? const Padding( ? const Padding(

View file

@ -61,12 +61,13 @@ class NewGroupView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), prefixIcon: const Icon(Icons.people_outlined),
hintText: L10n.of(context)!.groupName, labelText: L10n.of(context)!.groupName,
), ),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
SwitchListTile.adaptive( SwitchListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
secondary: const Icon(Icons.public_outlined), secondary: const Icon(Icons.public_outlined),
title: Text(L10n.of(context)!.groupIsPublic), title: Text(L10n.of(context)!.groupIsPublic),
value: controller.publicGroup, value: controller.publicGroup,
@ -76,6 +77,8 @@ class NewGroupView extends StatelessWidget {
duration: FluffyThemes.animationDuration, duration: FluffyThemes.animationDuration,
child: controller.publicGroup child: controller.publicGroup
? SwitchListTile.adaptive( ? SwitchListTile.adaptive(
contentPadding:
const EdgeInsets.symmetric(horizontal: 32),
secondary: const Icon(Icons.search_outlined), secondary: const Icon(Icons.search_outlined),
title: Text(L10n.of(context)!.groupCanBeFoundViaSearch), title: Text(L10n.of(context)!.groupCanBeFoundViaSearch),
value: controller.groupCanBeFound, value: controller.groupCanBeFound,
@ -86,6 +89,7 @@ class NewGroupView extends StatelessWidget {
: const SizedBox.shrink(), : const SizedBox.shrink(),
), ),
SwitchListTile.adaptive( SwitchListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
secondary: Icon( secondary: Icon(
Icons.lock_outlined, Icons.lock_outlined,
color: theme.colorScheme.onSurface, color: theme.colorScheme.onSurface,
@ -108,16 +112,7 @@ class NewGroupView extends StatelessWidget {
controller.loading ? null : controller.submitAction, controller.loading ? null : controller.submitAction,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Row( : Text(L10n.of(context)!.createGroupAndInviteUsers),
children: [
Expanded(
child: Text(
L10n.of(context)!.createGroupAndInviteUsers,
),
),
Icon(Icons.adaptive.arrow_forward_outlined),
],
),
), ),
), ),
), ),

View file

@ -54,6 +54,16 @@ class NewPrivateChatView extends StatelessWidget {
onChanged: controller.searchUsers, onChanged: controller.searchUsers,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.searchForUsers, hintText: L10n.of(context)!.searchForUsers,
filled: true,
fillColor: theme.colorScheme.secondaryContainer,
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(99),
),
hintStyle: TextStyle(
color: theme.colorScheme.onPrimaryContainer,
fontWeight: FontWeight.normal,
),
prefixIcon: searchResponse == null prefixIcon: searchResponse == null
? const Icon(Icons.search_outlined) ? const Icon(Icons.search_outlined)
: FutureBuilder( : FutureBuilder(

View file

@ -51,18 +51,20 @@ class NewSpaceView extends StatelessWidget {
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: const Icon(Icons.people_outlined), prefixIcon: const Icon(Icons.people_outlined),
hintText: L10n.of(context)!.spaceName, labelText: L10n.of(context)!.spaceName,
errorText: controller.nameError, errorText: controller.nameError,
), ),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
SwitchListTile.adaptive( SwitchListTile.adaptive(
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
title: Text(L10n.of(context)!.spaceIsPublic), title: Text(L10n.of(context)!.spaceIsPublic),
value: controller.publicGroup, value: controller.publicGroup,
onChanged: controller.setPublicGroup, onChanged: controller.setPublicGroup,
), ),
ListTile( ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
trailing: const Padding( trailing: const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0), padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(Icons.info_outlined), child: Icon(Icons.info_outlined),
@ -78,16 +80,7 @@ class NewSpaceView extends StatelessWidget {
controller.loading ? null : controller.submitAction, controller.loading ? null : controller.submitAction,
child: controller.loading child: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Row( : Text(L10n.of(context)!.createNewSpace),
children: [
Expanded(
child: Text(
L10n.of(context)!.createNewSpace,
),
),
Icon(Icons.adaptive.arrow_forward_outlined),
],
),
), ),
), ),
), ),

View file

@ -46,7 +46,7 @@ class SettingsIgnoreListView extends StatelessWidget {
labelText: L10n.of(context)!.blockUsername, labelText: L10n.of(context)!.blockUsername,
suffixIcon: IconButton( suffixIcon: IconButton(
tooltip: L10n.of(context)!.block, tooltip: L10n.of(context)!.block,
icon: const Icon(Icons.send_outlined), icon: const Icon(Icons.add),
onPressed: () => controller.ignoreUser(context), onPressed: () => controller.ignoreUser(context),
), ),
), ),

View file

@ -17,12 +17,6 @@ class SettingsPasswordView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(L10n.of(context)!.changePassword), title: Text(L10n.of(context)!.changePassword),
actions: [
TextButton(
child: Text(L10n.of(context)!.passwordRecoverySettings),
onPressed: () => context.go('/rooms/settings/security/3pid'),
),
],
), ),
body: ListTileTheme( body: ListTileTheme(
iconColor: theme.colorScheme.onSurface, iconColor: theme.colorScheme.onSurface,
@ -31,13 +25,6 @@ class SettingsPasswordView extends StatelessWidget {
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
children: [ children: [
Center(
child: Icon(
Icons.key_outlined,
color: theme.dividerColor,
size: 80,
),
),
const SizedBox(height: 16), const SizedBox(height: 16),
TextField( TextField(
controller: controller.oldPasswordController, controller: controller.oldPasswordController,
@ -46,18 +33,22 @@ class SettingsPasswordView extends StatelessWidget {
autofocus: true, autofocus: true,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.pleaseEnterYourCurrentPassword, prefixIcon: const Icon(Icons.lock_outlined),
hintText: '********',
labelText: L10n.of(context)!.pleaseEnterYourCurrentPassword,
errorText: controller.oldPasswordError, errorText: controller.oldPasswordError,
), ),
), ),
const Divider(height: 32), const Divider(height: 64),
TextField( TextField(
controller: controller.newPassword1Controller, controller: controller.newPassword1Controller,
obscureText: true, obscureText: true,
autocorrect: false, autocorrect: false,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.newPassword, prefixIcon: const Icon(Icons.lock_reset_outlined),
hintText: '********',
labelText: L10n.of(context)!.newPassword,
errorText: controller.newPassword1Error, errorText: controller.newPassword1Error,
), ),
), ),
@ -68,22 +59,28 @@ class SettingsPasswordView extends StatelessWidget {
autocorrect: false, autocorrect: false,
readOnly: controller.loading, readOnly: controller.loading,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.repeatPassword, prefixIcon: const Icon(Icons.repeat_outlined),
hintText: '********',
labelText: L10n.of(context)!.repeatPassword,
errorText: controller.newPassword2Error, errorText: controller.newPassword2Error,
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 32),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: ElevatedButton.icon( child: ElevatedButton(
onPressed: onPressed:
controller.loading ? null : controller.changePassword, controller.loading ? null : controller.changePassword,
icon: const Icon(Icons.send_outlined), child: controller.loading
label: controller.loading
? const LinearProgressIndicator() ? const LinearProgressIndicator()
: Text(L10n.of(context)!.changePassword), : Text(L10n.of(context)!.changePassword),
), ),
), ),
const SizedBox(height: 16),
TextButton(
child: Text(L10n.of(context)!.passwordRecoverySettings),
onPressed: () => context.go('/rooms/settings/security/3pid'),
),
], ],
), ),
), ),

View file

@ -87,9 +87,7 @@ class SettingsSecurityView extends StatelessWidget {
onTap: controller.setAppLockAction, onTap: controller.setAppLockAction,
), ),
}, },
Divider( Divider(color: theme.dividerColor),
color: theme.dividerColor,
),
ListTile( ListTile(
title: Text( title: Text(
L10n.of(context)!.account, L10n.of(context)!.account,
@ -118,13 +116,14 @@ class SettingsSecurityView extends StatelessWidget {
), ),
ListTile( ListTile(
iconColor: Colors.orange, iconColor: Colors.orange,
leading: const Icon(Icons.tap_and_play), leading: const Icon(Icons.delete_sweep_outlined),
title: Text( title: Text(
L10n.of(context)!.dehydrate, L10n.of(context)!.dehydrate,
style: const TextStyle(color: Colors.orange), style: const TextStyle(color: Colors.orange),
), ),
onTap: controller.dehydrateAction, onTap: controller.dehydrateAction,
), ),
Divider(color: theme.dividerColor),
ListTile( ListTile(
iconColor: Colors.red, iconColor: Colors.red,
leading: const Icon(Icons.delete_outlined), leading: const Icon(Icons.delete_outlined),

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:http/http.dart';
import 'package:matrix/encryption.dart'; import 'package:matrix/encryption.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
@ -69,9 +70,14 @@ extension LocalizedExceptionExtension on Object {
} }
if (this is IOException || if (this is IOException ||
this is SocketException || this is SocketException ||
this is SyncConnectionException) { this is SyncConnectionException ||
this is ClientException) {
return L10n.of(context)!.noConnectionToTheServer; return L10n.of(context)!.noConnectionToTheServer;
} }
if (this is FormatException &&
exceptionContext == ExceptionContext.checkHomeserver) {
return L10n.of(context)!.doesNotSeemToBeAValidHomeserver;
}
if (this is String) return toString(); if (this is String) return toString();
if (this is UiaException) return toString(); if (this is UiaException) return toString();
Logs().w('Something went wrong: ', this); Logs().w('Something went wrong: ', this);
@ -81,4 +87,5 @@ extension LocalizedExceptionExtension on Object {
enum ExceptionContext { enum ExceptionContext {
changePassword, changePassword,
checkHomeserver,
} }