Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paintroid-450 : Add share menu option in paint view #49

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ PODS:
- SDWebImage (5.13.1):
- SDWebImage/Core (= 5.13.1)
- SDWebImage/Core (5.13.1)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand All @@ -78,6 +80,7 @@ DEPENDENCIES:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
Expand Down Expand Up @@ -111,6 +114,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
Expand All @@ -133,11 +138,12 @@ SPEC CHECKSUMS:
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
SDWebImage: fb26a455eeda4c7a55e4dcb6172dbb258af7a4ca
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: a62623f56f2d1d0e85a4a3c73509cd2832d5c86f

COCOAPODS: 1.14.3
COCOAPODS: 1.15.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import 'package:l10n/l10n.dart';
import 'package:oxidized/oxidized.dart';
import 'package:toast/toast.dart';
import 'package:workspace_screen/workspace_screen.dart';
import 'package:share_plus/share_plus.dart';

enum OverflowMenuOption {
fullscreen,
saveImage,
saveProject,
loadImage,
newImage;
newImage,
share;

String localizedLabel(BuildContext context) {
final localizations = AppLocalizations.of(context);
Expand All @@ -28,6 +30,8 @@ enum OverflowMenuOption {
return localizations.newImage;
case OverflowMenuOption.saveProject:
return localizations.saveProject;
case OverflowMenuOption.share:
return localizations.share;
}
}
}
Expand Down Expand Up @@ -75,6 +79,9 @@ class _OverflowMenuState extends ConsumerState<OverflowMenu> {
case OverflowMenuOption.newImage:
ioHandler.newImage(context, this);
break;
case OverflowMenuOption.share:
_shareContent();
break;
}
}

Expand Down Expand Up @@ -132,6 +139,10 @@ class _OverflowMenuState extends ConsumerState<OverflowMenu> {
return true;
}

void _shareContent() {
Share.share('Check out this great app!');
Lenkomotive marked this conversation as resolved.
Show resolved Hide resolved
}

Future<void> _saveProject() async {
final imageData = await showSaveImageDialog(context, true);

Expand Down
1 change: 1 addition & 0 deletions packages/features/workspace_screen/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
toast: ^0.3.0
image: ^3.2.0
oxidized: ^5.2.0
share_plus: ^7.2.2

# Internal packages
component_library:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,25 @@ void main() {
expect(overflowMenuButtonFinder, findsOneWidget);
});

testWidgets('Tapping share option maintains UI stability',
(WidgetTester tester) async {
await tester.pumpWidget(sut);

await tester.tap(find.byIcon(Icons.more_vert));
await tester.pumpAndSettle(); // Wait for the menu to open
vishad-tyagi marked this conversation as resolved.
Show resolved Hide resolved

final initialWidgetTree = tester.widgetList(find.byType(Widget)).toString();

final shareOptionFinder = find.text('Share');
await tester.ensureVisible(shareOptionFinder);
await tester.tap(shareOptionFinder);
await tester.pumpAndSettle();

final updatedWidgetTree = tester.widgetList(find.byType(Widget)).toString();

expect(updatedWidgetTree, initialWidgetTree);
});

group('Fullscreen functionality', () {
late WorkspaceState testWorkspaceState;
late FakeCommandManager fakeCommandManager;
Expand Down
2 changes: 2 additions & 0 deletions packages/l10n/lib/src/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Layers'**
String get layers;

String get share;
}

class _AppLocalizationsDelegate
Expand Down
3 changes: 3 additions & 0 deletions packages/l10n/lib/src/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get saveProject => 'Save project';

@override
String get share => 'Share';

@override
String get tools => 'Tools';

Expand Down
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.27.7"
share_plus:
dependency: transitive
description:
name: share_plus
sha256: "3ef39599b00059db0990ca2e30fca0a29d8b37aae924d60063f8e0184cf20900"
url: "https://pub.dev"
source: hosted
version: "7.2.2"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: df08bc3a07d01f5ea47b45d03ffcba1fa9cd5370fb44b3f38c70e42cced0f956
url: "https://pub.dev"
source: hosted
version: "3.3.1"
shared_preferences:
dependency: "direct main"
description:
Expand Down
Loading