Skip to content

Commit 4bdde59

Browse files
committed
feat: Add "View app source" drawer item
1 parent aede447 commit 4bdde59

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

lib/common/app_strings.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ class AppStrings {
1414

1515
static const String drawerTitle = appName;
1616
static const String settingsItemTitle = 'Settings';
17-
static const String helpItemTitle = 'Help & feedback';
17+
static const String helpItemTitle = 'Online Help';
1818
static const String rateItemTitle = 'Rate app';
19-
20-
//#region Menu items and functionality
19+
static const String viewSourceItemTitle = 'View app source';
2120

2221
static const Map<MenuAction, String> menuActions = {
2322
MenuAction.reset: 'Reset counter',
@@ -35,7 +34,7 @@ class AppStrings {
3534

3635
static const String helpURL = 'https://techaurelian.com/helloworldcounters/';
3736

38-
//#endregion
37+
static const String viewSourceURL = 'https://techaurelian.com/helloworldcounters/view-source/';
3938

4039
// -----------------------------------------------------------------------------------------------
4140
// Home Screen - Main

lib/screens/home.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class _HomeScreenState extends State<HomeScreen> {
8989
// Launch the Google Play Store page to allow the user to rate the app
9090
launchUrlExternal(context, AppStrings.rateAppURL);
9191
break;
92+
case DrawerExtraActions.viewSource:
93+
// Launch the app source code repo url
94+
launchUrlExternal(context, AppStrings.viewSourceURL);
95+
break;
9296
}
9397
}
9498

lib/widgets/counters_drawer.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import '../utils/utils.dart';
1010
import 'color_list_tile.dart';
1111

1212
/// Drawer extra actions enumeration.
13-
enum DrawerExtraActions { settings, help, rate }
13+
enum DrawerExtraActions { settings, help, rate, viewSource }
1414

1515
/// A material design drawer that shows navigation links for all available counters.
1616
class CountersDrawer extends StatelessWidget {
@@ -65,6 +65,12 @@ class CountersDrawer extends StatelessWidget {
6565
title: const Text(AppStrings.rateItemTitle),
6666
onTap: () => _onExtraActionTap(context, DrawerExtraActions.rate),
6767
),
68+
const Divider(),
69+
ListTile(
70+
leading: const Icon(Icons.code),
71+
title: const Text(AppStrings.viewSourceItemTitle),
72+
onTap: () => _onExtraActionTap(context, DrawerExtraActions.viewSource),
73+
),
6874
],
6975
),
7076
),

0 commit comments

Comments
 (0)