Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
feat: apps url links
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Nov 30, 2023
1 parent 6ff5564 commit ba233e4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 41 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ coverage/
packages/**/pubspec.lock

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand Down
6 changes: 6 additions & 0 deletions lib/constants/urls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ class Urls {
static const String termsOfService = 'https://policies.google.com/terms';

static const String howWeBuilt = 'https://medium.com/flutter/9c7aa2a5ad31';

static const appStoreLink =
'https://apps.apple.com/app/super-dash-flutter-game/id6473050393';

static const playStoreLink =
'https://play.google.com/store/apps/details?id=com.verygoodventures.super_dash';
}
58 changes: 19 additions & 39 deletions lib/game_intro/view/game_intro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import 'package:dash_run/game_intro/game_intro.dart';
import 'package:dash_run/gen/assets.gen.dart';
import 'package:dash_run/l10n/l10n.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:url_launcher/url_launcher.dart';

class GameIntroPage extends StatefulWidget {
const GameIntroPage({super.key});
Expand All @@ -23,6 +22,11 @@ class _GameIntroPageState extends State<GameIntroPage> {
precacheImage(Assets.images.gameBackground.provider(), context);
}

void _onDownload() {
final isAndroid = defaultTargetPlatform == TargetPlatform.android;
launchUrl(Uri.parse(isAndroid ? Urls.playStoreLink : Urls.appStoreLink));
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -36,7 +40,7 @@ class _GameIntroPageState extends State<GameIntroPage> {
),
),
child: isMobileWeb
? const _MobileWebNotAvailableIntroPage()
? _MobileWebNotAvailableIntroPage(onDownload: _onDownload)
: const _IntroPage(),
),
);
Expand Down Expand Up @@ -100,20 +104,17 @@ class _IntroPage extends StatelessWidget {
}

class _MobileWebNotAvailableIntroPage extends StatelessWidget {
const _MobileWebNotAvailableIntroPage();
const _MobileWebNotAvailableIntroPage({
required this.onDownload,
});

final VoidCallback onDownload;

@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final theme = Theme.of(context);
final textTheme = theme.textTheme;
final descriptionTextStyle = textTheme.headlineSmall?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
);
final linkStyle = descriptionTextStyle?.copyWith(
decoration: TextDecoration.underline,
);
return Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 390),
Expand All @@ -122,43 +123,22 @@ class _MobileWebNotAvailableIntroPage extends StatelessWidget {
const Spacer(),
Assets.images.gameLogo.image(width: 282),
const Spacer(flex: 4),
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF0046ab),
),
padding: const EdgeInsets.all(12),
child: const Icon(
Icons.mobile_off,
size: 24,
color: Colors.white,
),
),
const SizedBox(height: 24),
Text(
l10n.mobileAppsComingSoon,
l10n.downloadAppMessage,
textAlign: TextAlign.center,
style: textTheme.headlineSmall?.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 24),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: descriptionTextStyle,
children: [
TextSpan(text: l10n.mobileAppsComingSoonGrabThe),
TextSpan(
text: l10n.mobileAppsComingSoonMobileSourceCode,
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () => launchUrlString(Urls.githubRepo),
),
TextSpan(text: l10n.mobileAppsComingSoonDescription),
],
GameElevatedButton.icon(
label: l10n.downloadAppLabel,
icon: const Icon(
Icons.download,
color: Colors.white,
),
onPressed: onDownload,
),
const Spacer(),
const BottomBar(),
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,13 @@
"tapToStart": "Tap/press Space to start",
"@tapToStart": {
"description": "Text shown in the game page"
},
"downloadAppMessage": "Fly into Super Dash, avoid the bugs, collect points, and see how far you can go!",
"@downloadAppMessage": {
"description": "Text shown in the download mobile app page"
},
"downloadAppLabel": "Download the app",
"@downloadAppLabel": {
"description": "Button lable for the app download"
}
}
}

0 comments on commit ba233e4

Please sign in to comment.