mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
feat: migrate to Flutter 3.7
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"flutterSdkVersion": "3.3.10",
|
||||
"flutterSdkVersion": "3.7.4",
|
||||
"flavors": {}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: "3.3.10"
|
||||
flutter-version: "3.7.4"
|
||||
channel: "stable"
|
||||
- name: Dependencies
|
||||
run: flutter pub get
|
||||
|
||||
@@ -138,7 +138,10 @@ class _ApkPickerPageState extends ConsumerState<ApkPickerPage> {
|
||||
data: (size) => '${size.asReadableFileSize} - ',
|
||||
orElse: () => '',
|
||||
);
|
||||
return Text('$appSizeString${app.versionName ?? '?'} - ${app.packageName}', style: Theme.of(context).textTheme.caption);
|
||||
return Text(
|
||||
'$appSizeString${app.versionName ?? '?'} - ${app.packageName}',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -147,7 +147,7 @@ class _HomePageState extends ConsumerState<HomePage> {
|
||||
children: [
|
||||
const Icon(Icons.file_download, size: 128),
|
||||
const SizedBox(height: 30),
|
||||
Text(t.sendTab.placeItems, style: Theme.of(context).textTheme.headline6),
|
||||
Text(t.sendTab.placeItems, style: Theme.of(context).textTheme.titleLarge),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:localsend_app/pages/home_page.dart';
|
||||
import 'package:localsend_app/provider/network/send_provider.dart';
|
||||
import 'package:localsend_app/provider/network/server_provider.dart';
|
||||
import 'package:localsend_app/provider/progress_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/file_size_helper.dart';
|
||||
import 'package:localsend_app/util/file_speed_helper.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
@@ -137,7 +138,7 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {
|
||||
children: [
|
||||
Text(
|
||||
receiveSession != null ? t.progressPage.titleReceiving : t.progressPage.titleSending,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
if (checkPlatformWithFileSystem() && receiveSession != null)
|
||||
Padding(
|
||||
@@ -244,9 +245,9 @@ class _ProgressPageState extends ConsumerState<ProgressPage> {
|
||||
builder: (_) => ErrorDialog(error: errorMessage!),
|
||||
);
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Icon(Icons.info, color: Colors.orange, size: 20),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Icon(Icons.info, color: Theme.of(context).colorScheme.warning, size: 20),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -375,7 +376,7 @@ extension on FileStatus {
|
||||
case FileStatus.sending:
|
||||
return Theme.of(context).colorScheme.tertiaryContainer;
|
||||
case FileStatus.failed:
|
||||
return Colors.orange;
|
||||
return Theme.of(context).colorScheme.warning;
|
||||
case FileStatus.finished:
|
||||
return Theme.of(context).colorScheme.tertiaryContainer;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:localsend_app/gen/strings.g.dart';
|
||||
import 'package:localsend_app/model/receive_history_entry.dart';
|
||||
import 'package:localsend_app/provider/receive_history_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/file_size_helper.dart';
|
||||
import 'package:localsend_app/widget/dialogs/cannot_open_file_dialog.dart';
|
||||
import 'package:localsend_app/widget/dialogs/file_info_dialog.dart';
|
||||
@@ -54,7 +53,7 @@ class ReceiveHistoryPage extends ConsumerWidget {
|
||||
body: Builder(builder: (context) {
|
||||
if (entries.isEmpty) {
|
||||
return Center(
|
||||
child: Text(t.receiveHistoryPage.empty, style: Theme.of(context).textTheme.headline4),
|
||||
child: Text(t.receiveHistoryPage.empty, style: Theme.of(context).textTheme.headlineMedium),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,7 +117,6 @@ class ReceiveHistoryPage extends ConsumerWidget {
|
||||
break;
|
||||
}
|
||||
},
|
||||
color: Theme.of(context).cardColorWithElevation,
|
||||
itemBuilder: (BuildContext context) {
|
||||
return (entry.path != null ? _optionsAll : _optionsWithoutOpen).map((e) {
|
||||
return PopupMenuItem<_EntryOption>(
|
||||
|
||||
@@ -33,7 +33,7 @@ class ReceiveOptionsPage extends ConsumerWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(t.receiveOptionsPage.destination, style: Theme.of(context).textTheme.headline6),
|
||||
Text(t.receiveOptionsPage.destination, style: Theme.of(context).textTheme.titleLarge),
|
||||
if (checkPlatformWithFileSystem())
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
@@ -54,7 +54,7 @@ class ReceiveOptionsPage extends ConsumerWidget {
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Text(t.general.files, style: Theme.of(context).textTheme.headline6),
|
||||
Text(t.general.files, style: Theme.of(context).textTheme.titleLarge),
|
||||
const SizedBox(width: 10),
|
||||
Tooltip(
|
||||
message: t.dialogs.quickActions.title,
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:localsend_app/pages/progress_page.dart';
|
||||
import 'package:localsend_app/pages/receive_options_page.dart';
|
||||
import 'package:localsend_app/provider/network/server_provider.dart';
|
||||
import 'package:localsend_app/provider/selection/selected_receiving_files_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/ip_helper.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
import 'package:localsend_app/util/snackbar.dart';
|
||||
@@ -128,7 +129,7 @@ class _ReceivePageState extends ConsumerState<ReceivePage> {
|
||||
_message != null
|
||||
? (_isLink ? t.receivePage.subTitleLink : t.receivePage.subTitleMessage)
|
||||
: t.receivePage.subTitle(n: receiveSession.files.length),
|
||||
style: smallUi ? null : Theme.of(context).textTheme.headline6,
|
||||
style: smallUi ? null : Theme.of(context).textTheme.titleLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (_message != null)
|
||||
@@ -202,7 +203,11 @@ class _ReceivePageState extends ConsumerState<ReceivePage> {
|
||||
if (receiveSession.status == SessionStatus.canceledBySender) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.receivePage.canceled, style: const TextStyle(color: Colors.orange), textAlign: TextAlign.center),
|
||||
child: Text(
|
||||
t.receivePage.canceled,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.warning),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: ElevatedButton.icon(
|
||||
@@ -234,7 +239,7 @@ class _ReceivePageState extends ConsumerState<ReceivePage> {
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).buttonTheme.colorScheme!.error,
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
foregroundColor: Colors.white, // wrong in dark mode, so we hard code this
|
||||
),
|
||||
onPressed: () {
|
||||
|
||||
@@ -79,7 +79,7 @@ class SelectedFilesPage extends ConsumerWidget {
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: false,
|
||||
),
|
||||
Text(file.size.asReadableFileSize, style: Theme.of(context).textTheme.caption),
|
||||
Text(file.size.asReadableFileSize, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:localsend_app/model/device.dart';
|
||||
import 'package:localsend_app/model/session_status.dart';
|
||||
import 'package:localsend_app/provider/device_info_provider.dart';
|
||||
import 'package:localsend_app/provider/network/send_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/sleep.dart';
|
||||
import 'package:localsend_app/widget/animations/initial_fade_transition.dart';
|
||||
import 'package:localsend_app/widget/dialogs/error_dialog.dart';
|
||||
@@ -117,12 +118,12 @@ class _SendPageState extends ConsumerState<SendPage> {
|
||||
else if (sendState.status == SessionStatus.declined)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.rejected, style: const TextStyle(color: Colors.orange), textAlign: TextAlign.center),
|
||||
child: Text(t.sendPage.rejected, style: TextStyle(color: Theme.of(context).colorScheme.warning), textAlign: TextAlign.center),
|
||||
)
|
||||
else if (sendState.status == SessionStatus.recipientBusy)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Text(t.sendPage.busy, style: const TextStyle(color: Colors.orange), textAlign: TextAlign.center),
|
||||
child: Text(t.sendPage.busy, style: TextStyle(color: Theme.of(context).colorScheme.warning), textAlign: TextAlign.center),
|
||||
)
|
||||
else if (sendState.status == SessionStatus.finishedWithErrors)
|
||||
Padding(
|
||||
@@ -130,11 +131,11 @@ class _SendPageState extends ConsumerState<SendPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(t.general.error, style: const TextStyle(color: Colors.orange)),
|
||||
Text(t.general.error, style: TextStyle(color: Theme.of(context).colorScheme.warning)),
|
||||
if (sendState.errorMessage != null)
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.orange,
|
||||
foregroundColor: Theme.of(context).colorScheme.warning,
|
||||
),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
|
||||
@@ -69,7 +69,7 @@ class _SendTabState extends ConsumerState<SendTab> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: _horizontalPadding),
|
||||
child: Text(
|
||||
t.sendTab.selection.title,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
@@ -105,7 +105,7 @@ class _SendTabState extends ConsumerState<SendTab> {
|
||||
children: [
|
||||
Text(
|
||||
t.sendTab.selection.title,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(t.sendTab.selection.files(files: selectedFiles.length)),
|
||||
@@ -170,7 +170,7 @@ class _SendTabState extends ConsumerState<SendTab> {
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Text(t.sendTab.nearbyDevices, style: Theme.of(context).textTheme.subtitle1),
|
||||
child: Text(t.sendTab.nearbyDevices, style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
|
||||
@@ -52,7 +52,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: Text(t.settingsTab.title, style: Theme.of(context).textTheme.headline6, textAlign: TextAlign.center),
|
||||
child: Text(t.settingsTab.title, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
_SettingsSection(
|
||||
@@ -95,7 +95,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(
|
||||
settings.locale?.humanName ?? t.settingsTab.general.languageOptions.system,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
@@ -123,7 +123,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
onPressed: () => initAutoStartAndOpenSettings(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(t.general.settings, style: Theme.of(context).textTheme.subtitle1),
|
||||
child: Text(t.general.settings, style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -174,7 +174,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(settings.destination ?? '(Downloads)', style: Theme.of(context).textTheme.subtitle1),
|
||||
child: Text(settings.destination ?? '(Downloads)', style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -201,7 +201,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
firstChild: Container(),
|
||||
secondChild: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Text(t.settingsTab.network.needRestart, style: const TextStyle(color: Colors.orange)),
|
||||
child: Text(t.settingsTab.network.needRestart, style: TextStyle(color: Theme.of(context).colorScheme.warning)),
|
||||
),
|
||||
),
|
||||
_SettingsEntry(
|
||||
@@ -476,7 +476,7 @@ class _SettingsSection extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: Theme.of(context).textTheme.subtitle1),
|
||||
Text(title, style: Theme.of(context).textTheme.titleMedium),
|
||||
const SizedBox(height: 10),
|
||||
...children,
|
||||
],
|
||||
|
||||
@@ -18,7 +18,7 @@ class TroubleshootingTab extends ConsumerWidget {
|
||||
return ResponsiveListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 30),
|
||||
children: [
|
||||
Text(t.troubleshootTab.title, style: Theme.of(context).textTheme.headline6, textAlign: TextAlign.center),
|
||||
Text(t.troubleshootTab.title, style: Theme.of(context).textTheme.titleLarge, textAlign: TextAlign.center),
|
||||
const SizedBox(height: 20),
|
||||
Text(t.troubleshootTab.subTitle, textAlign: TextAlign.center),
|
||||
const SizedBox(height: 5),
|
||||
@@ -99,7 +99,7 @@ class _TroubleshootItemState extends State<_TroubleshootItem> {
|
||||
),
|
||||
Wrap(
|
||||
children: [
|
||||
Text(widget.symptomText, style: Theme.of(context).textTheme.subtitle1),
|
||||
Text(widget.symptomText, style: Theme.of(context).textTheme.titleMedium),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
+11
-3
@@ -19,10 +19,12 @@ final _darkInputBorder = OutlineInputBorder(
|
||||
|
||||
ThemeData getTheme(Brightness brightness) {
|
||||
return ThemeData(
|
||||
brightness: brightness,
|
||||
primarySwatch: Colors.teal,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: Colors.teal,
|
||||
brightness: brightness,
|
||||
backgroundColor: brightness == Brightness.light ? Colors.white : Colors.grey.shade900,
|
||||
),
|
||||
useMaterial3: true,
|
||||
scaffoldBackgroundColor: brightness == Brightness.light ? Colors.white : Colors.grey.shade900,
|
||||
navigationBarTheme: brightness == Brightness.dark
|
||||
? NavigationBarThemeData(
|
||||
indicatorColor: Colors.teal,
|
||||
@@ -75,6 +77,12 @@ extension ThemeDataExt on ThemeData {
|
||||
}
|
||||
}
|
||||
|
||||
extension ColorSchemeExt on ColorScheme {
|
||||
Color get warning {
|
||||
return Colors.orange;
|
||||
}
|
||||
}
|
||||
|
||||
extension InputDecorationThemeExt on InputDecorationTheme {
|
||||
BorderRadius get borderRadius => _borderRadius;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
||||
/// Clears the cache.
|
||||
/// It is written in a "fire-and-forget" way, so we don't need to wait until everything is cleared.
|
||||
void clearCache() {
|
||||
FilePicker.platform.clearTemporaryFiles().catchError((error) {
|
||||
FilePicker.platform.clearTemporaryFiles().then((_) {}).catchError((error) {
|
||||
print(error);
|
||||
});
|
||||
PhotoManager.clearFileCache().catchError((error) => print(error));
|
||||
@@ -15,7 +15,7 @@ void clearCache() {
|
||||
getTemporaryDirectory().then((cacheDir) {
|
||||
cacheDir.list().listen((event) {
|
||||
if (event is File) {
|
||||
event.delete().catchError((error) {
|
||||
event.delete().then((_) {}).catchError((error) {
|
||||
print(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:localsend_app/provider/last_devices.provider.dart';
|
||||
import 'package:localsend_app/provider/network/targeted_discovery_provider.dart';
|
||||
import 'package:localsend_app/provider/network_info_provider.dart';
|
||||
import 'package:localsend_app/provider/settings_provider.dart';
|
||||
import 'package:localsend_app/theme.dart';
|
||||
import 'package:localsend_app/util/task_runner.dart';
|
||||
import 'package:routerino/routerino.dart';
|
||||
|
||||
@@ -181,7 +182,7 @@ class _AddressInputDialogState extends ConsumerState<AddressInputDialog> {
|
||||
if (_failed)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Text(t.general.error, style: const TextStyle(color: Colors.orange)),
|
||||
child: Text(t.general.error, style: TextStyle(color: Theme.of(context).colorScheme.warning)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -61,7 +61,7 @@ class FileInfoDialog extends StatelessWidget {
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(t.general.close),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class _TextFieldTvState extends ConsumerState<TextFieldTv> {
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text(widget.controller.text, style: Theme.of(context).textTheme.subtitle1),
|
||||
child: Text(widget.controller.text, style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart' hide MenuItem;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
import 'package:localsend_app/util/tray_helper.dart';
|
||||
import 'package:tray_manager/tray_manager.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/material.dart' hide MenuItem;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:localsend_app/util/platform_check.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
|
||||
+381
-194
File diff suppressed because it is too large
Load Diff
+4
-3
@@ -6,11 +6,12 @@ publish_to: "none"
|
||||
version: 1.7.0+26
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.5 <3.0.0"
|
||||
flutter: '>=3.7.4'
|
||||
sdk: ">=2.19.2 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
basic_utils: 5.4.2
|
||||
collection: 1.16.0
|
||||
collection: 1.17.0
|
||||
connectivity_plus: 3.0.3
|
||||
desktop_drop: 0.4.0
|
||||
device_apps: 2.2.0
|
||||
@@ -34,7 +35,7 @@ dependencies:
|
||||
package_info_plus: 3.0.3
|
||||
path_provider: 2.0.11
|
||||
permission_handler: 10.2.0
|
||||
routerino: 0.3.0
|
||||
routerino: 0.3.1
|
||||
screen_retriever: 0.1.6
|
||||
share_handler: 0.0.16
|
||||
shared_preferences: 2.0.17
|
||||
|
||||
Reference in New Issue
Block a user