Skip to content

Commit

Permalink
Implement share functionallity
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k committed Apr 22, 2024
1 parent 5fb069d commit cabe6a8
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 44 deletions.
88 changes: 72 additions & 16 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"common_tomorrow": "Tomorrow",

"common_info":"Info",
"common_share":"Share",
"common_upload":"Upload",
"common_download":"Download",
"common_delete": "Delete",
Expand Down
8 changes: 7 additions & 1 deletion app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ PODS:
- Flutter
- FlutterMacOS
- PromisesObjC (2.4.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand All @@ -72,6 +74,7 @@ DEPENDENCIES:
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
Expand Down Expand Up @@ -106,6 +109,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
photo_manager:
:path: ".symlinks/plugins/photo_manager/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
Expand All @@ -126,11 +131,12 @@ SPEC CHECKSUMS:
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
GTMSessionFetcher: 8a1b34ad97ebe6f909fb8b9b77fba99943007556
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: 036b856153a2b1f61f21030ff725f3e6fece2b78
photo_manager: 4f6810b7dfc4feb03b461ac1a70dacf91fba7604
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
Expand Down
38 changes: 34 additions & 4 deletions app/lib/ui/flow/home/components/multi_selection_done_button.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:io';
import 'package:cloud_gallery/components/app_dialog.dart';
import 'package:cloud_gallery/domain/extensions/context_extensions.dart';
import 'package:cloud_gallery/ui/flow/home/home_screen_view_model.dart';
Expand All @@ -8,6 +9,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
import 'package:style/extensions/context_extensions.dart';
import '../../../../components/action_sheet.dart';
import '../../../../components/app_sheet.dart';
Expand All @@ -28,9 +30,10 @@ class MultiSelectionDoneButton extends ConsumerWidget {
.any((element) => element.sources.contains(AppMediaSource.local));
final bool showUploadToDriveButton = selectedMedias.any(
(element) => !element.sources.contains(AppMediaSource.googleDrive));

final bool showDownloadButton =
selectedMedias.any((element) => element.isGoogleDriveStored);
final bool showShareButton =
selectedMedias.any((element) => element.isLocalStored);

return FloatingActionButton(
elevation: 3,
Expand Down Expand Up @@ -98,9 +101,20 @@ class MultiSelectionDoneButton extends ConsumerWidget {
),
if (showDeleteFromDriveButton)
AppSheetAction(
icon: const Icon(
CupertinoIcons.delete,
size: 24,
icon: Stack(
alignment: Alignment.bottomRight,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 2, right: 2),
child: Icon(CupertinoIcons.trash,
color: context.colorScheme.textSecondary, size: 22),
),
SvgPicture.asset(
Assets.images.icons.googleDrive,
width: 14,
height: 14,
),
],
),
title: context.l10n.common_delete_from_google_drive,
onPressed: () {
Expand Down Expand Up @@ -160,6 +174,22 @@ class MultiSelectionDoneButton extends ConsumerWidget {
);
},
),
if (showShareButton)
AppSheetAction(
icon: Icon(
Platform.isIOS ? CupertinoIcons.share : Icons.share_rounded,
color: context.colorScheme.textSecondary,
size: 24,
),
title: context.l10n.common_share,
onPressed: () {
Share.shareXFiles(selectedMedias
.where((element) => element.isLocalStored)
.map((e) => XFile(e.path))
.toList());
context.pop();
},
),
],
),
);
Expand Down
Loading

0 comments on commit cabe6a8

Please sign in to comment.