mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 08:34:39 +01:00
fix: LocalStoragePage.initDir
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 400;
|
||||
static const int build = 402;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-07-31 14:06:15.008140";
|
||||
static const int modifications = 9;
|
||||
static const String buildAt = "2023-08-01 18:49:37.034380";
|
||||
static const int modifications = 4;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import '../../data/res/build_data.dart';
|
||||
import '../../data/res/color.dart';
|
||||
import '../../data/res/path.dart';
|
||||
import '../../data/res/ui.dart';
|
||||
import '../../data/store/server.dart';
|
||||
import '../../data/store/setting.dart';
|
||||
import '../../locator.dart';
|
||||
import '../widget/future_widget.dart';
|
||||
@@ -329,25 +330,25 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_startPageKey.currentState?.showButtonMenu();
|
||||
},
|
||||
trailing: ValueBuilder(
|
||||
listenable: _launchPageIdx,
|
||||
build: () => PopupMenuButton(
|
||||
key: _startPageKey,
|
||||
itemBuilder: (BuildContext context) => items,
|
||||
initialValue: _launchPageIdx.value,
|
||||
onSelected: (int idx) {
|
||||
_launchPageIdx.value = idx;
|
||||
_setting.launchPage.put(_launchPageIdx.value);
|
||||
},
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: _media.size.width * 0.35),
|
||||
child: Text(
|
||||
tabTitleName(context, AppTab.values[_launchPageIdx.value]),
|
||||
textAlign: TextAlign.right,
|
||||
style: textSize15,
|
||||
),
|
||||
),
|
||||
)),
|
||||
listenable: _launchPageIdx,
|
||||
build: () => PopupMenuButton(
|
||||
key: _startPageKey,
|
||||
itemBuilder: (BuildContext context) => items,
|
||||
initialValue: _launchPageIdx.value,
|
||||
onSelected: (int idx) {
|
||||
_launchPageIdx.value = idx;
|
||||
_setting.launchPage.put(_launchPageIdx.value);
|
||||
},
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
|
||||
child: Text(
|
||||
tabTitleName(context, AppTab.values[_launchPageIdx.value]),
|
||||
textAlign: TextAlign.right,
|
||||
style: textSize15,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -643,21 +644,22 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_localeKey.currentState?.showButtonMenu();
|
||||
},
|
||||
trailing: ValueBuilder(
|
||||
listenable: _localeCode,
|
||||
build: () => PopupMenuButton(
|
||||
key: _localeKey,
|
||||
itemBuilder: (BuildContext context) => items,
|
||||
initialValue: _localeCode.value,
|
||||
onSelected: (String idx) {
|
||||
_localeCode.value = idx;
|
||||
_setting.locale.put(idx);
|
||||
_showRestartSnackbar();
|
||||
},
|
||||
child: Text(
|
||||
_s.languageName,
|
||||
style: textSize15,
|
||||
),
|
||||
)),
|
||||
listenable: _localeCode,
|
||||
build: () => PopupMenuButton(
|
||||
key: _localeKey,
|
||||
itemBuilder: (BuildContext context) => items,
|
||||
initialValue: _localeCode.value,
|
||||
onSelected: (String idx) {
|
||||
_localeCode.value = idx;
|
||||
_setting.locale.put(idx);
|
||||
_showRestartSnackbar();
|
||||
},
|
||||
child: Text(
|
||||
_s.languageName,
|
||||
style: textSize15,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -946,28 +948,30 @@ class _SettingPageState extends State<SettingPage> {
|
||||
title: Text(_s.deleteServers),
|
||||
trailing: const Icon(Icons.delete_forever),
|
||||
onTap: () async {
|
||||
final all = _serverProvider.servers.keys.map(
|
||||
(e) => TextButton(
|
||||
onPressed: () => showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.sureDelete(e)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => _serverProvider.delServer(e),
|
||||
child: Text(_s.ok),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Text(e),
|
||||
),
|
||||
);
|
||||
final all = locator<ServerStore>().box.keys.map(
|
||||
(e) => TextButton(
|
||||
onPressed: () => showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.sureDelete(e)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => _serverProvider.delServer(e),
|
||||
child: Text(_s.ok),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Text(e),
|
||||
),
|
||||
);
|
||||
showRoundDialog<List<String>>(
|
||||
context: context,
|
||||
title: Text(_s.choose),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: all.toList(),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: all.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -42,13 +42,14 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
sftpDir.then((dir) {
|
||||
_path = PathWithPrefix(dir.path);
|
||||
if (widget.initDir != null) {
|
||||
_path!.update(widget.initDir!.replaceFirst('${dir.path}/', ''));
|
||||
}
|
||||
setState(() {});
|
||||
});
|
||||
if (widget.initDir != null) {
|
||||
_path = PathWithPrefix(widget.initDir!);
|
||||
} else {
|
||||
sftpDir.then((dir) {
|
||||
_path = PathWithPrefix(dir.path);
|
||||
});
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user