diff --git a/game/assets/icons/bear_popup.svg b/game/assets/icons/bear_popup.svg
new file mode 100644
index 00000000..fa3d1d85
--- /dev/null
+++ b/game/assets/icons/bear_popup.svg
@@ -0,0 +1,54 @@
+
diff --git a/game/ios/Podfile.lock b/game/ios/Podfile.lock
index cd48c01c..081e50e4 100644
--- a/game/ios/Podfile.lock
+++ b/game/ios/Podfile.lock
@@ -1,4 +1,6 @@
PODS:
+ - app_settings (5.1.1):
+ - Flutter
- AppAuth (1.7.6):
- AppAuth/Core (= 1.7.6)
- AppAuth/ExternalUserAgent (= 1.7.6)
@@ -185,6 +187,7 @@ PODS:
- Flutter
DEPENDENCIES:
+ - app_settings (from `.symlinks/plugins/app_settings/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Firebase
- Firebase/Analytics
@@ -229,6 +232,8 @@ SPEC REPOS:
- PromisesObjC
EXTERNAL SOURCES:
+ app_settings:
+ :path: ".symlinks/plugins/app_settings/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_core:
@@ -269,6 +274,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
+ app_settings: 3507c575c2b18a462c99948f61d5de21d4420999
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
device_info_plus: 71ffc6ab7634ade6267c7a93088ed7e4f74e5896
Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e
diff --git a/game/lib/navigation_page/bottom_navbar.dart b/game/lib/navigation_page/bottom_navbar.dart
index 51c74ac0..91f8c94a 100644
--- a/game/lib/navigation_page/bottom_navbar.dart
+++ b/game/lib/navigation_page/bottom_navbar.dart
@@ -1,3 +1,4 @@
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:game/api/game_api.dart';
import 'package:game/global_leaderboard/global_leaderboard_widget.dart';
@@ -12,6 +13,7 @@ import 'package:game/model/tracker_model.dart';
import 'package:game/model/challenge_model.dart';
import 'package:game/widgets/bear_mascot_message.dart';
import 'package:game/utils/utility_functions.dart';
+import 'package:game/widgets/envelope_popup.dart';
import 'package:showcaseview/showcaseview.dart';
import 'search_filter_home.dart';
@@ -80,6 +82,19 @@ class _BottomNavBarState extends State {
GlobalLeaderboardWidget(),
ProfilePage(),
];
+
+ // TODO: testing purposes only, remove later
+ if (kDebugMode) {
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
+ if (!mounted) return;
+ await showEnvelopePopup(
+ context,
+ titleText: 'FREE FOOD!',
+ envelopeText: 'BOBA!',
+ buttonLabel: 'Turn On Notifications',
+ );
+ });
+ }
}
@override
diff --git a/game/lib/widgets/envelope_popup.dart b/game/lib/widgets/envelope_popup.dart
new file mode 100644
index 00000000..da7443d4
--- /dev/null
+++ b/game/lib/widgets/envelope_popup.dart
@@ -0,0 +1,244 @@
+import 'package:app_settings/app_settings.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+
+/**
+ * `EnvelopePopup` Widget - Bear envelope popup with configurable text.
+ *
+ * @remarks
+ * - Header line 1 is fixed: "DON'T MISS OUT ON"
+ * - If `buttonLabel` is "Turn On Notifications" and `onButtonPressed` is null,
+ * the CTA opens the device app settings.
+ *
+ * @param titleText - Header line 2
+ * @param envelopeText - Text shown inside the envelope
+ * @param buttonLabel - CTA label
+ * @param onButtonPressed - Optional CTA handler
+ * @param onClose - Optional cancel handler
+ */
+class EnvelopePopup extends StatelessWidget {
+ const EnvelopePopup({
+ super.key,
+ required this.titleText,
+ required this.envelopeText,
+ required this.buttonLabel,
+ this.onButtonPressed,
+ this.onClose,
+ });
+
+ final String titleText;
+ final String envelopeText;
+ final String buttonLabel;
+ final VoidCallback? onButtonPressed;
+ final VoidCallback? onClose;
+
+ static const String _settingsButtonLabel = 'Turn On Notifications';
+ static const String _headerLine1 = "DON'T MISS OUT ON";
+ static const double _illustrationWidth = 180;
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+
+ return Dialog(
+ backgroundColor: Colors.white,
+ insetPadding: const EdgeInsets.symmetric(horizontal: 36, vertical: 18),
+ alignment: const Alignment(0, -0.6),
+ elevation: 0,
+ shadowColor: Colors.transparent,
+ shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 350),
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(12, 12, 12, 12),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: InkResponse(
+ onTap: () {
+ onClose?.call();
+ Navigator.of(context).maybePop();
+ },
+ radius: 20,
+ child: SvgPicture.asset(
+ 'assets/icons/cancel.svg',
+ width: 32,
+ height: 32,
+ colorFilter: const ColorFilter.mode(
+ Colors.black38,
+ BlendMode.srcIn,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 4),
+ _PopupHeader(
+ line1: _headerLine1,
+ line2: titleText,
+ ),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: _illustrationWidth,
+ ),
+ child: _BearEnvelopeGraphic(envelopeText: envelopeText),
+ ),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: () async {
+ if (onButtonPressed != null) {
+ onButtonPressed!.call();
+ return;
+ }
+
+ if (buttonLabel.trim() == _settingsButtonLabel) {
+ await AppSettings.openAppSettings();
+ return;
+ }
+
+ Navigator.of(context).maybePop();
+ },
+ style: ElevatedButton.styleFrom(
+ padding: const EdgeInsets.symmetric(vertical: 14),
+ backgroundColor: const Color(0xFF7A5A73),
+ foregroundColor: Colors.white,
+ elevation: 0,
+ shadowColor: Colors.transparent,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ textStyle: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w700,
+ ),
+ ),
+ child: Text(buttonLabel),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _BearEnvelopeGraphic extends StatelessWidget {
+ const _BearEnvelopeGraphic({required this.envelopeText});
+
+ final String envelopeText;
+ static const double _envelopeTextRotationRad = -(2 * 3.14 / 180);
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ final width = constraints.maxWidth;
+ final height = width * (296 / 177);
+
+ return SizedBox(
+ width: width,
+ height: height,
+ child: Stack(
+ children: [
+ Positioned.fill(
+ child: SvgPicture.asset(
+ 'assets/icons/bear_popup.svg',
+ fit: BoxFit.contain,
+ ),
+ ),
+ Positioned.fill(
+ child: Align(
+ alignment: const Alignment(0, -0.58),
+ child: FractionallySizedBox(
+ widthFactor: 0.62,
+ child: FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Transform.rotate(
+ angle: _envelopeTextRotationRad,
+ child: Text(
+ envelopeText.toUpperCase(),
+ textAlign: TextAlign.center,
+ style: theme.textTheme.headlineSmall?.copyWith(
+ fontWeight: FontWeight.w900,
+ color: const Color(0xFFE94C4C),
+ letterSpacing: 1.0,
+ height: 1.0,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ },
+ );
+ }
+}
+
+class _PopupHeader extends StatelessWidget {
+ const _PopupHeader({required this.line1, required this.line2});
+
+ final String line1;
+ final String line2;
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+
+ return Column(
+ children: [
+ Text(
+ line1,
+ textAlign: TextAlign.center,
+ style: theme.textTheme.titleMedium?.copyWith(
+ fontWeight: FontWeight.w700,
+ fontSize: 24,
+ fontFamily: 'Poppins',
+ color: const Color(0xFF1E1E1E),
+ ),
+ ),
+ Text(
+ line2,
+ textAlign: TextAlign.center,
+ style: theme.textTheme.titleLarge?.copyWith(
+ fontWeight: FontWeight.w700,
+ fontSize: 36,
+ fontFamily: 'Poppins',
+ height: 1.1,
+ letterSpacing: 0.4,
+ color: const Color(0xFF1E1E1E),
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+// Shows an `EnvelopePopup` dialog.
+Future showEnvelopePopup(
+ BuildContext context, {
+ required String titleText,
+ required String envelopeText,
+ required String buttonLabel,
+ VoidCallback? onButtonPressed,
+}) async {
+ await showDialog(
+ context: context,
+ barrierColor: Colors.black.withOpacity(0.12),
+ barrierDismissible: true,
+ builder: (context) => EnvelopePopup(
+ titleText: titleText,
+ envelopeText: envelopeText,
+ buttonLabel: buttonLabel,
+ onButtonPressed: onButtonPressed,
+ ),
+ );
+}
diff --git a/game/pubspec.lock b/game/pubspec.lock
index cfb4da94..e76f6a24 100644
--- a/game/pubspec.lock
+++ b/game/pubspec.lock
@@ -9,6 +9,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.59"
+ app_settings:
+ dependency: "direct main"
+ description:
+ name: app_settings
+ sha256: "09bc7fe0313a507087bec1a3baf555f0576e816a760cbb31813a88890a09d9e5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "5.1.1"
archive:
dependency: transitive
description:
@@ -1499,5 +1507,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
- dart: ">=3.8.0-0 <4.0.0"
- flutter: ">=3.29.0"
+ dart: ">=3.9.0 <4.0.0"
+ flutter: ">=3.35.0"
diff --git a/game/pubspec.yaml b/game/pubspec.yaml
index d3e24ef5..4d6be971 100644
--- a/game/pubspec.yaml
+++ b/game/pubspec.yaml
@@ -25,6 +25,7 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
+ app_settings: 5.1.1
# Firebase
firebase_core: ^3.8.1
firebase_messaging: ^15.1.6