bottom_action_bar_widget.dart 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/core/constants.dart';
  3. import "package:photos/models/collection.dart";
  4. import "package:photos/models/gallery_type.dart";
  5. import 'package:photos/models/selected_files.dart';
  6. import 'package:photos/theme/ente_theme.dart';
  7. import 'package:photos/ui/components/bottom_action_bar/action_bar_widget.dart';
  8. import "package:photos/ui/components/divider_widget.dart";
  9. import "package:photos/ui/viewer/actions/file_selection_actions_widget.dart";
  10. class BottomActionBarWidget extends StatelessWidget {
  11. final GalleryType galleryType;
  12. final Collection? collection;
  13. final SelectedFiles selectedFiles;
  14. final VoidCallback? onCancel;
  15. final Color? backgroundColor;
  16. const BottomActionBarWidget({
  17. required this.galleryType,
  18. required this.selectedFiles,
  19. this.collection,
  20. this.onCancel,
  21. this.backgroundColor,
  22. super.key,
  23. });
  24. @override
  25. Widget build(BuildContext context) {
  26. final bottomPadding = MediaQuery.of(context).padding.bottom;
  27. final widthOfScreen = MediaQuery.of(context).size.width;
  28. final colorScheme = getEnteColorScheme(context);
  29. final double leftRightPadding = widthOfScreen > restrictedMaxWidth
  30. ? (widthOfScreen - restrictedMaxWidth) / 2
  31. : 0;
  32. return Container(
  33. decoration: BoxDecoration(
  34. color: backgroundColor ?? colorScheme.backgroundElevated2,
  35. borderRadius: const BorderRadius.only(
  36. topLeft: Radius.circular(8),
  37. topRight: Radius.circular(8),
  38. ),
  39. ),
  40. padding: EdgeInsets.only(
  41. top: 4,
  42. bottom: bottomPadding,
  43. right: leftRightPadding,
  44. left: leftRightPadding,
  45. ),
  46. child: Column(
  47. mainAxisSize: MainAxisSize.min,
  48. children: [
  49. const SizedBox(height: 12),
  50. FileSelectionActionsWidget(
  51. galleryType,
  52. selectedFiles,
  53. collection: collection,
  54. ),
  55. const SizedBox(height: 20),
  56. const DividerWidget(dividerType: DividerType.bottomBar),
  57. ActionBarWidget(
  58. selectedFiles: selectedFiles,
  59. onCancel: onCancel,
  60. ),
  61. // const SizedBox(height: 2)
  62. ],
  63. ),
  64. );
  65. }
  66. }