diff --git a/assets/doc.jpeg b/assets/doc.jpeg new file mode 100644 index 0000000..8b646ed Binary files /dev/null and b/assets/doc.jpeg differ diff --git a/assets/image.jpeg b/assets/image.jpeg new file mode 100644 index 0000000..9438e89 Binary files /dev/null and b/assets/image.jpeg differ diff --git a/assets/music1.jpeg b/assets/music1.jpeg new file mode 100644 index 0000000..9f2469f Binary files /dev/null and b/assets/music1.jpeg differ diff --git a/assets/video.jpeg b/assets/video.jpeg new file mode 100644 index 0000000..d8bb6ba Binary files /dev/null and b/assets/video.jpeg differ diff --git a/lib/displays/audios_display.dart b/lib/displays/audios_display.dart index 4361cf4..e99b067 100644 --- a/lib/displays/audios_display.dart +++ b/lib/displays/audios_display.dart @@ -54,14 +54,14 @@ class _AudioDisplayScreenState extends State style: TextStyle(fontSize: 14.0), maxLines: 3, ), - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + // leading: BackButton(onPressed: () { + // if (coreNotifier.currentPath.absolute.path == pathlib.separator) { + // Navigator.popUntil( + // context, ModalRoute.withName(Navigator.defaultRouteName)); + // } else { + // coreNotifier.navigateBackdward(); + // } + // }), actions: [ IconButton( // Go home @@ -100,30 +100,24 @@ class _AudioDisplayScreenState extends State if (snapshot.hasError) { return Center(child: Text('Error: ${snapshot.error}')); } else if (snapshot.data.length != 0) { - return GridView.builder( - physics: const AlwaysScrollableScrollPhysics(), - controller: _scrollController, - key: PageStorageKey(widget.path), - padding: - EdgeInsets.only(left: 10.0, right: 10.0, top: 0), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4), + return ListView.builder( itemCount: snapshot.data.length, itemBuilder: (context, index) { if (snapshot.data[index] is MyFile) { //print(snapshot.data[index].path); //String s = pathlib.extension(snapshot.data[index].path); String s = mime(snapshot.data[index].path); - print(s); + // print(s); if (s == 'audio/mpeg' || s == 'audio/basic' || s == 'audio/mid ' || s == 'audio/x-aiff' || s == 'audio/ogg' || s == 'audio/vnd.wav') { - return FileWidget( - name: snapshot.data[index].name, + return Card( + child: ListTile( + leading: Image.asset('assets/music1.jpeg'), + title:Text(snapshot.data[index].name), onTap: () { _printFuture(OpenFile.open( snapshot.data[index].path)); @@ -136,7 +130,7 @@ class _AudioDisplayScreenState extends State name: snapshot.data[index].name, )); }, - ); + )); } } return Container(); diff --git a/lib/displays/category_display.dart b/lib/displays/category_display.dart index 801e956..b009fad 100644 --- a/lib/displays/category_display.dart +++ b/lib/displays/category_display.dart @@ -20,24 +20,10 @@ class CategoryWise extends StatelessWidget { "Browse Category Wise", ), backgroundColor: Colors.blueGrey, - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + ), - // body: ListView( - // children: [ - // _tile('Images', '', 'assets/imgicon.png'), - // _tile('Audios', '', 'assets/musicicon.png'), - // _tile('Videos', '', 'assets/videoicon.png'), - // _tile('Documents', '', 'assets/docicon.png'), - // ], - // ) + body: ListView( children: [ Card( diff --git a/lib/displays/docs_display.dart b/lib/displays/docs_display.dart index 7b5277f..16f74f6 100644 --- a/lib/displays/docs_display.dart +++ b/lib/displays/docs_display.dart @@ -55,14 +55,14 @@ class _DocsDisplayScreenState extends State style: TextStyle(fontSize: 14.0), maxLines: 3, ), - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + // leading: BackButton(onPressed: () { + // if (coreNotifier.currentPath.absolute.path == pathlib.separator) { + // Navigator.popUntil( + // context, ModalRoute.withName(Navigator.defaultRouteName)); + // } else { + // coreNotifier.navigateBackdward(); + // } + // }), actions: [ IconButton( // Go home @@ -101,15 +101,7 @@ class _DocsDisplayScreenState extends State if (snapshot.hasError) { return Center(child: Text('Error: ${snapshot.error}')); } else if (snapshot.data.length != 0) { - return GridView.builder( - physics: const AlwaysScrollableScrollPhysics(), - controller: _scrollController, - key: PageStorageKey(widget.path), - padding: - EdgeInsets.only(left: 10.0, right: 10.0, top: 0), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4), + return ListView.builder( itemCount: snapshot.data.length, itemBuilder: (context, index) { if (snapshot.data[index] is MyFile) { @@ -132,8 +124,12 @@ class _DocsDisplayScreenState extends State s == 'application/x-tar' || s == 'application/zip' || s == 'application/x-7z-compressed') { - return FileWidget( - name: snapshot.data[index].name, + return Card( + + + child: ListTile( + leading:Image.asset('assets/doc.jpeg'), + title: Text(snapshot.data[index].name), onTap: () { _printFuture(OpenFile.open( snapshot.data[index].path)); @@ -146,7 +142,7 @@ class _DocsDisplayScreenState extends State name: snapshot.data[index].name, )); }, - ); + )); } } return Container(); diff --git a/lib/displays/duplicate_display.dart b/lib/displays/duplicate_display.dart index 0fc0a42..de69fd2 100644 --- a/lib/displays/duplicate_display.dart +++ b/lib/displays/duplicate_display.dart @@ -137,7 +137,7 @@ class _DuplicateFileDisplayScreenState extends State @override Widget build(BuildContext context) { - super.build(context); + super.build(context); final preferences = Provider.of(context); var coreNotifier = Provider.of(context); //var list1 = new List(); @@ -149,14 +149,7 @@ class _DuplicateFileDisplayScreenState extends State style: TextStyle(fontSize: 14.0), maxLines: 3, ), - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + actions: [ IconButton( // Go home @@ -204,7 +197,8 @@ class _DuplicateFileDisplayScreenState extends State return ListView.builder( itemCount: snapshot1.data.length, itemBuilder: (context, index){ - return ListTile( + return Card( + child:ListTile( leading:Image.asset('assets/fileicon1.png'), title: Text(snapshot1.data[index].name), onTap: () { @@ -219,7 +213,7 @@ class _DuplicateFileDisplayScreenState extends State name: snapshot1.data[index].name, )); }, - ); + )); }, ); diff --git a/lib/displays/folder_display.dart b/lib/displays/folder_display.dart index b101b73..e3ba215 100644 --- a/lib/displays/folder_display.dart +++ b/lib/displays/folder_display.dart @@ -1,4 +1,3 @@ -// framework import 'package:file_explorer/views/create_folder_dialog.dart'; import 'package:flutter/material.dart'; @@ -30,7 +29,7 @@ class FolderListScreen extends StatefulWidget { const FolderListScreen({@required this.path, this.home: false}) : assert(path != null); @override - _FolderListScreenState createState() => _FolderListScreenState(); + _FolderListScreenState createState() => _FolderListScreenState(path:this.path); } class _FolderListScreenState extends State @@ -38,9 +37,14 @@ class _FolderListScreenState extends State ScrollController _scrollController; @override void initState() { + + _scrollController = ScrollController(keepScrollOffset: true); super.initState(); } + String path; + _FolderListScreenState({this.path}); + @override void dispose() { @@ -55,16 +59,12 @@ class _FolderListScreenState extends State var coreNotifier = Provider.of(context); return Scaffold( - drawer: new Drawer( + drawer:this.path=='/storage/emulated/0/'? new Drawer( child: new ListView( children: [ new UserAccountsDrawerHeader( - // currentAccountPicture: new CircleAvatar( - // //backgroundColor:defaultTargetPlatform == TargetPlatform.android?Colors.green:null, - // backgroundColor: Colors.lime, - // child: new Text("Swift Drawer"), - // ), - accountEmail: null, + + accountEmail:null, accountName: null, ), new ListTile( @@ -72,11 +72,12 @@ class _FolderListScreenState extends State title: Text('Images'), dense: false, onTap: () { + Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (context) => - ImageDisplayScreen(path: '/storage/emulated/0/'))); + ImageDisplayScreen(path: this.path))); }, ), new ListTile( @@ -88,7 +89,7 @@ class _FolderListScreenState extends State context, MaterialPageRoute( builder: (context) => - AudioDisplayScreen(path: '/storage/emulated/0/'))); + AudioDisplayScreen(path: this.path))); }, ), new ListTile( @@ -100,7 +101,7 @@ class _FolderListScreenState extends State context, MaterialPageRoute( builder: (context) => - DocsDisplayScreen(path: '/storage/emulated/0/'))); + DocsDisplayScreen(path:this.path))); }, ), new ListTile( @@ -112,7 +113,7 @@ class _FolderListScreenState extends State context, MaterialPageRoute( builder: (context) => - VIdeoDisplayScreen(path: '/storage/emulated/0/'))); + VIdeoDisplayScreen(path:this.path))); }, ), new ListTile( @@ -124,18 +125,19 @@ class _FolderListScreenState extends State context, MaterialPageRoute( builder: (context) => DuplicateFileDisplayScreen( - path: '/storage/emulated/0/'))); + path:this.path))); }, ) ], - )), + )):null, appBar: AppBar( - title: Text( + title:this.path.startsWith('/storage/emulated/0/')? Text( "Internal Storage", //coreNotifier.currentPath.absolute.path, style: TextStyle(fontSize: 14.0), maxLines: 3, - ), + ):Text("External Storage",style: TextStyle(fontSize: 14.0), + maxLines: 3,), actions: [ IconButton( // Go home diff --git a/lib/displays/images_display.dart b/lib/displays/images_display.dart index 6d54b10..c681843 100644 --- a/lib/displays/images_display.dart +++ b/lib/displays/images_display.dart @@ -55,20 +55,14 @@ class _ImageDisplayScreenState extends State style: TextStyle(fontSize: 14.0), maxLines: 3, ), - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + // actions: [ IconButton( // Go home onPressed: () { Navigator.popUntil( context, ModalRoute.withName(Navigator.defaultRouteName)); + // Navigator.pop(context); }, icon: Icon(Icons.home), ), @@ -101,15 +95,7 @@ class _ImageDisplayScreenState extends State if (snapshot.hasError) { return Center(child: Text('Error: ${snapshot.error}')); } else if (snapshot.data.length != 0) { - return GridView.builder( - physics: const AlwaysScrollableScrollPhysics(), - controller: _scrollController, - key: PageStorageKey(widget.path), - padding: - EdgeInsets.only(left: 10.0, right: 10.0, top: 0), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4), + return ListView.builder( itemCount: snapshot.data.length, itemBuilder: (context, index) { String s = mime(snapshot.data[index].path); @@ -125,8 +111,9 @@ class _ImageDisplayScreenState extends State s == 'image/png')) { //print(s); - return FileWidget( - name: snapshot.data[index].name, + return Card(child:ListTile( + leading:Image.asset('assets/image.jpeg'), + title:Text(snapshot.data[index].name), onTap: () { _printFuture( OpenFile.open(snapshot.data[index].path)); @@ -139,10 +126,10 @@ class _ImageDisplayScreenState extends State name: snapshot.data[index].name, )); }, - ); + )); } - return Container(); + return Container(); }); } else { return Center( diff --git a/lib/displays/video_display.dart b/lib/displays/video_display.dart index e368902..4fcc076 100644 --- a/lib/displays/video_display.dart +++ b/lib/displays/video_display.dart @@ -55,14 +55,14 @@ class _VIdeoDisplayScreenState extends State style: TextStyle(fontSize: 14.0), maxLines: 3, ), - leading: BackButton(onPressed: () { - if (coreNotifier.currentPath.absolute.path == pathlib.separator) { - Navigator.popUntil( - context, ModalRoute.withName(Navigator.defaultRouteName)); - } else { - coreNotifier.navigateBackdward(); - } - }), + // leading: BackButton(onPressed: () { + // if (coreNotifier.currentPath.absolute.path == pathlib.separator) { + // Navigator.popUntil( + // context, ModalRoute.withName(Navigator.defaultRouteName)); + // } else { + // coreNotifier.navigateBackdward(); + // } + // }), actions: [ IconButton( // Go home @@ -101,15 +101,7 @@ class _VIdeoDisplayScreenState extends State if (snapshot.hasError) { return Center(child: Text('Error: ${snapshot.error}')); } else if (snapshot.data.length != 0) { - return GridView.builder( - physics: const AlwaysScrollableScrollPhysics(), - controller: _scrollController, - key: PageStorageKey(widget.path), - padding: - EdgeInsets.only(left: 10.0, right: 10.0, top: 0), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4), + return ListView.builder( itemCount: snapshot.data.length, itemBuilder: (context, index) { if (snapshot.data[index] is MyFile) { @@ -121,8 +113,10 @@ class _VIdeoDisplayScreenState extends State s == 'video/3gpp' || s == 'video/x-msvideo' || s == 'video/x-ms-wmv') { - return FileWidget( - name: snapshot.data[index].name, + return Card( + child:ListTile( + leading: Image.asset('assets/video.jpeg'), + title: Text(snapshot.data[index].name), onTap: () { _printFuture(OpenFile.open( snapshot.data[index].path)); @@ -135,7 +129,7 @@ class _VIdeoDisplayScreenState extends State name: snapshot.data[index].name, )); }, - ); + )); } } return Container(); diff --git a/lib/utilities/dir_utils.dart b/lib/utilities/dir_utils.dart index 9d8aee8..b796b8e 100644 --- a/lib/utilities/dir_utils.dart +++ b/lib/utilities/dir_utils.dart @@ -172,6 +172,10 @@ Future> searchFiles(dynamic path, String query, return files; } +//------------------------------------------ + + + Future> searchDuplicateFiles(dynamic path, String query, {bool matchCase: false, recursive: true, bool hidden: false}) async { int start = DateTime.now().millisecondsSinceEpoch; diff --git a/lib/views/file_folder_dialog.dart b/lib/views/file_folder_dialog.dart index aa08228..3480363 100644 --- a/lib/views/file_folder_dialog.dart +++ b/lib/views/file_folder_dialog.dart @@ -98,14 +98,14 @@ class FileContextDialog extends StatelessWidget { ), // copy single files - SimpleDialogOption( - onPressed: () { - Navigator.pop(context); - model.copyFile(path); - }, - child: ListTile( - leading: Icon(Icons.content_copy), - title: Text('Copy'))), + // SimpleDialogOption( + // onPressed: () { + // Navigator.pop(context); + // model.copyFile(path); + // }, + // child: ListTile( + // leading: Icon(Icons.content_copy), + // title: Text('Copy'))), SimpleDialogOption( onPressed: () { diff --git a/lib/views/popup_menu.dart b/lib/views/popup_menu.dart index df2ea79..bc6ccf6 100644 --- a/lib/views/popup_menu.dart +++ b/lib/views/popup_menu.dart @@ -42,10 +42,10 @@ class AppBarPopupMenu extends StatelessWidget { //... }, itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - enabled: model.copyList.isNotEmpty, - value: 'paste', - child: Text('Paste Here')), + // PopupMenuItem( + // enabled: model.copyList.isNotEmpty, + // value: 'paste', + // child: Text('Paste Here')), const PopupMenuItem( value: 'refresh', child: Text('Refresh')), diff --git a/pubspec.lock b/pubspec.lock index fc90a7a..b39bec5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -219,6 +219,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" + progress_dialog: + dependency: "direct main" + description: + name: progress_dialog + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" provider: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 21051d3..354939b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,6 +38,7 @@ dependencies: esys_flutter_share: ^1.0.2 mime_type: ^0.2.4 flutter_launcher_icons: ^0.7.4 + progress_dialog: ^1.2.1 # The following adds the Cupertino Icons font to your application. @@ -76,6 +77,10 @@ flutter: - assets/musicicon.png - assets/videoicon.png - assets/duplicateicon.png + - assets/doc.jpeg + - assets/image.jpeg + - assets/music1.jpeg + - assets/video.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.