|
|
@ -4,27 +4,25 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart |
|
|
|
import 'package:neon/widgets.dart'; |
|
|
|
import 'package:neon/widgets.dart'; |
|
|
|
import 'package:neon_files/neon_files.dart'; |
|
|
|
import 'package:neon_files/neon_files.dart'; |
|
|
|
import 'package:neon_files/widgets/actions.dart'; |
|
|
|
import 'package:neon_files/widgets/actions.dart'; |
|
|
|
import 'package:provider/provider.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FileListTile extends StatelessWidget { |
|
|
|
class FileListTile extends StatelessWidget { |
|
|
|
const FileListTile({ |
|
|
|
const FileListTile({ |
|
|
|
required this.context, |
|
|
|
required this.bloc, |
|
|
|
|
|
|
|
required this.browserBloc, |
|
|
|
required this.details, |
|
|
|
required this.details, |
|
|
|
this.enableFileActions = true, |
|
|
|
this.enableFileActions = true, |
|
|
|
this.onPickFile, |
|
|
|
this.onPickFile, |
|
|
|
super.key, |
|
|
|
super.key, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
final BuildContext context; |
|
|
|
final FilesBloc bloc; |
|
|
|
|
|
|
|
final FilesBrowserBloc browserBloc; |
|
|
|
final FileDetails details; |
|
|
|
final FileDetails details; |
|
|
|
final bool enableFileActions; |
|
|
|
final bool enableFileActions; |
|
|
|
final Function(FileDetails)? onPickFile; |
|
|
|
final Function(FileDetails)? onPickFile; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
final bloc = Provider.of<FilesBloc>(context); |
|
|
|
|
|
|
|
final browserBloc = bloc.browser; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// When the ETag is null it means we are uploading this file right now |
|
|
|
// When the ETag is null it means we are uploading this file right now |
|
|
|
final onTap = details.isDirectory || details.etag != null |
|
|
|
final onTap = details.isDirectory || details.etag != null |
|
|
|
? () { |
|
|
|
? () { |
|
|
@ -63,6 +61,7 @@ class FileListTile extends StatelessWidget { |
|
|
|
), |
|
|
|
), |
|
|
|
leading: _FileIcon( |
|
|
|
leading: _FileIcon( |
|
|
|
details: details, |
|
|
|
details: details, |
|
|
|
|
|
|
|
bloc: bloc, |
|
|
|
), |
|
|
|
), |
|
|
|
trailing: !details.hasTask && enableFileActions |
|
|
|
trailing: !details.hasTask && enableFileActions |
|
|
|
? FileActions(details: details) |
|
|
|
? FileActions(details: details) |
|
|
@ -76,14 +75,14 @@ class FileListTile extends StatelessWidget { |
|
|
|
class _FileIcon extends StatelessWidget { |
|
|
|
class _FileIcon extends StatelessWidget { |
|
|
|
const _FileIcon({ |
|
|
|
const _FileIcon({ |
|
|
|
required this.details, |
|
|
|
required this.details, |
|
|
|
|
|
|
|
required this.bloc, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
final FileDetails details; |
|
|
|
final FileDetails details; |
|
|
|
|
|
|
|
final FilesBloc bloc; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
final bloc = Provider.of<FilesBloc>(context); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget icon = Center( |
|
|
|
Widget icon = Center( |
|
|
|
child: details.hasTask |
|
|
|
child: details.hasTask |
|
|
|
? StreamBuilder<double>( |
|
|
|
? StreamBuilder<double>( |
|
|
|