From 06718f766c1ea31864c2e92cd70e780cd30508a8 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Mon, 5 Dec 2022 13:46:26 +0530 Subject: [PATCH] add functionality to share icon in BottomActionBar --- .../bottom_action_bar/bottom_action_bar_widget.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart index 5ec1244fc..64c8b5ece 100644 --- a/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart +++ b/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart @@ -9,6 +9,7 @@ import 'package:photos/theme/ente_theme.dart'; import 'package:photos/ui/components/bottom_action_bar/action_bar_widget.dart'; import 'package:photos/ui/components/icon_button_widget.dart'; import 'package:photos/utils/delete_file_util.dart'; +import 'package:photos/utils/share_util.dart'; import 'package:photos/utils/toast_util.dart'; class BottomActionBarWidget extends StatelessWidget { @@ -17,6 +18,8 @@ class BottomActionBarWidget extends StatelessWidget { final Widget expandedMenu; final SelectedFiles? selectedFiles; final VoidCallback? onCancel; + final GlobalKey shareButtonKey = GlobalKey(); + BottomActionBarWidget({ required this.expandedMenu, this.selectedFiles, @@ -109,7 +112,7 @@ class BottomActionBarWidget extends StatelessWidget { IconButtonWidget( icon: Icons.ios_share_outlined, iconButtonType: IconButtonType.primary, - onTap: () {}, + onTap: () => _shareSelected(context), ), ExpansionIconWidget(expandableController: _expandableController) ]; @@ -213,6 +216,14 @@ class BottomActionBarWidget extends StatelessWidget { ); } + void _shareSelected(BuildContext context) { + share( + context, + selectedFiles!.files.toList(), + shareButtonKey: shareButtonKey, + ); + } + void _clearSelectedFiles() { selectedFiles!.clearAll(); }