mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-31 21:34:45 +01:00
fix
- fix: same name snippet caused err - fix: auto load servers from db after restoring
This commit is contained in:
@@ -42,8 +42,8 @@ class ServerProvider extends ChangeNotifier {
|
||||
_serverOrder.clear();
|
||||
|
||||
final spis = Stores.server.fetch();
|
||||
for (final spi in spis) {
|
||||
_servers[spi.id] = genServer(spi);
|
||||
for (int idx = 0; idx < spis.length; idx++) {
|
||||
_servers[spis[idx].id] = genServer(spis[idx]);
|
||||
}
|
||||
final serverOrder_ = Stores.setting.serverOrder.fetch();
|
||||
if (serverOrder_.isNotEmpty) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class SnippetProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void _addInternal() {
|
||||
if (!Stores.setting.fTISBM.fetch()) {
|
||||
if (!Stores.setting.fTISBM.fetch() || _snippets.isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
_snippets.add(installSBM);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 570;
|
||||
static const int build = 572;
|
||||
static const String engine = "3.13.5";
|
||||
static const String buildAt = "2023-09-21 10:20:10";
|
||||
static const int modifications = 4;
|
||||
static const int script = 17;
|
||||
static const String buildAt = "2023-09-23 11:12:55";
|
||||
static const int modifications = 2;
|
||||
static const int script = 18;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
@@ -28,7 +27,7 @@ class PingPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PingPageState extends State<PingPage>
|
||||
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late TextEditingController _textEditingController;
|
||||
final _results = ValueNotifier(<PingResult>[]);
|
||||
bool get isInit => _results.value.isEmpty;
|
||||
@@ -194,12 +193,4 @@ class _PingPageState extends State<PingPage>
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
Future<FutureOr<void>> afterFirstLayout(BuildContext context) async {
|
||||
if (Providers.server.serverOrder.isEmpty) {
|
||||
await Providers.server.loadLocalData();
|
||||
await Providers.server.refreshData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,9 +456,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
@override
|
||||
Future<void> afterFirstLayout(BuildContext context) async {
|
||||
await GetIt.I.allReady();
|
||||
if (Providers.server.serverOrder.isEmpty) {
|
||||
await Providers.server.loadLocalData();
|
||||
}
|
||||
await Providers.server.loadLocalData();
|
||||
Providers.server.startAutoRefresh();
|
||||
}
|
||||
|
||||
@@ -505,7 +503,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
return 23.0;
|
||||
}
|
||||
if (_flipedCardIds.contains(id)) {
|
||||
return 77.0;
|
||||
return 80.0;
|
||||
}
|
||||
if (Stores.setting.moveOutServerTabFuncBtns.fetch() &&
|
||||
// Discussion #146
|
||||
|
||||
@@ -100,42 +100,46 @@ class _SettingPageState extends State<SettingPage> {
|
||||
appBar: CustomAppBar(
|
||||
title: Text(l10n.setting),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () => context.showRoundDialog(
|
||||
title: Text(l10n.attention),
|
||||
child: Text(l10n.sureDelete(l10n.all)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_setting.box.deleteAll(_setting.box.keys);
|
||||
context.pop();
|
||||
context.showSnackBar(l10n.success);
|
||||
},
|
||||
child:
|
||||
Text(l10n.ok, style: const TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 17),
|
||||
child: InkWell(
|
||||
onTap: () => context.showRoundDialog(
|
||||
title: Text(l10n.attention),
|
||||
child: Text(l10n.sureDelete(l10n.all)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_setting.box.deleteAll(_setting.box.keys);
|
||||
context.pop();
|
||||
context.showSnackBar(l10n.success);
|
||||
},
|
||||
child: Text(l10n.ok,
|
||||
style: const TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
/// Only for debug, this will cause the app to crash
|
||||
// onDoubleTap: () => context.showRoundDialog(
|
||||
// title: Text(l10n.attention),
|
||||
// child: Text(l10n.sureDelete(l10n.all)),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Stores.docker.box.deleteFromDisk();
|
||||
// Stores.server.box.deleteFromDisk();
|
||||
// Stores.setting.box.deleteFromDisk();
|
||||
// Stores.history.box.deleteFromDisk();
|
||||
// Stores.snippet.box.deleteFromDisk();
|
||||
// Stores.key.box.deleteFromDisk();
|
||||
// exit(0);
|
||||
// },
|
||||
// child: Text(l10n.ok,
|
||||
// style: const TextStyle(color: Colors.red)),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
child: const Icon(Icons.delete),
|
||||
),
|
||||
// onDoubleTap: () => context.showRoundDialog(
|
||||
// title: Text(l10n.attention),
|
||||
// child: Text(l10n.sureDelete(l10n.all)),
|
||||
// actions: [
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Stores.docker.box.deleteFromDisk();
|
||||
// Stores.server.box.deleteFromDisk();
|
||||
// Stores.setting.box.deleteFromDisk();
|
||||
// Stores.history.box.deleteFromDisk();
|
||||
// Stores.snippet.box.deleteFromDisk();
|
||||
// Stores.key.box.deleteFromDisk();
|
||||
// context.pop();
|
||||
// context.showSnackBar(l10n.success);
|
||||
// },
|
||||
// child: Text(l10n.ok, style: const TextStyle(color: Colors.red)),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
icon: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -83,7 +83,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
itemBuilder: (context, idx) {
|
||||
final snippet = filtered.elementAt(idx);
|
||||
return ReorderableDelayedDragStartListener(
|
||||
key: ValueKey(snippet.name),
|
||||
key: ValueKey(idx),
|
||||
index: idx,
|
||||
child: _buildSnippetItem(snippet),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user