A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

part of '../neon_files.dart';
3 years ago
class FilesMainPage extends StatefulWidget {
const FilesMainPage({
required this.bloc,
super.key,
});
final FilesBloc bloc;
@override
State<FilesMainPage> createState() => _FilesMainPageState();
}
class _FilesMainPageState extends State<FilesMainPage> {
@override
void initState() {
super.initState();
widget.bloc.errors.listen((final error) {
NeonException.showSnackbar(context, error);
3 years ago
});
}
@override
Widget build(final BuildContext context) => FilesBrowserView(
3 years ago
bloc: widget.bloc.browser,
filesBloc: widget.bloc,
onPickFile: (final details) async {
final sizeWarning = widget.bloc.options.downloadSizeWarning.value;
if (sizeWarning != null && details.size > sizeWarning) {
// ignore: use_build_context_synchronously
if (!(await showConfirmationDialog(
context,
// ignore: use_build_context_synchronously
AppLocalizations.of(context).filesConfirmDownloadSizeWarning(
filesize(sizeWarning),
filesize(details.size),
),
))) {
return;
}
}
3 years ago
widget.bloc.openFile(details.path, details.etag!, details.mimeType);
},
);
}