Fix issue caused by flutter_staggered_animations

This commit is contained in:
Junyuan Feng
2022-01-10 16:00:11 +08:00
parent 692f3bcdbc
commit 195e188d0c
8 changed files with 32 additions and 60 deletions

View File

@@ -354,7 +354,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.77;
MARKETING_VERSION = 1.0.78;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -484,7 +484,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.77;
MARKETING_VERSION = 1.0.78;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -508,7 +508,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.77;
MARKETING_VERSION = 1.0.78;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -21,7 +21,8 @@ import 'package:toolbox/data/store/server.dart';
import 'package:toolbox/data/store/setting.dart';
import 'package:toolbox/locator.dart';
/// Must put this func out of any Class
/// Must put this func out of any Class.
/// Because of this function is called by [compute] in [ServerProvider.genClient].
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
List<SSHKeyPair> loadIndentity(Map<String, dynamic> auth) {
return SSHKeyPair.fromPem(auth['privateKey'], auth['passphrase']);
@@ -94,6 +95,7 @@ class ServerProvider extends BusyProvider {
try {
await Future.wait(_servers.map((s) async {
final idx = _servers.indexOf(s);
if (idx == -1) return;
final status = await _getData(s.info, idx);
if (status != null) {
_servers[idx].status = status;
@@ -101,9 +103,11 @@ class ServerProvider extends BusyProvider {
}
}));
} catch (e) {
if (e is! RangeError) {
rethrow;
}
}
}
Future<void> startAutoRefresh() async {
final duration =
@@ -130,9 +134,11 @@ class ServerProvider extends BusyProvider {
}
void delServer(ServerPrivateInfo info) {
_servers.removeWhere((e) => e.info == info);
locator<ServerStore>().delete(info);
final idx = _servers.indexWhere((s) => s.info == info);
_servers[idx].client?.close();
_servers.removeAt(idx);
notifyListeners();
locator<ServerStore>().delete(info);
}
Future<void> updateServer(

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ToolBox";
static const int build = 77;
static const int build = 78;
static const String engine =
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (3 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
static const String buildAt = "2022-01-10 10:55:03.676581";
static const int modifications = 7;
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (4 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
static const String buildAt = "2022-01-10 12:42:06.986546";
static const int modifications = 0;
}

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:toolbox/core/utils.dart';
import 'package:toolbox/data/res/color.dart';
@@ -49,24 +48,12 @@ class _ConvertPageState extends State<ConvertPage>
body: GestureDetector(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 7),
child: AnimationLimiter(
child: Column(
children: AnimationConfiguration.toStaggeredList(
duration: const Duration(milliseconds: 377),
childAnimationBuilder: (widget) => SlideAnimation(
verticalOffset: 50.0,
child: FadeInAnimation(
child: widget,
),
),
children: [
child: Column(children: [
const SizedBox(height: 13),
_buildInputTop(),
_buildTypeOption(),
_buildResult(),
],
))),
),
])),
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
),
floatingActionButton: FloatingActionButton(

View File

@@ -1,13 +1,11 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/core/route.dart';
import 'package:toolbox/data/model/server/net_speed.dart';
import 'package:toolbox/data/model/server/server.dart';
import 'package:toolbox/data/model/server/server_status.dart';
import 'package:toolbox/data/provider/server.dart';
import 'package:toolbox/data/res/color.dart';
import 'package:toolbox/data/res/icon/linux_icons.dart';
import 'package:toolbox/view/page/server/edit.dart';
import 'package:toolbox/view/widget/round_rect_card.dart';
const style11 = TextStyle(fontSize: 11);

View File

@@ -1,7 +1,6 @@
import 'package:after_layout/after_layout.dart';
import 'package:circle_chart/circle_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get_it/get_it.dart';
import 'package:marquee/marquee.dart';
import 'package:provider/provider.dart';
@@ -64,23 +63,13 @@ class _ServerPageState extends State<ServerPage>
}
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 7),
child: AnimationLimiter(
child: Column(
children: AnimationConfiguration.toStaggeredList(
duration: const Duration(milliseconds: 377),
childAnimationBuilder: (widget) => SlideAnimation(
verticalOffset: 77.0,
child: FadeInAnimation(
child: widget,
),
),
children: [
const SizedBox(height: 13),
...pro.servers.map((e) => _buildEachServerCard(e)),
SizedBox(height: _media.padding.bottom),
],
))),
);
));
});
return Scaffold(
body: autoUpdate
@@ -287,7 +276,7 @@ class _ServerPageState extends State<ServerPage>
Future<void> afterFirstLayout(BuildContext context) async {
await GetIt.I.allReady();
await _serverProvider.loadLocalData();
_serverProvider.refreshData();
await _serverProvider.refreshData();
_serverProvider.startAutoRefresh();
}
}

View File

@@ -206,13 +206,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
flutter_staggered_animations:
dependency: "direct main"
description:
name: flutter_staggered_animations
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter_test:
dependency: "direct dev"
description: flutter

View File

@@ -36,7 +36,6 @@ dependencies:
hive_flutter: ^1.0.0
dio: ^4.0.0
after_layout: ^1.1.0
flutter_staggered_animations: ^1.0.0
extended_image: ^5.1.3
url_launcher: ^6.0.9
countly_flutter: