control_bottom_app_bar.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import 'package:easy_localization/easy_localization.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:hooks_riverpod/hooks_riverpod.dart';
  4. import 'package:immich_mobile/modules/home/ui/delete_diaglog.dart';
  5. import '../../../shared/providers/asset.provider.dart';
  6. import '../providers/home_page_state.provider.dart';
  7. class ControlBottomAppBar extends ConsumerWidget {
  8. const ControlBottomAppBar({Key? key}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context, WidgetRef ref) {
  11. return Positioned(
  12. bottom: 0,
  13. left: 0,
  14. child: Container(
  15. width: MediaQuery.of(context).size.width,
  16. height: MediaQuery.of(context).size.height * 0.15,
  17. decoration: BoxDecoration(
  18. borderRadius: const BorderRadius.only(
  19. topLeft: Radius.circular(15),
  20. topRight: Radius.circular(15),
  21. ),
  22. color: Colors.grey[300]?.withOpacity(0.98),
  23. ),
  24. child: Column(
  25. children: [
  26. Padding(
  27. padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
  28. child: Row(
  29. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  30. children: [
  31. ControlBoxButton(
  32. iconData: Icons.delete_forever_rounded,
  33. label: "control_bottom_app_bar_delete".tr(),
  34. onPressed: () {
  35. showDialog(
  36. context: context,
  37. builder: (BuildContext context) {
  38. return const DeleteDialog();
  39. },
  40. );
  41. },
  42. ),
  43. ControlBoxButton(
  44. iconData: Icons.share,
  45. label: "control_bottom_app_bar_share".tr(),
  46. onPressed: () {
  47. final homePageState = ref.watch(homePageStateProvider);
  48. ref.watch(homePageStateProvider.notifier).shareAssets(
  49. homePageState.selectedItems.toList(),
  50. context,
  51. );
  52. ref
  53. .watch(homePageStateProvider.notifier)
  54. .disableMultiSelect();
  55. },
  56. ),
  57. ],
  58. ),
  59. )
  60. ],
  61. ),
  62. ),
  63. );
  64. }
  65. }
  66. class ControlBoxButton extends StatelessWidget {
  67. const ControlBoxButton({
  68. Key? key,
  69. required this.label,
  70. required this.iconData,
  71. required this.onPressed,
  72. }) : super(key: key);
  73. final String label;
  74. final IconData iconData;
  75. final Function onPressed;
  76. @override
  77. Widget build(BuildContext context) {
  78. return SizedBox(
  79. width: 60,
  80. child: Column(
  81. mainAxisAlignment: MainAxisAlignment.start,
  82. crossAxisAlignment: CrossAxisAlignment.center,
  83. children: [
  84. IconButton(
  85. onPressed: () {
  86. onPressed();
  87. },
  88. icon: Icon(iconData, size: 30),
  89. ),
  90. Text(label)
  91. ],
  92. ),
  93. );
  94. }
  95. }