From 608d65661690c583cccb625f182a95cc386b3954 Mon Sep 17 00:00:00 2001 From: Nikhil Raj <112814295+gantanikhilraj@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:43:03 +0530 Subject: [PATCH 1/2] Added share with friends option (#37) * added share with friends option --- lib/core/pages/settings_page.dart | 3 ++ lib/core/widgets/share_with_friends.dart | 36 ++++++++++++++++++++++++ pubspec.yaml | 1 + 3 files changed, 40 insertions(+) create mode 100644 lib/core/widgets/share_with_friends.dart diff --git a/lib/core/pages/settings_page.dart b/lib/core/pages/settings_page.dart index cc9992e5..5d205249 100644 --- a/lib/core/pages/settings_page.dart +++ b/lib/core/pages/settings_page.dart @@ -3,6 +3,7 @@ import 'package:dairy_app/app/themes/theme_extensions/note_create_page_theme_ext import 'package:dairy_app/core/widgets/glass_app_bar.dart'; import 'package:dairy_app/core/widgets/glassmorphism_cover.dart'; import 'package:dairy_app/core/widgets/logout_button.dart'; +import 'package:dairy_app/core/widgets/share_with_friends.dart'; import 'package:dairy_app/core/widgets/theme_dropdown.dart'; import 'package:dairy_app/core/widgets/version_number.dart'; import 'package:dairy_app/features/auth/presentation/bloc/auth_session/auth_session_bloc.dart'; @@ -123,6 +124,8 @@ class _SettingsPageState extends State { const SizedBox(height: 15), const ThemeDropdown(), const SizedBox(height: 15), + const ShareWithFriends(), + const SizedBox(height: 15), const VersionNumber(), ], ), diff --git a/lib/core/widgets/share_with_friends.dart b/lib/core/widgets/share_with_friends.dart new file mode 100644 index 00000000..6f8fb71b --- /dev/null +++ b/lib/core/widgets/share_with_friends.dart @@ -0,0 +1,36 @@ +import 'package:dairy_app/app/themes/theme_extensions/note_create_page_theme_extensions.dart'; +import 'package:flutter/material.dart'; +import 'package:share_plus/share_plus.dart'; + +class ShareWithFriends extends StatelessWidget { + const ShareWithFriends({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final mainTextStyle = TextStyle( + fontSize: 16.0, + color: Theme.of(context) + .extension()! + .mainTextColor, + ); + const appDescription = + "Discover diaryVault - a diary app designed to help you capture your thoughts, memories, and moments effortlessly. Available now on the Play Store!"; + return GestureDetector( + onTap: (() async { + try { + const playstoreURL = + 'https://play.google.com/store/apps/details?id=me.sankethbk.dairyapp'; + await Share.share('$appDescription\n\n$playstoreURL'); + } catch (e) { + throw Exception( + "Error sharing app", + ); + } + }), + child: Text( + "Share with Friends", + style: mainTextStyle, + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index e0463ecc..457767e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: provider: ^6.0.5 shared_preferences: ^2.0.15 sqflite: ^2.0.2 + share_plus: ^7.1.0 stateless_dropbox_client: path: ./packages/stateless_dropbox_client/ url_launcher: ^6.1.14 From ef7b71ed19a0feec150363ce95aba04cbc4969f8 Mon Sep 17 00:00:00 2001 From: Akshatha Sathish Date: Mon, 2 Oct 2023 11:35:14 +0530 Subject: [PATCH 2/2] Show send feedback button in the settings page. (#41) --- lib/core/pages/settings_page.dart | 4 ++ lib/core/widgets/send_feedback.dart | 44 +++++++++++++++++++ lib/core/widgets/share_with_friends.dart | 10 +++-- lib/core/widgets/version_number.dart | 27 +++++++----- pubspec.lock | 16 +++++++ pubspec.yaml | 4 +- .../flutter/generated_plugin_registrant.cc | 6 +-- windows/flutter/generated_plugins.cmake | 2 +- 8 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 lib/core/widgets/send_feedback.dart diff --git a/lib/core/pages/settings_page.dart b/lib/core/pages/settings_page.dart index 5d205249..09f3d7a5 100644 --- a/lib/core/pages/settings_page.dart +++ b/lib/core/pages/settings_page.dart @@ -3,6 +3,7 @@ import 'package:dairy_app/app/themes/theme_extensions/note_create_page_theme_ext import 'package:dairy_app/core/widgets/glass_app_bar.dart'; import 'package:dairy_app/core/widgets/glassmorphism_cover.dart'; import 'package:dairy_app/core/widgets/logout_button.dart'; +import 'package:dairy_app/core/widgets/send_feedback.dart'; import 'package:dairy_app/core/widgets/share_with_friends.dart'; import 'package:dairy_app/core/widgets/theme_dropdown.dart'; import 'package:dairy_app/core/widgets/version_number.dart'; @@ -10,6 +11,7 @@ import 'package:dairy_app/features/auth/presentation/bloc/auth_session/auth_sess import 'package:dairy_app/features/auth/presentation/widgets/security_settings.dart'; import 'package:dairy_app/features/auth/presentation/widgets/setup_account.dart'; import 'package:dairy_app/features/sync/presentation/widgets/sync_settings.dart'; + import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -124,6 +126,8 @@ class _SettingsPageState extends State { const SizedBox(height: 15), const ThemeDropdown(), const SizedBox(height: 15), + const SendFeedBack(), + const SizedBox(height: 15), const ShareWithFriends(), const SizedBox(height: 15), const VersionNumber(), diff --git a/lib/core/widgets/send_feedback.dart b/lib/core/widgets/send_feedback.dart new file mode 100644 index 00000000..611dbb16 --- /dev/null +++ b/lib/core/widgets/send_feedback.dart @@ -0,0 +1,44 @@ +import 'package:dairy_app/app/themes/theme_extensions/note_create_page_theme_extensions.dart'; + +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class SendFeedBack extends StatelessWidget { + const SendFeedBack({Key? key}) : super(key: key); + + final emailAddress = 'diaryvault.app@gmail.com'; + final subject = 'Feedback for DiaryVault'; + + @override + Widget build(BuildContext context) => InkWell( + onTap: _launchEmailApp, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 6.0), + child: Text( + "Send feedback", + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context) + .extension()! + .mainTextColor, + ), + ), + ), + ); + + void _launchEmailApp() async { + try { + final Uri emailLaunchUri = Uri( + scheme: 'mailto', + path: emailAddress, + queryParameters: {'subject': subject}, + ); + + await launchUrl(emailLaunchUri); + } catch (e) { + throw Exception( + "Error sending feed-back", + ); + } + } +} diff --git a/lib/core/widgets/share_with_friends.dart b/lib/core/widgets/share_with_friends.dart index 6f8fb71b..f9dc15fb 100644 --- a/lib/core/widgets/share_with_friends.dart +++ b/lib/core/widgets/share_with_friends.dart @@ -15,6 +15,7 @@ class ShareWithFriends extends StatelessWidget { ); const appDescription = "Discover diaryVault - a diary app designed to help you capture your thoughts, memories, and moments effortlessly. Available now on the Play Store!"; + return GestureDetector( onTap: (() async { try { @@ -27,9 +28,12 @@ class ShareWithFriends extends StatelessWidget { ); } }), - child: Text( - "Share with Friends", - style: mainTextStyle, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 6.0), + child: Text( + "Share with Friends", + style: mainTextStyle, + ), ), ); } diff --git a/lib/core/widgets/version_number.dart b/lib/core/widgets/version_number.dart index 02bc5f4a..eb21e6ba 100644 --- a/lib/core/widgets/version_number.dart +++ b/lib/core/widgets/version_number.dart @@ -19,18 +19,21 @@ class VersionNumber extends StatelessWidget { builder: (context, snapshot) { final version = snapshot.data?.version ?? ''; - return Row( - children: [ - Text( - "App version", - style: mainTextStyle, - ), - const Spacer(), - Text( - version, - style: mainTextStyle, - ), - ], + return Padding( + padding: const EdgeInsets.symmetric(vertical: 6.0), + child: Row( + children: [ + Text( + "App version", + style: mainTextStyle, + ), + const Spacer(), + Text( + version, + style: mainTextStyle, + ), + ], + ), ); }, ); diff --git a/pubspec.lock b/pubspec.lock index 34063799..118e2a14 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1235,6 +1235,22 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.1" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11" + url: "https://pub.dev" + source: hosted + version: "7.1.0" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" + url: "https://pub.dev" + source: hosted + version: "3.3.0" shared_preferences: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 457767e5..cc771698 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,9 +58,9 @@ dependencies: package_info_plus: ^4.1.0 path_provider: ^2.0.9 provider: ^6.0.5 + share_plus: ^7.1.0 shared_preferences: ^2.0.15 sqflite: ^2.0.2 - share_plus: ^7.1.0 stateless_dropbox_client: path: ./packages/stateless_dropbox_client/ url_launcher: ^6.1.14 @@ -87,7 +87,7 @@ dev_dependencies: # android_12: # image: 'assets/images/splash_screen.png' dependency_overrides: - analyzer: + ? analyzer # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index e5b74eb4..75a4aa05 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,19 +7,17 @@ #include "generated_plugin_registrant.h" #include -#include #include #include #include #include +#include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); - FirebaseAuthPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( @@ -28,6 +26,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("LocalAuthPlugin")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); WindowToFrontPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index c56f205b..2554574d 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,11 +4,11 @@ list(APPEND FLUTTER_PLUGIN_LIST file_selector_windows - firebase_auth firebase_core flutter_secure_storage_windows local_auth_windows pasteboard + share_plus url_launcher_windows window_to_front )