diff --git a/packages/smooth_app/lib/data_models/preferences/user_preferences.dart b/packages/smooth_app/lib/data_models/preferences/user_preferences.dart index e80cbd9be8b..012fa624aec 100644 --- a/packages/smooth_app/lib/data_models/preferences/user_preferences.dart +++ b/packages/smooth_app/lib/data_models/preferences/user_preferences.dart @@ -75,6 +75,7 @@ class UserPreferences extends ChangeNotifier { static const String _TAG_DEV_MODE = 'devMode'; static const String _TAG_USER_TRACKING = 'user_tracking'; static const String _TAG_CRASH_REPORTS = 'crash_reports'; + static const String _TAG_PRICES_FEEDBACK_FORM = 'prices_feedback_form'; static const String _TAG_EXCLUDED_ATTRIBUTE_IDS = 'excluded_attributes'; static const String _TAG_USER_GROUP = '_user_group'; static const String _TAG_UNIQUE_RANDOM = '_unique_random'; @@ -203,6 +204,14 @@ class UserPreferences extends ChangeNotifier { bool get crashReports => _sharedPreferences.getBool(_TAG_CRASH_REPORTS) ?? false; + Future markPricesFeedbackFormAsCompleted() async { + await _sharedPreferences.setBool(_TAG_PRICES_FEEDBACK_FORM, false); + notifyListeners(); + } + + bool get shouldShowPricesFeedbackForm => + _sharedPreferences.getBool(_TAG_PRICES_FEEDBACK_FORM) ?? true; + String get currentTheme => _sharedPreferences.getString(_TAG_CURRENT_THEME_MODE) ?? THEME_SYSTEM_DEFAULT; diff --git a/packages/smooth_app/lib/l10n/app_en.arb b/packages/smooth_app/lib/l10n/app_en.arb index 61d06ebe8e5..72f4d0ceced 100644 --- a/packages/smooth_app/lib/l10n/app_en.arb +++ b/packages/smooth_app/lib/l10n/app_en.arb @@ -2952,5 +2952,9 @@ "preview_badge": "Preview", "@preview_badge": { "description": "Badge to indicate that the product is in preview mode (Be careful with this translation)" + }, + "prices_feedback_form": "Click here to send us your feedback about this new feature!", + "@prices_feedback_form": { + "description": "A button to send feedback about the prices feature" } } \ No newline at end of file diff --git a/packages/smooth_app/lib/pages/prices/prices_card.dart b/packages/smooth_app/lib/pages/prices/prices_card.dart index f4475c1e5d7..1337706f7c5 100644 --- a/packages/smooth_app/lib/pages/prices/prices_card.dart +++ b/packages/smooth_app/lib/pages/prices/prices_card.dart @@ -50,18 +50,18 @@ class PricesCard extends StatelessWidget { horizontal: MEDIUM_SPACE, vertical: VERY_SMALL_SPACE, ), - child: const Row( + child: Row( mainAxisSize: MainAxisSize.min, children: [ Text( - 'Preview', - style: TextStyle( + appLocalizations.preview_badge, + style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), ), - SizedBox(width: SMALL_SPACE), - Lab( + const SizedBox(width: SMALL_SPACE), + const Lab( color: Colors.white, size: 13.0, ), diff --git a/packages/smooth_app/lib/pages/prices/prices_page.dart b/packages/smooth_app/lib/pages/prices/prices_page.dart index c2f9ce579e2..20b68c7623c 100644 --- a/packages/smooth_app/lib/pages/prices/prices_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_page.dart @@ -1,9 +1,16 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import 'package:smooth_app/data_models/preferences/user_preferences.dart'; +import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/widgets/smooth_back_button.dart'; import 'package:smooth_app/helpers/launch_url_helper.dart'; +import 'package:smooth_app/helpers/provider_helper.dart'; import 'package:smooth_app/pages/prices/get_prices_model.dart'; import 'package:smooth_app/pages/prices/product_prices_list.dart'; +import 'package:smooth_app/resources/app_icons.dart'; +import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/widgets/smooth_app_bar.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; @@ -48,6 +55,98 @@ class PricesPage extends StatelessWidget { label: Text(appLocalizations.prices_add_a_price), icon: const Icon(Icons.add), ), + bottomNavigationBar: ConsumerFilter( + buildWhen: + (UserPreferences? previousValue, UserPreferences currentValue) => + previousValue?.shouldShowPricesFeedbackForm != + currentValue.shouldShowPricesFeedbackForm, + builder: ( + final BuildContext context, + final UserPreferences userPreferences, + _, + ) { + /*if (!userPreferences.shouldShowPricesFeedbackForm) { + return EMPTY_WIDGET; + }*/ + + return const _PricesFeedbackForm(); + }, + ), + ); + } +} + +class _PricesFeedbackForm extends StatelessWidget { + const _PricesFeedbackForm(); + + @override + Widget build(BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + final SmoothColorsThemeExtension? themeExtension = + Theme.of(context).extension(); + + return Ink( + width: double.infinity, + height: kBottomNavigationBarHeight, + color: themeExtension!.primaryBlack, + child: IconTheme( + data: const IconThemeData(color: Colors.white), + child: InkWell( + onTap: () async { + LaunchUrlHelper.launchURL( + 'https://forms.gle/Vmh9SR3HhPpjMnVF7', + ); + context.read().markPricesFeedbackFormAsCompleted(); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: MEDIUM_SPACE, + vertical: SMALL_SPACE, + ), + child: Row( + children: [ + ExcludeSemantics( + child: Container( + decoration: BoxDecoration( + color: themeExtension.secondaryNormal, + shape: BoxShape.circle, + ), + child: const AspectRatio( + aspectRatio: 1.0, + child: Lab( + color: Colors.white, + size: 13.0, + ), + ), + ), + ), + const SizedBox(width: SMALL_SPACE), + Expanded( + child: AutoSizeText( + appLocalizations.prices_feedback_form, + maxLines: 2, + style: const TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ), + ), + const SizedBox(width: SMALL_SPACE), + InkWell( + customBorder: const CircleBorder(), + onTap: () => context + .read() + .markPricesFeedbackFormAsCompleted(), + child: const AspectRatio( + aspectRatio: 1.0, + child: CloseButtonIcon(), + ), + ) + ], + ), + ), + ), + ), ); } }