mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
#96 opt.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 423;
|
||||
static const int build = 425;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-08-05 21:13:42.622817";
|
||||
static const String buildAt = "2023-08-05 21:55:28.557439";
|
||||
static const int modifications = 7;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ const participants = <GhId>{
|
||||
'wxdjs',
|
||||
'Aeorq',
|
||||
'allonmymind',
|
||||
'Yuuki-Rin',
|
||||
'LittleState',
|
||||
'karuboniru',
|
||||
'whosphp',
|
||||
|
||||
@@ -65,31 +65,31 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const BackButtonIcon(),
|
||||
onPressed: () {
|
||||
if (_path != null) {
|
||||
_path!.update('/');
|
||||
}
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
title: Text(_s.download),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.downloading),
|
||||
onPressed: () =>
|
||||
AppRoute(const SftpMissionPage(), 'sftp downloading')
|
||||
.go(context),
|
||||
onPressed: () => AppRoute(
|
||||
const SftpMissionPage(),
|
||||
'sftp downloading',
|
||||
).go(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: FadeIn(
|
||||
key: UniqueKey(),
|
||||
child: _buildBody(),
|
||||
child: _wrapPopScope(),
|
||||
),
|
||||
bottomNavigationBar: SafeArea(child: _buildPath()),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final path = await pickOneFile();
|
||||
if (path == null) return;
|
||||
final name = getFileName(path) ?? 'imported';
|
||||
await File(path).copy(pathJoin(_path!.path, name));
|
||||
setState(() {});
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,13 +99,53 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Divider(),
|
||||
(_path?.path ?? _s.loadingFiles).omitStartStr(),
|
||||
_buildBtns(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBtns() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_path?.update('..');
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
final path = await pickOneFile();
|
||||
if (path == null) return;
|
||||
final name = getFileName(path) ?? 'imported';
|
||||
await File(path).copy(pathJoin(_path!.path, name));
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _wrapPopScope() {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (_path == null) return true;
|
||||
if (_path!.canBack) {
|
||||
_path!.update('..');
|
||||
setState(() {});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: _buildBody(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
if (_path == null) {
|
||||
return const Center(
|
||||
@@ -114,27 +154,10 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
}
|
||||
final dir = Directory(_path!.path);
|
||||
final files = dir.listSync();
|
||||
final canGoBack = _path!.canBack;
|
||||
if (files.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('~'),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: canGoBack ? files.length + 1 : files.length,
|
||||
itemCount: files.length,
|
||||
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 7),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0 && canGoBack) {
|
||||
return RoundRectCard(ListTile(
|
||||
leading: const Icon(Icons.keyboard_arrow_left),
|
||||
title: const Text('..'),
|
||||
onTap: () {
|
||||
_path!.update('..');
|
||||
setState(() {});
|
||||
},
|
||||
));
|
||||
}
|
||||
index = canGoBack ? index - 1 : index;
|
||||
var file = files[index];
|
||||
var fileName = file.path.split('/').last;
|
||||
var stat = file.statSync();
|
||||
|
||||
@@ -76,6 +76,15 @@ class _SftpPageState extends State<SftpPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const BackButtonIcon(),
|
||||
onPressed: () {
|
||||
if (_status.path != null) {
|
||||
_status.path!.update('/');
|
||||
}
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
centerTitle: true,
|
||||
title: TwoLineText(up: 'SFTP', down: widget.spi.name),
|
||||
actions: [
|
||||
@@ -277,6 +286,12 @@ class _SftpPageState extends State<SftpPage> {
|
||||
return centerLoading;
|
||||
}
|
||||
|
||||
if (_status.files!.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('~'),
|
||||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
child: FadeIn(
|
||||
key: Key(widget.spi.name + _status.path!.path),
|
||||
|
||||
Reference in New Issue
Block a user