opt: dual columns file-transfer in desktop version

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous 2022-06-21 18:14:44 +08:00
parent 02aa676030
commit 5bfbb1b807
2 changed files with 32 additions and 24 deletions

View File

@ -8,7 +8,6 @@ import 'package:flutter_hbb/models/file_model.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:toggle_switch/toggle_switch.dart';
import 'package:wakelock/wakelock.dart'; import 'package:wakelock/wakelock.dart';
import '../../common.dart'; import '../../common.dart';
@ -79,24 +78,24 @@ class _FileManagerPageState extends State<FileManagerPage>
IconButton(icon: Icon(Icons.close), onPressed: clientClose), IconButton(icon: Icon(Icons.close), onPressed: clientClose),
]), ]),
centerTitle: true, centerTitle: true,
title: ToggleSwitch( // title: ToggleSwitch(
initialLabelIndex: model.isLocal ? 0 : 1, // initialLabelIndex: model.isLocal ? 0 : 1,
activeBgColor: [MyTheme.idColor], // activeBgColor: [MyTheme.idColor],
inactiveBgColor: MyTheme.grayBg, // inactiveBgColor: MyTheme.grayBg,
inactiveFgColor: Colors.black54, // inactiveFgColor: Colors.black54,
totalSwitches: 2, // totalSwitches: 2,
minWidth: 100, // minWidth: 100,
fontSize: 15, // fontSize: 15,
iconSize: 18, // iconSize: 18,
labels: [translate("Local"), translate("Remote")], // labels: [translate("Local"), translate("Remote")],
icons: [Icons.phone_android_sharp, Icons.screen_share], // icons: [Icons.phone_android_sharp, Icons.screen_share],
onToggle: (index) { // onToggle: (index) {
final current = model.isLocal ? 0 : 1; // final current = model.isLocal ? 0 : 1;
if (index != current) { // if (index != current) {
model.togglePage(); // model.togglePage();
} // }
}, // },
), // ),
actions: [ actions: [
PopupMenuButton<String>( PopupMenuButton<String>(
icon: Icon(Icons.more_vert), icon: Icon(Icons.more_vert),
@ -196,7 +195,12 @@ class _FileManagerPageState extends State<FileManagerPage>
}), }),
], ],
), ),
body: body(), body: Row(
children: [
Flexible(flex: 1, child: body(isLocal: true)),
Flexible(flex: 1, child: body(isLocal: false))
],
),
bottomSheet: bottomSheet(), bottomSheet: bottomSheet(),
)); ));
})); }));
@ -209,9 +213,8 @@ class _FileManagerPageState extends State<FileManagerPage>
return !_selectedItems.isOtherPage(model.isLocal); return !_selectedItems.isOtherPage(model.isLocal);
} }
Widget body() { Widget body({bool isLocal = false}) {
final isLocal = model.isLocal; final fd = isLocal ? model.currentLocalDir : model.currentRemoteDir;
final fd = model.currentDir;
final entries = fd.entries; final entries = fd.entries;
return Column(children: [ return Column(children: [
headTools(), headTools(),

View File

@ -233,7 +233,12 @@ class FileModel extends ChangeNotifier {
} }
refresh() { refresh() {
openDirectory(currentDir.path); if (isDesktop) {
openDirectory(currentRemoteDir.path);
openDirectory(currentLocalDir.path);
} else {
openDirectory(currentDir.path);
}
} }
openDirectory(String path, {bool? isLocal}) async { openDirectory(String path, {bool? isLocal}) async {