@@ -490,6 +490,9 @@ class _FileManagerViewState extends State<FileManagerView> {
490490 }
491491
492492 Widget headTools () {
493+ var uploadButtonTapPosition = RelativeRect .fill;
494+ RxBool isUploadFolder =
495+ (bind.mainGetLocalOption (key: 'upload-folder-button' ) == 'Y' ).obs;
493496 return Container (
494497 child: Column (
495498 children: [
@@ -814,48 +817,64 @@ class _FileManagerViewState extends State<FileManagerView> {
814817 ),
815818 if (isWeb)
816819 Obx (() => ElevatedButton .icon (
817- style: ButtonStyle (
818- padding: MaterialStateProperty .all <EdgeInsetsGeometry >(
819- isLocal
820- ? EdgeInsets .only (left: 10 )
821- : EdgeInsets .only (right: 10 )),
822- backgroundColor: MaterialStateProperty .all (
823- selectedItems.items.isEmpty
824- ? MyTheme .accent80
825- : MyTheme .accent,
826- ),
827- ),
828- onPressed: () => {webselectFiles (is_folder: true )},
829- icon: Offstage (),
830- label: Text (
831- translate ('Upload folder' ),
832- textAlign: TextAlign .right,
833- style: TextStyle (
834- color: Colors .white,
835- ),
836- ))).marginOnly (left: 16 ),
837- if (isWeb)
838- Obx (() => ElevatedButton .icon (
839- style: ButtonStyle (
840- padding: MaterialStateProperty .all <EdgeInsetsGeometry >(
841- isLocal
842- ? EdgeInsets .only (left: 10 )
843- : EdgeInsets .only (right: 10 )),
844- backgroundColor: MaterialStateProperty .all (
845- selectedItems.items.isEmpty
846- ? MyTheme .accent80
847- : MyTheme .accent,
820+ style: ButtonStyle (
821+ padding: MaterialStateProperty .all <EdgeInsetsGeometry >(
822+ isLocal
823+ ? EdgeInsets .only (left: 10 )
824+ : EdgeInsets .only (right: 10 )),
825+ backgroundColor: MaterialStateProperty .all (
826+ selectedItems.items.isEmpty
827+ ? MyTheme .accent80
828+ : MyTheme .accent,
829+ ),
848830 ),
849- ),
850- onPressed: () => {webselectFiles (is_folder: false )},
851- icon: Offstage (),
852- label: Text (
853- translate ('Upload files' ),
854- textAlign: TextAlign .right,
855- style: TextStyle (
856- color: Colors .white,
831+ onPressed: () =>
832+ {webselectFiles (is_folder: isUploadFolder.value)},
833+ label: InkWell (
834+ hoverColor: Colors .transparent,
835+ splashColor: Colors .transparent,
836+ highlightColor: Colors .transparent,
837+ focusColor: Colors .transparent,
838+ onTapDown: (e) {
839+ final x = e.globalPosition.dx;
840+ final y = e.globalPosition.dy;
841+ uploadButtonTapPosition =
842+ RelativeRect .fromLTRB (x, y, x, y);
843+ },
844+ onTap: () async {
845+ final value = await showMenu <bool >(
846+ context: context,
847+ position: uploadButtonTapPosition,
848+ items: [
849+ PopupMenuItem <bool >(
850+ value: false ,
851+ child: Text (translate ('Upload files' )),
852+ ),
853+ PopupMenuItem <bool >(
854+ value: true ,
855+ child: Text (translate ('Upload folder' )),
856+ ),
857+ ]);
858+ if (value != null ) {
859+ isUploadFolder.value = value;
860+ bind.mainSetLocalOption (
861+ key: 'upload-folder-button' ,
862+ value: value ? 'Y' : '' );
863+ webselectFiles (is_folder: value);
864+ }
865+ },
866+ child: Icon (Icons .arrow_drop_down),
857867 ),
858- ))).marginOnly (left: 16 ),
868+ icon: Text (
869+ translate (isUploadFolder.isTrue
870+ ? 'Upload folder'
871+ : 'Upload files' ),
872+ textAlign: TextAlign .right,
873+ style: TextStyle (
874+ color: Colors .white,
875+ ),
876+ ).marginOnly (left: 8 ),
877+ )).marginOnly (left: 16 ),
859878 Obx (() => ElevatedButton .icon (
860879 style: ButtonStyle (
861880 padding: MaterialStateProperty .all <EdgeInsetsGeometry >(
0 commit comments