refactor: Migrate to Flutter 3.7.0

This commit is contained in:
Christian Pauly 2023-01-26 09:47:30 +01:00
parent 426ca2480f
commit 8503bbd33c
54 changed files with 876 additions and 2124 deletions

View File

@ -1,5 +1,5 @@
variables:
FLUTTER_VERSION: 3.3.9
FLUTTER_VERSION: 3.7.0
image:
name: cirrusci/flutter:${FLUTTER_VERSION}

View File

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()

File diff suppressed because it is too large Load Diff

View File

@ -2009,7 +2009,7 @@
"type": "text",
"placeholder": {}
},
"cantOpenUri": "Impossibile aprire l'URI",
"cantOpenUri": "Can't open the URI {uri}",
"@cantOpenUri": {
"type": "text",
"placeholders": {

View File

@ -1,292 +0,0 @@
{
"@@last_modified": "2021-08-14 12:41:09.895217",
"about": "පිළිබඳව",
"@about": {
"type": "text",
"placeholders": {}
},
"accept": "පිළිගන්න",
"@accept": {
"type": "text",
"placeholders": {}
},
"account": "ගිණුම",
"@account": {
"type": "text",
"placeholders": {}
},
"addEmail": "වි-තැපෑල එකතු කරන්න",
"@addEmail": {
"type": "text",
"placeholders": {}
},
"admin": "පරිපාලක",
"@admin": {
"type": "text",
"placeholders": {}
},
"allChats": "සියලුම සංවාද",
"@allChats": {
"type": "text",
"placeholders": {}
},
"anyoneCanJoin": "ඕනෑම කෙනෙකුට එක්විය හැකිය",
"@anyoneCanJoin": {
"type": "text",
"placeholders": {}
},
"archive": "සංරක්ෂිතය",
"@archive": {
"type": "text",
"placeholders": {}
},
"archivedRoom": "සංරක්ෂිත කාමරය",
"@archivedRoom": {
"type": "text",
"placeholders": {}
},
"areGuestsAllowedToJoin": "ආගන්තුක පරිශීලකයින්ට එක්වීමට අවසර තිබේද",
"@areGuestsAllowedToJoin": {
"type": "text",
"placeholders": {}
},
"areYouSure": "ඔබට විශ්වාසද?",
"@areYouSure": {
"type": "text",
"placeholders": {}
},
"areYouSureYouWantToLogout": "ඔබට නික්මීමට අවශ්‍ය බව විශ්වාසද?",
"@areYouSureYouWantToLogout": {
"type": "text",
"placeholders": {}
},
"blockDevice": "උපාංගය අවහිර කරන්න",
"@blockDevice": {
"type": "text",
"placeholders": {}
},
"cancel": "අවලංගු කරන්න",
"@cancel": {
"type": "text",
"placeholders": {}
},
"changeDeviceName": "උපාංගයේ නම වෙනස් කරන්න",
"@changeDeviceName": {
"type": "text",
"placeholders": {}
},
"changePassword": "මුරපදය වෙනස් කරන්න",
"@changePassword": {
"type": "text",
"placeholders": {}
},
"chat": "සංවාදය",
"@chat": {
"type": "text",
"placeholders": {}
},
"chatBackup": "සංවාද උපස්ථය",
"@chatBackup": {
"type": "text",
"placeholders": {}
},
"chatDetails": "සංවාදයේ විස්තර",
"@chatDetails": {
"type": "text",
"placeholders": {}
},
"chats": "සංවාද",
"@chats": {
"type": "text",
"placeholders": {}
},
"chooseAStrongPassword": "ශක්තිමත් මුරපදයක් තෝරන්න",
"@chooseAStrongPassword": {
"type": "text",
"placeholders": {}
},
"chooseAUsername": "පරිශීලක නාමයක් තෝරන්න",
"@chooseAUsername": {
"type": "text",
"placeholders": {}
},
"clearArchive": "සංරක්ෂිතය හිස් කරන්න",
"@clearArchive": {},
"close": "වසන්න",
"@close": {
"type": "text",
"placeholders": {}
},
"commandHint_join": "දී ඇති කාමරයට එක්වන්න",
"@commandHint_join": {
"type": "text",
"description": "Usage hint for the command /join"
},
"commandHint_leave": "මෙම කාමරය හැරයන්න",
"@commandHint_leave": {
"type": "text",
"description": "Usage hint for the command /leave"
},
"commandInvalid": "විධානය වලංගු නොවේ",
"@commandInvalid": {
"type": "text"
},
"commandMissing": "{{command} විධානයක් නොවේ.",
"@commandMissing": {
"type": "text",
"placeholders": {
"command": {}
},
"description": "State that {command} is not a valid /command."
},
"compareEmojiMatch": "සසඳා බලා පහත දැක්වෙන ඉමොජි අනෙක් උපාංගයට නිසැකවම ගැලපෙන බවට වග බලා ගන්න:",
"@compareEmojiMatch": {
"type": "text",
"placeholders": {}
},
"compareNumbersMatch": "සංසන්දනය කර පහත දැක්වෙන අංක අනෙක් උපාංගට නිසැකව ගැලපෙන බවට වග බලා ගන්න:",
"@compareNumbersMatch": {
"type": "text",
"placeholders": {}
},
"confirm": "තහවුරු කරන්න",
"@confirm": {
"type": "text",
"placeholders": {}
},
"connect": "සබඳින්න",
"@connect": {
"type": "text",
"placeholders": {}
},
"contactHasBeenInvitedToTheGroup": "සමූහය වෙත සබඳතාවයකට ආරාධනා කර ඇත",
"@contactHasBeenInvitedToTheGroup": {
"type": "text",
"placeholders": {}
},
"copy": "පිටපත්",
"@copy": {
"type": "text",
"placeholders": {}
},
"create": "සාදන්න",
"@create": {
"type": "text",
"placeholders": {}
},
"createNewGroup": "නව සමූහයක් සාදන්න",
"@createNewGroup": {
"type": "text",
"placeholders": {}
},
"encryption": "සංකේතාංකනය",
"@encryption": {
"type": "text",
"placeholders": {}
},
"everythingReady": "සියල්ල සූදානම්!",
"@everythingReady": {
"type": "text",
"placeholders": {}
},
"fontSize": "මුද්‍රණඅකුරේ ප්‍රමාණය",
"@fontSize": {
"type": "text",
"placeholders": {}
},
"goToTheNewRoom": "නව කාමරයට යන්න",
"@goToTheNewRoom": {
"type": "text",
"placeholders": {}
},
"joinRoom": "කාමරයට එක්වන්න",
"@joinRoom": {
"type": "text",
"placeholders": {}
},
"keysCached": "යතුරු නිහිතගත යි",
"@keysCached": {
"type": "text",
"placeholders": {}
},
"next": "ඊලඟ",
"@next": {
"type": "text",
"placeholders": {}
},
"people": "මිනිසුන්",
"@people": {
"type": "text",
"placeholders": {}
},
"removeDevice": "උපාංගය ඉවත්කරන්න",
"@removeDevice": {
"type": "text",
"placeholders": {}
},
"roomVersion": "කාමරයේ අනුවාදය",
"@roomVersion": {
"type": "text",
"placeholders": {}
},
"saveFile": "ගොනුව සුරකින්න",
"@saveFile": {
"type": "text",
"placeholders": {}
},
"send": "යවන්න",
"@send": {
"type": "text",
"placeholders": {}
},
"showPassword": "මුරපදය පෙන්වන්න",
"@showPassword": {
"type": "text",
"placeholders": {}
},
"sunday": "ඉරිදා",
"@sunday": {
"type": "text",
"placeholders": {}
},
"username": "පරිශීලක නාමය",
"@username": {
"type": "text",
"placeholders": {}
},
"videoCall": "දෘශ්‍ය ඇමතුම",
"@videoCall": {
"type": "text",
"placeholders": {}
},
"wallpaper": "බිතුපත",
"@wallpaper": {
"type": "text",
"placeholders": {}
},
"warning": "අවවාදයයි!",
"@warning": {
"type": "text",
"placeholders": {}
},
"wednesday": "බදාදා",
"@wednesday": {
"type": "text",
"placeholders": {}
},
"writeAMessage": "පණිවිඩයක් ලියන්න…",
"@writeAMessage": {
"type": "text",
"placeholders": {}
},
"yes": "ඔව්",
"@yes": {
"type": "text",
"placeholders": {}
},
"you": "ඔබ",
"@you": {
"type": "text",
"placeholders": {}
}
}

View File

@ -812,7 +812,7 @@
"type": "text",
"placeholders": {}
},
"play": "Prehrať (fileName}",
"play": "Prehrať {fileName}",
"@play": {
"type": "text",
"placeholders": {

View File

@ -23,19 +23,19 @@ abstract class FluffyThemes {
);
static var fallbackTextTheme = const TextTheme(
bodyText1: fallbackTextStyle,
bodyText2: fallbackTextStyle,
button: fallbackTextStyle,
caption: fallbackTextStyle,
overline: fallbackTextStyle,
headline1: fallbackTextStyle,
headline2: fallbackTextStyle,
headline3: fallbackTextStyle,
headline4: fallbackTextStyle,
headline5: fallbackTextStyle,
headline6: fallbackTextStyle,
subtitle1: fallbackTextStyle,
subtitle2: fallbackTextStyle,
bodyLarge: fallbackTextStyle,
bodyMedium: fallbackTextStyle,
labelLarge: fallbackTextStyle,
bodySmall: fallbackTextStyle,
labelSmall: fallbackTextStyle,
displayLarge: fallbackTextStyle,
displayMedium: fallbackTextStyle,
displaySmall: fallbackTextStyle,
headlineMedium: fallbackTextStyle,
headlineSmall: fallbackTextStyle,
titleLarge: fallbackTextStyle,
titleMedium: fallbackTextStyle,
titleSmall: fallbackTextStyle,
);
static const Duration animationDuration = Duration(milliseconds: 250);

View File

@ -269,7 +269,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
labelStyle: TextStyle(
fontFamily: Theme.of(context)
.textTheme
.bodyText1
.bodyLarge
?.fontFamily),
labelText: L10n.of(context)!.recoveryKey,
errorText: _recoveryKeyInputError,

View File

@ -1072,11 +1072,13 @@ class ChatController extends State<Chat> {
Matrix.of(context).voipPlugin!.voip.requestTurnServerCredentials());
if (success.result != null) {
final voipPlugin = Matrix.of(context).voipPlugin;
await voipPlugin!.voip.inviteToCall(room!.id, callType).catchError((e) {
try {
await voipPlugin!.voip.inviteToCall(room!.id, callType);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text((e as Object).toLocalizedString(context))),
SnackBar(content: Text(e.toLocalizedString(context))),
);
});
}
} else {
await showOkAlertDialog(
context: context,

View File

@ -69,7 +69,7 @@ class _CuteContentState extends State<CuteContent> {
},
),
);
Overlay.of(context)?.insert(overlay);
Overlay.of(context).insert(overlay);
}
generateLabel(User? user) {

View File

@ -52,7 +52,7 @@ class HtmlMessage extends StatelessWidget {
defaultTextStyle: defaultTextStyle,
emoteSize: emoteSize,
linkStyle: linkStyle ??
themeData.textTheme.bodyText2!.copyWith(
themeData.textTheme.bodyMedium!.copyWith(
color: themeData.colorScheme.secondary,
decoration: TextDecoration.underline,
),

View File

@ -303,8 +303,11 @@ class Message extends StatelessWidget {
child: Center(
child: Material(
color: displayTime
? Theme.of(context).backgroundColor
: Theme.of(context).backgroundColor.withOpacity(0.33),
? Theme.of(context).colorScheme.background
: Theme.of(context)
.colorScheme
.background
.withOpacity(0.33),
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
clipBehavior: Clip.antiAlias,
child: Padding(

View File

@ -37,7 +37,7 @@ class VerificationRequestContent extends StatelessWidget {
color: Theme.of(context).dividerColor,
),
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
),
child: Row(
mainAxisSize: MainAxisSize.min,

View File

@ -232,7 +232,7 @@ class InputBar extends StatelessWidget {
hint,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.caption,
style: Theme.of(context).textTheme.bodySmall,
),
],
),

View File

@ -160,7 +160,7 @@ class RecordingDialogState extends State<RecordingDialog> {
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyText2
.bodyMedium
?.color
?.withAlpha(150),
),
@ -183,7 +183,7 @@ class RecordingDialogState extends State<RecordingDialog> {
L10n.of(context)!.cancel.toUpperCase(),
style: TextStyle(
color:
Theme.of(context).textTheme.bodyText2?.color?.withAlpha(150),
Theme.of(context).textTheme.bodyMedium?.color?.withAlpha(150),
),
),
),

View File

@ -80,7 +80,7 @@ class _EditContent extends StatelessWidget {
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2!.color,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
);
}),

View File

@ -51,7 +51,7 @@ class SeenByRow extends StatelessWidget {
width: 16,
height: 16,
child: Material(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(32),
child: Center(
child: Text(

View File

@ -49,6 +49,7 @@ class SendFileDialogState extends State<SendFileDialog> {
scaffoldMessenger.showSnackBar(
SnackBar(content: Text(e.toLocalizedString())),
);
return null;
});
}
Navigator.of(context, rootNavigator: false).pop();

View File

@ -42,7 +42,7 @@ class ChatDetailsView extends StatelessWidget {
(room.summary.mJoinedMemberCount ?? 0);
final canRequestMoreMembers =
controller.members!.length < actualMembersCount;
final iconColor = Theme.of(context).textTheme.bodyText1!.color;
final iconColor = Theme.of(context).textTheme.bodyLarge!.color;
return StreamBuilder(
stream: room.onUpdate.stream,
builder: (context, snapshot) {
@ -127,7 +127,7 @@ class ChatDetailsView extends StatelessWidget {
fontSize: 14,
color: Theme.of(context)
.textTheme
.bodyText2!
.bodyMedium!
.color,
),
onLinkTap: (url) =>

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
@ -30,7 +30,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
title: Text(L10n.of(context)!.endToEndEncryption),
actions: [
TextButton(
onPressed: () => launch(AppConfig.encryptionTutorial),
onPressed: () =>
launchUrlString(AppConfig.encryptionTutorial),
child: Text(L10n.of(context)!.help),
),
],

View File

@ -228,9 +228,9 @@ class ChatListViewBody extends StatelessWidget {
}
const dummyChatCount = 5;
final titleColor =
Theme.of(context).textTheme.bodyText1!.color!.withAlpha(100);
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
final subtitleColor =
Theme.of(context).textTheme.bodyText1!.color!.withAlpha(50);
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
return ListView.builder(
key: const Key('dummychats'),
itemCount: dummyChatCount,
@ -241,7 +241,7 @@ class ChatListViewBody extends StatelessWidget {
backgroundColor: titleColor,
child: CircularProgressIndicator(
strokeWidth: 1,
color: Theme.of(context).textTheme.bodyText1!.color,
color: Theme.of(context).textTheme.bodyLarge!.color,
),
),
title: Row(

View File

@ -189,7 +189,7 @@ class ChatListItem extends StatelessWidget {
fontSize: 13,
color: unread
? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2!.color,
: Theme.of(context).textTheme.bodyMedium!.color,
),
),
),

View File

@ -102,7 +102,7 @@ class ClientChooserButton extends StatelessWidget {
Text(
bundle!,
style: TextStyle(
color: Theme.of(context).textTheme.subtitle1!.color,
color: Theme.of(context).textTheme.titleMedium!.color,
fontSize: 14,
),
),

View File

@ -158,7 +158,7 @@ class _SpaceViewState extends State<SpaceView> {
MatrixLocals(L10n.of(context)!),
);
return Material(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
child: ListTile(
leading: Avatar(
mxContent: rootSpace.avatar,

View File

@ -94,7 +94,7 @@ class StoriesHeader extends StatelessWidget {
leading: CircleAvatar(
radius: Avatar.defaultSize / 2,
backgroundColor: Theme.of(context).colorScheme.surface,
foregroundColor: Theme.of(context).textTheme.bodyText1?.color,
foregroundColor: Theme.of(context).textTheme.bodyLarge?.color,
child: const Icon(Icons.camera_alt_outlined),
),
title: Text(L10n.of(context)!.addToStory),
@ -226,7 +226,7 @@ class _StoryButton extends StatelessWidget {
backgroundColor:
Theme.of(context).colorScheme.surface,
foregroundColor:
Theme.of(context).textTheme.bodyText1?.color,
Theme.of(context).textTheme.bodyLarge?.color,
child: Hero(
tag: heroTag,
child: Avatar(

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:matrix_homeserver_recommendations/matrix_homeserver_recommendations.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class HomeserverBottomSheet extends StatelessWidget {
final HomeserverBenchmarkResult homeserver;
@ -38,25 +38,26 @@ class HomeserverBottomSheet extends StatelessWidget {
title: Text(homeserverSoftware),
),
ListTile(
onTap: () => launch(homeserver.homeserver.baseUrl.toString()),
onTap: () =>
launchUrlString(homeserver.homeserver.baseUrl.toString()),
leading: const Icon(Icons.link_outlined),
title: Text(homeserver.homeserver.baseUrl.toString()),
),
if (registration != null)
ListTile(
onTap: () => launch(registration.toString()),
onTap: () => launchUrlString(registration.toString()),
leading: const Icon(Icons.person_add_outlined),
title: Text(registration.toString()),
),
if (rules != null)
ListTile(
onTap: () => launch(rules.toString()),
onTap: () => launchUrlString(rules.toString()),
leading: const Icon(Icons.visibility_outlined),
title: Text(rules.toString()),
),
if (privacy != null)
ListTile(
onTap: () => launch(privacy.toString()),
onTap: () => launchUrlString(privacy.toString()),
leading: const Icon(Icons.shield_outlined),
title: Text(privacy.toString()),
),

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
@ -121,7 +121,7 @@ class HomeserverPickerView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextButton(
onPressed: () => launch(AppConfig.privacyUrl),
onPressed: () => launchUrlString(AppConfig.privacyUrl),
child: Text(L10n.of(context)!.privacy),
),
TextButton(

View File

@ -115,10 +115,7 @@ class LoginController extends State<Login> {
// do nothing, newDomain is already set to a reasonable fallback
}
if (newDomain != oldHomeserver) {
Matrix.of(context)
.getLoginClient()
.checkHomeserver(newDomain)
.catchError((e) {});
await Matrix.of(context).getLoginClient().checkHomeserver(newDomain);
if (Matrix.of(context).getLoginClient().homeserver == null) {
Matrix.of(context).getLoginClient().homeserver = oldHomeserver;

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
@ -93,12 +93,12 @@ class SettingsView extends StatelessWidget {
ListTile(
leading: const Icon(Icons.help_outline_outlined),
title: Text(L10n.of(context)!.help),
onTap: () => launch(AppConfig.supportUrl),
onTap: () => launchUrlString(AppConfig.supportUrl),
),
ListTile(
leading: const Icon(Icons.shield_sharp),
title: Text(L10n.of(context)!.privacy),
onTap: () => launch(AppConfig.privacyUrl),
onTap: () => launchUrlString(AppConfig.privacyUrl),
),
ListTile(
leading: const Icon(Icons.info_outline_rounded),

View File

@ -17,7 +17,7 @@ class SettingsAccountView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.account)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View File

@ -22,7 +22,7 @@ class SettingsChatView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.chat)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View File

@ -19,7 +19,7 @@ class SettingsSecurityView extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text(L10n.of(context)!.security)),
body: ListTileTheme(
iconColor: Theme.of(context).textTheme.bodyText1!.color,
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
child: MaxWidthBody(
withScrolling: true,
child: Column(

View File

@ -123,7 +123,7 @@ class SettingsStyleView extends StatelessWidget {
title: Text(L10n.of(context)!.changeWallpaper),
trailing: Icon(
Icons.photo_outlined,
color: Theme.of(context).textTheme.bodyText1?.color,
color: Theme.of(context).textTheme.bodyLarge?.color,
),
onTap: controller.setWallpaperAction,
);

View File

@ -30,8 +30,12 @@ extension LocalizedExceptionExtension on Object {
.toString()
.replaceAll('{', '"')
.replaceAll('}', '"');
return L10n.of(context)!
.badServerVersionsException(serverVersions, supportedVersions);
return L10n.of(context)!.badServerVersionsException(
serverVersions,
supportedVersions,
serverVersions,
supportedVersions,
);
}
if (this is BadServerLoginTypesException) {
final serverVersions = (this as BadServerLoginTypesException)
@ -44,8 +48,11 @@ extension LocalizedExceptionExtension on Object {
.toString()
.replaceAll('{', '"')
.replaceAll('}', '"');
return L10n.of(context)!
.badServerLoginTypesException(serverVersions, supportedVersions);
return L10n.of(context)!.badServerLoginTypesException(
serverVersions,
supportedVersions,
supportedVersions,
);
}
if (this is MatrixConnectionException || this is SocketException) {
return L10n.of(context)!.noConnectionToTheServer;

View File

@ -1,10 +1,8 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:file_picker_cross/file_picker_cross.dart';
import 'package:image_picker/image_picker.dart';
import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:fluffychat/utils/platform_infos.dart';
@ -22,17 +20,12 @@ extension MatrixFileExtension on MatrixFile {
}
void share(BuildContext context) async {
final fileName = name.split('/').last;
final tmpDirectory = await getTemporaryDirectory();
final path = '${tmpDirectory.path}$fileName';
await File(path).writeAsBytes(bytes);
// Workaround for iPad from
// https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus/share_plus#ipad
final box = context.findRenderObject() as RenderBox?;
await Share.shareFiles(
[path],
await Share.shareXFiles(
[XFile.fromData(bytes)],
sharePositionOrigin:
box == null ? null : box.localToGlobal(Offset.zero) & box.size,
);

View File

@ -19,7 +19,7 @@ class MatrixLocals extends MatrixLocalizations {
@override
String answeredTheCall(String senderName) {
return l10n.answeredTheCall(senderName);
return l10n.answeredTheCall(senderName, senderName);
}
@override
@ -245,7 +245,7 @@ class MatrixLocals extends MatrixLocalizations {
@override
String unknownEvent(String typeKey) {
return l10n.unknownEvent(typeKey);
return l10n.unknownEvent(typeKey, typeKey);
}
@override

View File

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import '../config/app_config.dart';
@ -50,11 +50,11 @@ abstract class PlatformInfos {
children: [
Text('Version: $version'),
OutlinedButton(
onPressed: () => launch(AppConfig.sourceCodeUrl),
onPressed: () => launchUrlString(AppConfig.sourceCodeUrl),
child: Text(L10n.of(context)!.sourceCode),
),
OutlinedButton(
onPressed: () => launch(AppConfig.emojiFontUrl),
onPressed: () => launchUrlString(AppConfig.emojiFontUrl),
child: const Text(AppConfig.emojiFontName),
),
OutlinedButton(

View File

@ -3,7 +3,7 @@ import 'dart:async';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:fluffychat/widgets/matrix.dart';
@ -83,11 +83,7 @@ extension UiaRequestManager on MatrixState {
default:
final url = Uri.parse(
'${client.homeserver}/_matrix/client/r0/auth/$stage/fallback/web?session=${uiaRequest.session}');
launch(
url.toString(),
forceSafariVC: true,
forceWebView: false,
);
launchUrlString(url.toString());
if (OkCancelResult.ok ==
await showOkCancelAlertDialog(
useRootNavigator: false,

View File

@ -6,7 +6,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart';
import 'package:punycode/punycode.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
@ -56,17 +56,17 @@ class UrlLauncher {
// to an apple maps thingy
// https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
final ll = '${latlong.first},${latlong.last}';
launch('https://maps.apple.com/?q=$ll&sll=$ll');
launchUrlString('https://maps.apple.com/?q=$ll&sll=$ll');
} else {
// transmute geo URIs on desktop to openstreetmap links, as those usually can't handle
// geo URIs
launch(
launchUrlString(
'https://www.openstreetmap.org/?mlat=${latlong.first}&mlon=${latlong.last}#map=16/${latlong.first}/${latlong.last}');
}
return;
}
}
launch(url!);
launchUrlString(url!);
return;
}
if (uri.host.isEmpty) {
@ -84,7 +84,7 @@ class UrlLauncher {
? 'xn--$hostPartPunycode'
: hostPart;
}).join('.');
launch(uri.replace(host: newHost).toString());
launchUrlString(uri.replace(host: newHost).toString());
}
void openMatrixToUrl() async {

View File

@ -91,7 +91,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
overlayEntry = null;
}),
);
Overlay.of(context)!.insert(overlayEntry!);
Overlay.of(context).insert(overlayEntry!);
}
}

View File

@ -70,8 +70,8 @@ class ContentBanner extends StatelessWidget {
mini: true,
heroTag: null,
onPressed: onEdit,
backgroundColor: Theme.of(context).backgroundColor,
foregroundColor: Theme.of(context).textTheme.bodyText1?.color,
backgroundColor: Theme.of(context).colorScheme.background,
foregroundColor: Theme.of(context).textTheme.bodyLarge?.color,
child: const Icon(Icons.camera_alt_outlined),
),
),

View File

@ -40,7 +40,7 @@ class LockScreenState extends State<LockScreen> {
),
body: Container(
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
@ -54,7 +54,7 @@ class LockScreenState extends State<LockScreen> {
Theme.of(context).secondaryHeaderColor.withAlpha(16),
Theme.of(context).primaryColor.withAlpha(16),
Theme.of(context).colorScheme.secondary.withAlpha(16),
Theme.of(context).backgroundColor.withAlpha(16),
Theme.of(context).colorScheme.background.withAlpha(16),
],
),
),

View File

@ -34,7 +34,7 @@ class M2PopupMenuButton<T> extends StatelessWidget {
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
),
elevation: theme.appBarTheme.scrolledUnderElevation,
textStyle: theme.textTheme.bodyText1,
textStyle: theme.textTheme.bodyLarge,
),
),
child: PopupMenuButton<T>(

View File

@ -19,7 +19,7 @@ import 'package:matrix/matrix.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:universal_html/html.dart' as html;
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/utils/client_manager.dart';
@ -410,7 +410,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
cancelLabel: L10n.of(context)!.doNotShowAgain,
);
if (result == OkCancelResult.ok && link != null) {
launch(link.toString());
launchUrlString(link.toString());
}
if (result == OkCancelResult.cancel) {
await store.setItemBool(SettingKeys.showNoGoogle, true);

View File

@ -144,7 +144,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
linkStyle: const TextStyle(color: Colors.blueAccent),
textStyle: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme.bodyText2!.color,
color: Theme.of(context).textTheme.bodyMedium!.color,
),
onLinkTap: (url) =>
UrlLauncher(context, url).launchUrl(),

View File

@ -96,7 +96,6 @@ class ThemeController extends State<ThemeBuilder> {
// https://github.com/bdlukaa/system_theme/issues/10
final accentColor = SystemTheme.accentColor;
final color = accentColor.accent;
if (color == kDefaultSystemAccentColor) return AppConfig.chatColor;
return color;
} catch (_) {
return AppConfig.chatColor;

View File

@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:badges/badges.dart';
import 'package:badges/badges.dart' as b;
import 'package:matrix/matrix.dart';
import 'matrix.dart';
class UnreadRoomsBadge extends StatelessWidget {
final bool Function(Room) filter;
final BadgePosition? badgePosition;
final b.BadgePosition? badgePosition;
final Widget? child;
const UnreadRoomsBadge({
@ -32,7 +32,7 @@ class UnreadRoomsBadge extends StatelessWidget {
.where(filter)
.where((r) => (r.isUnread || r.membership == Membership.invite))
.length;
return Badge(
return b.Badge(
alignment: Alignment.bottomRight,
badgeContent: Text(
unreadCount.toString(),
@ -42,14 +42,13 @@ class UnreadRoomsBadge extends StatelessWidget {
),
),
showBadge: unreadCount != 0,
animationType: BadgeAnimationType.scale,
animationType: b.BadgeAnimationType.scale,
badgeColor: Theme.of(context).colorScheme.primary,
position: badgePosition,
elevation: 4,
borderSide: BorderSide(
color: Theme.of(context).colorScheme.background,
width: 2,
strokeAlign: StrokeAlign.outside,
),
child: child,
);

View File

@ -14,6 +14,7 @@
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <handy_window/handy_window_plugin.h>
#include <record_linux/record_linux_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
@ -41,6 +42,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) record_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
record_linux_plugin_register_with_registrar(record_linux_registrar);
g_autoptr(FlPluginRegistrar) system_theme_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SystemThemePlugin");
system_theme_plugin_register_with_registrar(system_theme_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
handy_window
record_linux
system_theme
url_launcher_linux
)

View File

@ -12,6 +12,7 @@ import desktop_lifecycle
import device_info_plus
import dynamic_color
import emoji_picker_flutter
import file_selector_macos
import flutter_app_badger
import flutter_local_notifications
import flutter_secure_storage_macos
@ -21,11 +22,12 @@ import geolocator_apple
import just_audio
import macos_ui
import package_info_plus_macos
import path_provider_macos
import path_provider_foundation
import record_macos
import share_plus_macos
import shared_preferences_macos
import shared_preferences_foundation
import sqflite
import system_theme
import url_launcher_macos
import video_compress
import wakelock_macos
@ -38,9 +40,10 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FlutterAppBadgerPlugin.register(with: registry.registrar(forPlugin: "FlutterAppBadgerPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FlutterWebAuthPlugin.register(with: registry.registrar(forPlugin: "FlutterWebAuthPlugin"))
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
@ -52,6 +55,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SystemThemePlugin.register(with: registry.registrar(forPlugin: "SystemThemePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
VideoCompressPlugin.register(with: registry.registrar(forPlugin: "VideoCompressPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,8 @@ dependencies:
flutter_openssl_crypto: ^0.1.0
flutter_ringtone_player: ^3.1.1
flutter_secure_storage: ^7.0.1
flutter_typeahead: ^4.0.0
flutter_typeahead: # until https://github.com/AbdulRahmanAlHamali/flutter_typeahead/pull/447 is merged released
git: https://github.com/krillefear/flutter_typeahead.git
flutter_web_auth: ^0.5.0
flutter_webrtc: # Until https://github.com/flutter-webrtc/flutter-webrtc/issues/1212 is fixed
git: https://github.com/radzio-it/flutter-webrtc.git

View File

@ -11,6 +11,7 @@
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <record_windows/record_windows_plugin_c_api.h>
@ -28,6 +29,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
EmojiPickerFlutterPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
FlutterWebRTCPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterWebRTCPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(

View File

@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_lifecycle
dynamic_color
emoji_picker_flutter
file_selector_windows
flutter_webrtc
permission_handler_windows
record_windows