BottomActionBar : unselect all & close BottomActionBar on cancel

This commit is contained in:
ashilkn 2022-11-30 12:29:26 +05:30
parent 392b548622
commit 5dcc92fadb
2 changed files with 15 additions and 6 deletions

View file

@ -15,12 +15,14 @@ class BottomActionBarWidget extends StatefulWidget {
final Widget expandedMenu;
final bool showBottomActionBarByDefault;
final SelectedFiles? selectedFiles;
final VoidCallback? onCancel;
const BottomActionBarWidget({
required this.expandedMenu,
required this.showBottomActionBarByDefault,
this.selectedFiles,
this.text,
this.iconButtons,
this.onCancel,
super.key,
});
@ -55,12 +57,13 @@ class _BottomActionBarWidgetState extends State<BottomActionBarWidget> {
filter: ImageFilter.blur(sigmaX: blurBase, sigmaY: blurBase),
child: Container(
color: colorScheme.backdropBase,
padding: EdgeInsets.only(
padding: const EdgeInsets.only(
top: 4,
bottom: !_expandableController.expanded &&
((widget.selectedFiles?.files.isNotEmpty) ?? false)
? 24
: 36,
// bottom: !_expandableController.expanded &&
// ((widget.selectedFiles?.files.isNotEmpty) ?? false)
// ? 24
// : 36,
bottom: 24,
),
child: Column(
mainAxisSize: MainAxisSize.min,
@ -87,6 +90,7 @@ class _BottomActionBarWidgetState extends State<BottomActionBarWidget> {
onTap: () {
//unselect all files here
//or collapse the expansion panel
widget.onCancel?.call();
_expandableController.value = false;
},
child: Container(

View file

@ -116,12 +116,17 @@ class _CollectionPageState extends State<CollectionPage> {
bottom: _bottomPosition.value,
right: 0,
left: 0,
duration: const Duration(milliseconds: 200),
duration: const Duration(milliseconds: 400),
child: BottomActionBarWidget(
selectedFiles: _selectedFiles,
showBottomActionBarByDefault: false,
expandedMenu: const SizedBox(height: 150),
text: "3 selected",
onCancel: () {
if (_selectedFiles.files.isNotEmpty) {
_selectedFiles.clearAll();
}
},
iconButtons: const [
IconButtonWidget(
icon: Icons.delete_outlined,