mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
create folder modern dialog
This commit is contained in:
@@ -49,6 +49,11 @@ enum MouseFocusScope {
|
||||
none
|
||||
}
|
||||
|
||||
final buttonShape =
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
));
|
||||
|
||||
class FileManagerPage extends StatefulWidget {
|
||||
const FileManagerPage({Key? key, required this.id, this.forceRelay})
|
||||
: super(key: key);
|
||||
@@ -300,14 +305,13 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
}
|
||||
skipCount = index + 1;
|
||||
}
|
||||
var searchResult = entries
|
||||
.skip(skipCount)
|
||||
.where((element) => element.name.toLowerCase().startsWith(buffer));
|
||||
var searchResult = entries.skip(skipCount).where(
|
||||
(element) => element.name.toLowerCase().startsWith(buffer));
|
||||
if (searchResult.isEmpty) {
|
||||
// cannot find next, lets restart search from head
|
||||
debugPrint("restart search from head");
|
||||
searchResult =
|
||||
entries.where((element) => element.name.toLowerCase().startsWith(buffer));
|
||||
searchResult = entries.where(
|
||||
(element) => element.name.toLowerCase().startsWith(buffer));
|
||||
}
|
||||
if (searchResult.isEmpty) {
|
||||
setState(() {
|
||||
@@ -321,8 +325,8 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
onSearch: (buffer) {
|
||||
debugPrint("searching for $buffer");
|
||||
final selectedEntries = getSelectedItems(isLocal);
|
||||
final searchResult =
|
||||
entries.where((element) => element.name.toLowerCase().startsWith(buffer));
|
||||
final searchResult = entries.where(
|
||||
(element) => element.name.toLowerCase().startsWith(buffer));
|
||||
selectedEntries.clear();
|
||||
if (searchResult.isEmpty) {
|
||||
setState(() {
|
||||
@@ -504,8 +508,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
debugPrint("entry is not valid: ${entry.path}");
|
||||
}
|
||||
final selectedEntries = getSelectedItems(isLocal);
|
||||
final searchResult =
|
||||
entries.where((element) => element == entry);
|
||||
final searchResult = entries.where((element) => element == entry);
|
||||
selectedEntries.clear();
|
||||
if (searchResult.isEmpty) {
|
||||
return;
|
||||
@@ -976,25 +979,66 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
|
||||
cancel() => close(false);
|
||||
return CustomAlertDialog(
|
||||
title: Text(translate("Create Folder")),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: translate(
|
||||
"Please enter the folder name"),
|
||||
),
|
||||
controller: name,
|
||||
autofocus: true,
|
||||
SvgPicture.asset("assets/folder_new.svg",
|
||||
color: MyTheme.accent),
|
||||
Text(
|
||||
translate("Create Folder"),
|
||||
).paddingOnly(
|
||||
left: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: translate(
|
||||
"Please enter the folder name",
|
||||
),
|
||||
),
|
||||
controller: name,
|
||||
autofocus: true,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
style: ButtonStyle(
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(
|
||||
MyTheme.accent,
|
||||
),
|
||||
shape: buttonShape,
|
||||
),
|
||||
icon: Icon(Icons.close_rounded),
|
||||
label: Text(translate("Cancel")),
|
||||
onPressed: cancel,
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
style: ButtonStyle(
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(
|
||||
MyTheme.accent,
|
||||
),
|
||||
shape: buttonShape,
|
||||
),
|
||||
icon: Icon(Icons.done_rounded),
|
||||
label: Text(translate("Ok")),
|
||||
onPressed: submit,
|
||||
),
|
||||
],
|
||||
).paddingOnly(top: 20)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
dialogButton("Cancel",
|
||||
onPressed: cancel, isOutline: true),
|
||||
dialogButton("OK", onPressed: submit)
|
||||
],
|
||||
onSubmit: submit,
|
||||
onCancel: cancel,
|
||||
);
|
||||
@@ -1036,11 +1080,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
? MyTheme.accent80
|
||||
: MyTheme.accent,
|
||||
),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
),
|
||||
),
|
||||
shape: buttonShape,
|
||||
),
|
||||
onPressed: validItems(selectedItems)
|
||||
? () {
|
||||
@@ -1430,14 +1470,14 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
).marginSymmetric(horizontal: 4),
|
||||
),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: ascending.value != null
|
||||
? Icon(
|
||||
ascending.value!
|
||||
? Icons.keyboard_arrow_up_rounded
|
||||
: Icons.keyboard_arrow_down_rounded,
|
||||
)
|
||||
: const Offstage())
|
||||
flex: 1,
|
||||
child: ascending.value != null
|
||||
? Icon(
|
||||
ascending.value!
|
||||
? Icons.keyboard_arrow_up_rounded
|
||||
: Icons.keyboard_arrow_down_rounded,
|
||||
)
|
||||
: const Offstage())
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1467,10 +1507,8 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
axis: Axis.vertical,
|
||||
onPointerMove: (dx) {
|
||||
nameColWidth.value += dx;
|
||||
nameColWidth.value = min(
|
||||
kDesktopFileTransferMaximumWidth,
|
||||
max(kDesktopFileTransferMinimumWidth,
|
||||
nameColWidth.value));
|
||||
nameColWidth.value = min(kDesktopFileTransferMaximumWidth,
|
||||
max(kDesktopFileTransferMinimumWidth, nameColWidth.value));
|
||||
},
|
||||
padding: padding,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user