migrate Flutter 3.3.9

This commit is contained in:
Junyuan Feng
2022-12-02 21:39:55 +08:00
parent a0b68862fc
commit 475bb8c4b0
7 changed files with 202 additions and 184 deletions

File diff suppressed because one or more lines are too long

View File

@@ -9,6 +9,8 @@ import 'package:toolbox/generated/l10n.dart';
import 'package:toolbox/view/widget/card_dialog.dart'; import 'package:toolbox/view/widget/card_dialog.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:toolbox/core/extension/stringx.dart'; import 'package:toolbox/core/extension/stringx.dart';
// ignore: depend_on_referenced_packages
import 'package:cross_file/cross_file.dart' show XFile;
bool isDarkMode(BuildContext context) => bool isDarkMode(BuildContext context) =>
Theme.of(context).brightness == Brightness.dark; Theme.of(context).brightness == Brightness.dark;
@@ -105,7 +107,8 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
} else { } else {
text = '${filePaths.length} ${S.of(context).files}'; text = '${filePaths.length} ${S.of(context).files}';
} }
await Share.shareFiles(filePaths, text: 'ServerBox -> $text'); final xfiles = filePaths.map((e) => XFile(e)).toList();
await Share.shareXFiles(xfiles, text: 'ServerBox -> $text');
return filePaths.isNotEmpty; return filePaths.isNotEmpty;
} }

View File

@@ -1,7 +1,7 @@
const backendUrl = 'https://res.lolli.tech'; const backendUrl = 'https://res.lolli.tech';
const baseUrl = '$backendUrl/toolbox'; const baseUrl = '$backendUrl/toolbox';
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq'; const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
const myGithub = 'https://github.com/LollipopKit'; const myGithub = 'https://github.com/lollipopkit';
const rainSunMeGithub = 'https://github.com/RainSunMe'; const rainSunMeGithub = 'https://github.com/RainSunMe';
const fectureGithub = 'https://github.com/fecture'; const fectureGithub = 'https://github.com/fecture';
const issueUrl = 'https://github.com/LollipopKit/flutter_server_box/issues'; const issueUrl = '$myGithub/flutter_server_box/issues';

View File

@@ -11,6 +11,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart'; import 'package:intl/src/intl_helpers.dart';
@@ -20,8 +21,8 @@ import 'messages_zh.dart' as messages_zh;
typedef Future<dynamic> LibraryLoader(); typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = { Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null), 'en': () => new SynchronousFuture(null),
'zh': () => new Future.value(null), 'zh': () => new SynchronousFuture(null),
}; };
MessageLookupByLibrary? _findExact(String localeName) { MessageLookupByLibrary? _findExact(String localeName) {
@@ -36,18 +37,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
} }
/// User programs should call this before using [localeName] for messages. /// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async { Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale( var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null, localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null); onFailure: (_) => null);
if (availableLocale == null) { if (availableLocale == null) {
return new Future.value(false); return new SynchronousFuture(false);
} }
var lib = _deferredLibraries[availableLocale]; var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib()); lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup()); initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true); return new SynchronousFuture(true);
} }
bool _messagesExistFor(String locale) { bool _messagesExistFor(String locale) {

View File

@@ -244,7 +244,7 @@ class _MyHomePageState extends State<MyHomePage>
applicationIcon: _buildIcon(), applicationIcon: _buildIcon(),
aboutBoxChildren: [ aboutBoxChildren: [
UrlText( UrlText(
text: s.madeWithLove(myGithub), replace: 'LollipopKit'), text: s.madeWithLove(myGithub), replace: 'lollipopkit'),
UrlText( UrlText(
text: s.aboutThanks, text: s.aboutThanks,
), ),

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,7 @@ dependencies:
flutter_material_color_picker: ^1.1.0+2 flutter_material_color_picker: ^1.1.0+2
circle_chart: circle_chart:
git: git:
url: https://github.com/LollipopKit/circle_chart url: https://github.com/lollipopkit/circle_chart
ref: main ref: main
# path: ../circle_chart # path: ../circle_chart
r_upgrade: ^0.3.6 r_upgrade: ^0.3.6