refactor: Update to Dart 3.10 with . shorthands
This commit is contained in:
parent
75a37f3f7c
commit
1ea649f01e
167 changed files with 3351 additions and 3912 deletions
|
|
@ -29,9 +29,9 @@ class SettingsController extends State<Settings> {
|
|||
bool profileUpdated = false;
|
||||
|
||||
void updateProfile() => setState(() {
|
||||
profileUpdated = true;
|
||||
profileFuture = null;
|
||||
});
|
||||
profileUpdated = true;
|
||||
profileFuture = null;
|
||||
});
|
||||
|
||||
void setDisplaynameAction() async {
|
||||
final profile = await profileFuture;
|
||||
|
|
@ -132,15 +132,9 @@ class SettingsController extends State<Settings> {
|
|||
imageQuality: 50,
|
||||
);
|
||||
if (result == null) return;
|
||||
file = MatrixFile(
|
||||
bytes: await result.readAsBytes(),
|
||||
name: result.path,
|
||||
);
|
||||
file = MatrixFile(bytes: await result.readAsBytes(), name: result.path);
|
||||
} else {
|
||||
final result = await selectFiles(
|
||||
context,
|
||||
type: FileSelectorType.images,
|
||||
);
|
||||
final result = await selectFiles(context, type: FileSelectorType.images);
|
||||
final pickedFile = result.firstOrNull;
|
||||
if (pickedFile == null) return;
|
||||
file = MatrixFile(
|
||||
|
|
@ -176,8 +170,8 @@ class SettingsController extends State<Settings> {
|
|||
await client.encryption?.crossSigning.isCached() ?? false;
|
||||
final needsBootstrap =
|
||||
await client.encryption?.keyManager.isCached() == false ||
|
||||
client.encryption?.crossSigning.enabled == false ||
|
||||
crossSigning == false;
|
||||
client.encryption?.crossSigning.enabled == false ||
|
||||
crossSigning == false;
|
||||
final isUnknownSession = client.isUnknownSession;
|
||||
setState(() {
|
||||
showChatBackupBanner = needsBootstrap || isUnknownSession;
|
||||
|
|
@ -204,9 +198,7 @@ class SettingsController extends State<Settings> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final client = Matrix.of(context).client;
|
||||
profileFuture ??= client.getProfileFromUserId(
|
||||
client.userID!,
|
||||
);
|
||||
profileFuture ??= client.getProfileFromUserId(client.userID!);
|
||||
return SettingsView(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ class SettingsView extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final showChatBackupBanner = controller.showChatBackupBanner;
|
||||
final activeRoute =
|
||||
GoRouter.of(context).routeInformationProvider.value.uri.path;
|
||||
final activeRoute = GoRouter.of(
|
||||
context,
|
||||
).routeInformationProvider.value.uri.path;
|
||||
final accountManageUrl = Matrix.of(context)
|
||||
.client
|
||||
.wellKnown
|
||||
|
|
@ -41,10 +42,7 @@ class SettingsView extends StatelessWidget {
|
|||
onGoToChats: () => context.go('/rooms'),
|
||||
onGoToSpaceId: (spaceId) => context.go('/rooms?spaceId=$spaceId'),
|
||||
),
|
||||
Container(
|
||||
color: Theme.of(context).dividerColor,
|
||||
width: 1,
|
||||
),
|
||||
Container(color: Theme.of(context).dividerColor, width: 1),
|
||||
],
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
|
|
@ -53,9 +51,7 @@ class SettingsView extends StatelessWidget {
|
|||
: AppBar(
|
||||
title: Text(L10n.of(context).settings),
|
||||
leading: Center(
|
||||
child: BackButton(
|
||||
onPressed: () => context.go('/rooms'),
|
||||
),
|
||||
child: BackButton(onPressed: () => context.go('/rooms')),
|
||||
),
|
||||
),
|
||||
body: ListTileTheme(
|
||||
|
|
@ -68,7 +64,8 @@ class SettingsView extends StatelessWidget {
|
|||
builder: (context, snapshot) {
|
||||
final profile = snapshot.data;
|
||||
final avatar = profile?.avatarUrl;
|
||||
final mxid = Matrix.of(context).client.userID ??
|
||||
final mxid =
|
||||
Matrix.of(context).client.userID ??
|
||||
L10n.of(context).user;
|
||||
final displayname =
|
||||
profile?.displayName ?? mxid.localpart ?? mxid;
|
||||
|
|
@ -84,10 +81,10 @@ class SettingsView extends StatelessWidget {
|
|||
size: Avatar.defaultSize * 2.5,
|
||||
onTap: avatar != null
|
||||
? () => showDialog(
|
||||
context: context,
|
||||
builder: (_) =>
|
||||
MxcImageViewer(avatar),
|
||||
)
|
||||
context: context,
|
||||
builder: (_) =>
|
||||
MxcImageViewer(avatar),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
if (profile != null)
|
||||
|
|
@ -108,8 +105,8 @@ class SettingsView extends StatelessWidget {
|
|||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: .center,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: controller.setDisplaynameAction,
|
||||
|
|
@ -126,9 +123,7 @@ class SettingsView extends StatelessWidget {
|
|||
displayname,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
),
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
|
|
@ -182,9 +177,7 @@ class SettingsView extends StatelessWidget {
|
|||
title: Text(L10n.of(context).chatBackup),
|
||||
onChanged: controller.firstRunBootstrapAction,
|
||||
),
|
||||
Divider(
|
||||
color: theme.dividerColor,
|
||||
),
|
||||
Divider(color: theme.dividerColor),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.format_paint_outlined),
|
||||
title: Text(L10n.of(context).changeTheme),
|
||||
|
|
@ -198,8 +191,8 @@ class SettingsView extends StatelessWidget {
|
|||
title: Text(L10n.of(context).notifications),
|
||||
tileColor:
|
||||
activeRoute.startsWith('/rooms/settings/notifications')
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
onTap: () => context.go('/rooms/settings/notifications'),
|
||||
),
|
||||
ListTile(
|
||||
|
|
@ -224,8 +217,8 @@ class SettingsView extends StatelessWidget {
|
|||
onTap: () => context.go('/rooms/settings/security'),
|
||||
tileColor:
|
||||
activeRoute.startsWith('/rooms/settings/security')
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
),
|
||||
Divider(color: theme.dividerColor),
|
||||
ListTile(
|
||||
|
|
@ -239,8 +232,8 @@ class SettingsView extends StatelessWidget {
|
|||
onTap: () => context.go('/rooms/settings/homeserver'),
|
||||
tileColor:
|
||||
activeRoute.startsWith('/rooms/settings/homeserver')
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
? theme.colorScheme.surfaceContainerHigh
|
||||
: null,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.privacy_tip_outlined),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue