فهرست منبع

add functionality to share icon in BottomActionBar

ashilkn 2 سال پیش
والد
کامیت
06718f766c
1فایلهای تغییر یافته به همراه12 افزوده شده و 1 حذف شده
  1. 12 1
      lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart

+ 12 - 1
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();
   }