Skip to content

Commit

Permalink
Merge pull request #23 from Hardik0307/mahendra_controller
Browse files Browse the repository at this point in the history
Mahendra controller
  • Loading branch information
Hardik0307 committed Mar 15, 2020
2 parents bb95810 + 0c5b4bf commit d8718ee
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 138 deletions.
Binary file added assets/doc.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/music1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/video.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 15 additions & 21 deletions lib/displays/audios_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class _AudioDisplayScreenState extends State<AudioDisplayScreen>
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: <Widget>[
IconButton(
// Go home
Expand Down Expand Up @@ -100,30 +100,24 @@ class _AudioDisplayScreenState extends State<AudioDisplayScreen>
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));
Expand All @@ -136,7 +130,7 @@ class _AudioDisplayScreenState extends State<AudioDisplayScreen>
name: snapshot.data[index].name,
));
},
);
));
}
}
return Container();
Expand Down
18 changes: 2 additions & 16 deletions lib/displays/category_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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: <Widget>[
Card(
Expand Down
36 changes: 16 additions & 20 deletions lib/displays/docs_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ class _DocsDisplayScreenState extends State<DocsDisplayScreen>
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: <Widget>[
IconButton(
// Go home
Expand Down Expand Up @@ -101,15 +101,7 @@ class _DocsDisplayScreenState extends State<DocsDisplayScreen>
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) {
Expand All @@ -132,8 +124,12 @@ class _DocsDisplayScreenState extends State<DocsDisplayScreen>
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));
Expand All @@ -146,7 +142,7 @@ class _DocsDisplayScreenState extends State<DocsDisplayScreen>
name: snapshot.data[index].name,
));
},
);
));
}
}
return Container();
Expand Down
16 changes: 5 additions & 11 deletions lib/displays/duplicate_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class _DuplicateFileDisplayScreenState extends State<DuplicateFileDisplayScreen>

@override
Widget build(BuildContext context) {
super.build(context);
super.build(context);
final preferences = Provider.of<PreferencesNotifier>(context);
var coreNotifier = Provider.of<CoreNotifier>(context);
//var list1 = new List<String>();
Expand All @@ -149,14 +149,7 @@ class _DuplicateFileDisplayScreenState extends State<DuplicateFileDisplayScreen>
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: <Widget>[
IconButton(
// Go home
Expand Down Expand Up @@ -204,7 +197,8 @@ class _DuplicateFileDisplayScreenState extends State<DuplicateFileDisplayScreen>
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: () {
Expand All @@ -219,7 +213,7 @@ class _DuplicateFileDisplayScreenState extends State<DuplicateFileDisplayScreen>
name: snapshot1.data[index].name,
));
},
);
));
},
);

Expand Down
36 changes: 19 additions & 17 deletions lib/displays/folder_display.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// framework
import 'package:file_explorer/views/create_folder_dialog.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -30,17 +29,22 @@ 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<FolderListScreen>
with AutomaticKeepAliveClientMixin {
ScrollController _scrollController;
@override
void initState() {


_scrollController = ScrollController(keepScrollOffset: true);
super.initState();
}
String path;
_FolderListScreenState({this.path});


@override
void dispose() {
Expand All @@ -55,28 +59,25 @@ class _FolderListScreenState extends State<FolderListScreen>
var coreNotifier = Provider.of<CoreNotifier>(context);

return Scaffold(
drawer: new Drawer(
drawer:this.path=='/storage/emulated/0/'? new Drawer(
child: new ListView(
children: <Widget>[
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(
leading: Image.asset('assets/imgicon.png'),
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(
Expand All @@ -88,7 +89,7 @@ class _FolderListScreenState extends State<FolderListScreen>
context,
MaterialPageRoute(
builder: (context) =>
AudioDisplayScreen(path: '/storage/emulated/0/')));
AudioDisplayScreen(path: this.path)));
},
),
new ListTile(
Expand All @@ -100,7 +101,7 @@ class _FolderListScreenState extends State<FolderListScreen>
context,
MaterialPageRoute(
builder: (context) =>
DocsDisplayScreen(path: '/storage/emulated/0/')));
DocsDisplayScreen(path:this.path)));
},
),
new ListTile(
Expand All @@ -112,7 +113,7 @@ class _FolderListScreenState extends State<FolderListScreen>
context,
MaterialPageRoute(
builder: (context) =>
VIdeoDisplayScreen(path: '/storage/emulated/0/')));
VIdeoDisplayScreen(path:this.path)));
},
),
new ListTile(
Expand All @@ -124,18 +125,19 @@ class _FolderListScreenState extends State<FolderListScreen>
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: <Widget>[
IconButton(
// Go home
Expand Down
29 changes: 8 additions & 21 deletions lib/displays/images_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,14 @@ class _ImageDisplayScreenState extends State<ImageDisplayScreen>
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: <Widget>[
IconButton(
// Go home
onPressed: () {
Navigator.popUntil(
context, ModalRoute.withName(Navigator.defaultRouteName));
// Navigator.pop(context);
},
icon: Icon(Icons.home),
),
Expand Down Expand Up @@ -101,15 +95,7 @@ class _ImageDisplayScreenState extends State<ImageDisplayScreen>
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);
Expand All @@ -125,8 +111,9 @@ class _ImageDisplayScreenState extends State<ImageDisplayScreen>
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));
Expand All @@ -139,10 +126,10 @@ class _ImageDisplayScreenState extends State<ImageDisplayScreen>
name: snapshot.data[index].name,
));
},
);
));
}

return Container();
return Container();
});
} else {
return Center(
Expand Down
Loading

0 comments on commit d8718ee

Please sign in to comment.