update android file UI
This commit is contained in:
parent
88b3144026
commit
d8b3fd43f5
@ -229,9 +229,7 @@ class FileModel extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goToParentDirectory() {
|
goToParentDirectory() {
|
||||||
final isWindows =
|
final parent = PathUtil.dirname(currentDir.path, currentIsWindows);
|
||||||
_isLocal ? _localOption.isWindows : _remoteOption.isWindows;
|
|
||||||
final parent = PathUtil.dirname(currentDir.path, isWindows);
|
|
||||||
openDirectory(parent);
|
openDirectory(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
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,
|
||||||
totalSwitches: 2,
|
totalSwitches: 2,
|
||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
@ -79,6 +80,104 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
PopupMenuButton<String>(
|
||||||
|
icon: Icon(Icons.more_vert),
|
||||||
|
itemBuilder: (context) {
|
||||||
|
return [
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.refresh, color: Colors.black),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text(translate("Refresh File"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
value: "refresh",
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.check, color: Colors.black),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text(translate("Multi Select"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
value: "select",
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.folder_outlined,
|
||||||
|
color: Colors.black),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text(translate("Create Folder"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
value: "folder",
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
model.currentShowHidden
|
||||||
|
? Icons.check_box_outlined
|
||||||
|
: Icons.check_box_outline_blank,
|
||||||
|
color: Colors.black),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text(translate("Show Hidden Files"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
value: "hidden",
|
||||||
|
)
|
||||||
|
];
|
||||||
|
},
|
||||||
|
onSelected: (v) {
|
||||||
|
if (v == "refresh") {
|
||||||
|
model.refresh();
|
||||||
|
} else if (v == "select") {
|
||||||
|
_selectedItems.clear();
|
||||||
|
model.toggleSelectMode();
|
||||||
|
} else if (v == "folder") {
|
||||||
|
final name = TextEditingController();
|
||||||
|
DialogManager.show(
|
||||||
|
(setState, close) => CustomAlertDialog(
|
||||||
|
title: Text(translate("Create Folder")),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: translate(
|
||||||
|
"Please enter the folder name"),
|
||||||
|
),
|
||||||
|
controller: name,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
style: flatButtonStyle,
|
||||||
|
onPressed: () => close(false),
|
||||||
|
child: Text(translate("Cancel"))),
|
||||||
|
ElevatedButton(
|
||||||
|
style: flatButtonStyle,
|
||||||
|
onPressed: () {
|
||||||
|
if (name.value.text.isNotEmpty) {
|
||||||
|
model.createDir(PathUtil.join(
|
||||||
|
model.currentDir.path,
|
||||||
|
name.value.text,
|
||||||
|
model.currentIsWindows));
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(translate("OK")))
|
||||||
|
]));
|
||||||
|
} else if (v == "hidden") {
|
||||||
|
model.toggleShowHidden();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: body(),
|
body: body(),
|
||||||
bottomSheet: bottomSheet(),
|
bottomSheet: bottomSheet(),
|
||||||
@ -233,6 +332,10 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
)),
|
)),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.arrow_upward),
|
||||||
|
onPressed: goBack,
|
||||||
|
),
|
||||||
PopupMenuButton<SortBy>(
|
PopupMenuButton<SortBy>(
|
||||||
icon: Icon(Icons.sort),
|
icon: Icon(Icons.sort),
|
||||||
itemBuilder: (context) {
|
itemBuilder: (context) {
|
||||||
@ -245,98 +348,6 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
.toList();
|
.toList();
|
||||||
},
|
},
|
||||||
onSelected: model.changeSortStyle),
|
onSelected: model.changeSortStyle),
|
||||||
PopupMenuButton<String>(
|
|
||||||
icon: Icon(Icons.more_vert),
|
|
||||||
itemBuilder: (context) {
|
|
||||||
return [
|
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.refresh),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
Text(translate("Refresh File"))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
value: "refresh",
|
|
||||||
),
|
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.check),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
Text(translate("Multi Select"))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
value: "select",
|
|
||||||
),
|
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.folder_outlined),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
Text(translate("Create Folder"))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
value: "folder",
|
|
||||||
),
|
|
||||||
PopupMenuItem(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Icon(model.currentShowHidden
|
|
||||||
? Icons.check_box_outlined
|
|
||||||
: Icons.check_box_outline_blank),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
Text(translate("Show Hidden Files"))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
value: "hidden",
|
|
||||||
)
|
|
||||||
];
|
|
||||||
},
|
|
||||||
onSelected: (v) {
|
|
||||||
if (v == "refresh") {
|
|
||||||
model.refresh();
|
|
||||||
} else if (v == "select") {
|
|
||||||
_selectedItems.clear();
|
|
||||||
model.toggleSelectMode();
|
|
||||||
} else if (v == "folder") {
|
|
||||||
final name = TextEditingController();
|
|
||||||
DialogManager.show((setState, close) => CustomAlertDialog(
|
|
||||||
title: Text(translate("Create Folder")),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: translate(
|
|
||||||
"Please enter the folder name"),
|
|
||||||
),
|
|
||||||
controller: name,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
style: flatButtonStyle,
|
|
||||||
onPressed: () => close(false),
|
|
||||||
child: Text(translate("Cancel"))),
|
|
||||||
ElevatedButton(
|
|
||||||
style: flatButtonStyle,
|
|
||||||
onPressed: () {
|
|
||||||
if (name.value.text.isNotEmpty) {
|
|
||||||
model.createDir(PathUtil.join(
|
|
||||||
model.currentDir.path,
|
|
||||||
name.value.text,
|
|
||||||
model.currentIsWindows));
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Text(translate("OK")))
|
|
||||||
]));
|
|
||||||
} else if (v == "hidden") {
|
|
||||||
model.toggleShowHidden();
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -347,6 +358,13 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
height: 100,
|
height: 100,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(30,5,30,0),
|
||||||
|
child: Text(
|
||||||
|
model.currentDir.path,
|
||||||
|
style: TextStyle(color: MyTheme.darkGray),
|
||||||
|
),
|
||||||
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(2),
|
padding: EdgeInsets.all(2),
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -437,17 +455,9 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
|||||||
final list = PathUtil.split(path, model.currentIsWindows);
|
final list = PathUtil.split(path, model.currentIsWindows);
|
||||||
final breadCrumbList = [
|
final breadCrumbList = [
|
||||||
BreadCrumbItem(
|
BreadCrumbItem(
|
||||||
content: Row(
|
content: IconButton(
|
||||||
children: [
|
icon: Icon(Icons.home_filled),
|
||||||
IconButton(
|
onPressed: onHome,
|
||||||
icon: Icon(Icons.arrow_upward),
|
|
||||||
onPressed: goBack,
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Icons.home_filled),
|
|
||||||
onPressed: onHome,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
))
|
))
|
||||||
];
|
];
|
||||||
breadCrumbList.addAll(list.asMap().entries.map((e) => BreadCrumbItem(
|
breadCrumbList.addAll(list.asMap().entries.map((e) => BreadCrumbItem(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user