WIP: File Browsing with Backbutton
This commit is contained in:
@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||
import 'package:marianum_mobile/screen/pages/files/files.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@ -16,8 +17,8 @@ import '../../../data/files/filesProps.dart';
|
||||
|
||||
class FileElement extends StatefulWidget {
|
||||
CacheableFile file;
|
||||
Function updateAppBar;
|
||||
FileElement(this.file, this.updateAppBar, {Key? key}) : super(key: key);
|
||||
List<String> path;
|
||||
FileElement(this.file, this.path, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FileElement> createState() => _FileElementState();
|
||||
@ -99,15 +100,20 @@ class _FileElementState extends State<FileElement> {
|
||||
subtitle: getSubtitle(),
|
||||
trailing: Icon(widget.file.isDirectory ? Icons.arrow_right : Icons.open_in_browser),
|
||||
onTap: () {
|
||||
FilesProps props = Provider.of<FilesProps>(context, listen: false);
|
||||
widget.updateAppBar(props);
|
||||
if(widget.file.isDirectory) {
|
||||
props.enterFolder(widget.file.name);
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Files(widget.path.toList()..add(widget.file.name));
|
||||
},
|
||||
));
|
||||
//props.enterFolder(widget.file.name);
|
||||
} else {
|
||||
setState(() {
|
||||
widget.file.currentlyDownloading = true;
|
||||
});
|
||||
|
||||
log("Download: ${widget.file.path} to ${widget.file.name}");
|
||||
|
||||
download(widget.file.path, widget.file.name);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user