control_bottom_app_bar.dart 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. class ControlBottomAppBar extends ConsumerWidget {
  6. final Function onShare;
  7. final Function onDelete;
  8. const ControlBottomAppBar(
  9. {Key? key, required this.onShare, required this.onDelete})
  10. : super(key: key);
  11. @override
  12. Widget build(BuildContext context, WidgetRef ref) {
  13. return Positioned(
  14. bottom: 0,
  15. left: 0,
  16. child: Container(
  17. width: MediaQuery.of(context).size.width,
  18. height: MediaQuery.of(context).size.height * 0.15,
  19. decoration: BoxDecoration(
  20. borderRadius: const BorderRadius.only(
  21. topLeft: Radius.circular(8),
  22. topRight: Radius.circular(8),
  23. ),
  24. color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.95),
  25. ),
  26. child: Column(
  27. children: [
  28. Padding(
  29. padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
  30. child: Row(
  31. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  32. children: [
  33. ControlBoxButton(
  34. iconData: Icons.delete_forever_rounded,
  35. label: "control_bottom_app_bar_delete".tr(),
  36. onPressed: () {
  37. showDialog(
  38. context: context,
  39. builder: (BuildContext context) {
  40. return DeleteDialog(
  41. onDelete: onDelete,
  42. );
  43. },
  44. );
  45. },
  46. ),
  47. ControlBoxButton(
  48. iconData: Icons.share,
  49. label: "control_bottom_app_bar_share".tr(),
  50. onPressed: () {
  51. onShare();
  52. },
  53. ),
  54. ],
  55. ),
  56. )
  57. ],
  58. ),
  59. ),
  60. );
  61. }
  62. }
  63. class ControlBoxButton extends StatelessWidget {
  64. const ControlBoxButton({
  65. Key? key,
  66. required this.label,
  67. required this.iconData,
  68. required this.onPressed,
  69. }) : super(key: key);
  70. final String label;
  71. final IconData iconData;
  72. final Function onPressed;
  73. @override
  74. Widget build(BuildContext context) {
  75. return SizedBox(
  76. width: 60,
  77. child: Column(
  78. mainAxisAlignment: MainAxisAlignment.start,
  79. crossAxisAlignment: CrossAxisAlignment.center,
  80. children: [
  81. IconButton(
  82. onPressed: () {
  83. onPressed();
  84. },
  85. icon: Icon(iconData, size: 30),
  86. ),
  87. Text(label)
  88. ],
  89. ),
  90. );
  91. }
  92. }