mobile file transfer handle driver & update UI theme

This commit is contained in:
csf 2022-10-19 11:49:32 +09:00
parent ec698e6885
commit d10748a67b
2 changed files with 78 additions and 64 deletions
flutter/lib

@ -69,8 +69,14 @@ class _FileManagerPageState extends State<FileManagerPage> {
title: ToggleSwitch( title: ToggleSwitch(
initialLabelIndex: model.isLocal ? 0 : 1, initialLabelIndex: model.isLocal ? 0 : 1,
activeBgColor: [MyTheme.idColor], activeBgColor: [MyTheme.idColor],
// inactiveBgColor: MyTheme.grayBg, inactiveBgColor:
inactiveFgColor: Colors.black54, Theme.of(context).brightness == Brightness.light
? MyTheme.grayBg
: null,
inactiveFgColor:
Theme.of(context).brightness == Brightness.light
? Colors.black54
: null,
totalSwitches: 2, totalSwitches: 2,
minWidth: 100, minWidth: 100,
fontSize: 15, fontSize: 15,
@ -92,7 +98,8 @@ class _FileManagerPageState extends State<FileManagerPage> {
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [
Icon(Icons.refresh, color: Colors.black), Icon(Icons.refresh,
color: Theme.of(context).iconTheme.color),
SizedBox(width: 5), SizedBox(width: 5),
Text(translate("Refresh File")) Text(translate("Refresh File"))
], ],
@ -102,7 +109,8 @@ class _FileManagerPageState extends State<FileManagerPage> {
PopupMenuItem( PopupMenuItem(
child: Row( child: Row(
children: [ children: [
Icon(Icons.check, color: Colors.black), Icon(Icons.check,
color: Theme.of(context).iconTheme.color),
SizedBox(width: 5), SizedBox(width: 5),
Text(translate("Multi Select")) Text(translate("Multi Select"))
], ],
@ -113,7 +121,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
child: Row( child: Row(
children: [ children: [
Icon(Icons.folder_outlined, Icon(Icons.folder_outlined,
color: Colors.black), color: Theme.of(context).iconTheme.color),
SizedBox(width: 5), SizedBox(width: 5),
Text(translate("Create Folder")) Text(translate("Create Folder"))
], ],
@ -127,7 +135,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
model.currentShowHidden model.currentShowHidden
? Icons.check_box_outlined ? Icons.check_box_outlined
: Icons.check_box_outline_blank, : Icons.check_box_outline_blank,
color: Colors.black), color: Theme.of(context).iconTheme.color),
SizedBox(width: 5), SizedBox(width: 5),
Text(translate("Show Hidden Files")) Text(translate("Show Hidden Files"))
], ],
@ -188,7 +196,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
)); ));
})); }));
bool needShowCheckBox() { bool showCheckBox() {
if (!model.selectMode) { if (!model.selectMode) {
return false; return false;
} }
@ -220,20 +228,23 @@ class _FileManagerPageState extends State<FileManagerPage> {
return Card( return Card(
child: ListTile( child: ListTile(
leading: Icon( leading: Icon(
entries[index].isFile ? Icons.feed_outlined : Icons.folder, entries[index].isFile
? Icons.feed_outlined
: entries[index].isDrive
? Icons.computer
: Icons.folder,
size: 40), size: 40),
title: Text(entries[index].name), title: Text(entries[index].name),
selected: selected, selected: selected,
subtitle: Text( subtitle: Text(
entries[index] entries[index].isDrive
.lastModified() ? ""
.toString() : "${entries[index].lastModified().toString().replaceAll(".000", "")} $sizeStr",
.replaceAll(".000", "") +
" " +
sizeStr,
style: TextStyle(fontSize: 12, color: MyTheme.darkGray), style: TextStyle(fontSize: 12, color: MyTheme.darkGray),
), ),
trailing: needShowCheckBox() trailing: entries[index].isDrive
? null
: showCheckBox()
? Checkbox( ? Checkbox(
value: selected, value: selected,
onChanged: (v) { onChanged: (v) {
@ -284,14 +295,16 @@ class _FileManagerPageState extends State<FileManagerPage> {
setState(() {}); setState(() {});
return; return;
} }
if (entries[index].isDirectory) { if (entries[index].isDirectory || entries[index].isDrive) {
model.openDirectory(entries[index].path); model.openDirectory(entries[index].path);
breadCrumbScrollToEnd(); breadCrumbScrollToEnd();
} else { } else {
// Perform file-related tasks. // Perform file-related tasks.
} }
}, },
onLongPress: () { onLongPress: entries[index].isDrive
? null
: () {
_selectedItems.clear(); _selectedItems.clear();
model.toggleSelectMode(); model.toggleSelectMode();
if (model.selectMode) { if (model.selectMode) {

@ -1139,6 +1139,7 @@ class SelectedItems {
bool? get isLocal => _isLocal; bool? get isLocal => _isLocal;
add(bool isLocal, Entry e) { add(bool isLocal, Entry e) {
if (e.isDrive) return;
_isLocal ??= isLocal; _isLocal ??= isLocal;
if (_isLocal != null && _isLocal != isLocal) { if (_isLocal != null && _isLocal != isLocal) {
return; return;