File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import '../common/app_settings.dart';
1212import '../common/strings.dart' as strings;
1313import '../common/urls.dart' as urls;
1414import '../models/counter.dart' ;
15+ import '../utils/utils.dart' as utils;
1516import '../utils/utils.dart' ;
1617import '../widgets/accept_cancel_dialog.dart' ;
1718import '../widgets/counter_display.dart' ;
@@ -101,9 +102,9 @@ class _HomeScreenState extends State<HomeScreen> {
101102
102103 /// Navigates to the Settings screen, and refreshes on return.
103104 Future <void > _loadSettingsScreen () async {
104- await Navigator . push <void >(
105+ await utils. navigateToScreen <void >(
105106 context,
106- MaterialPageRoute (builder : (context) => SettingsScreen (appSettings: _appSettings) ),
107+ SettingsScreen (appSettings: _appSettings),
107108 );
108109 setState (() {
109110 /* Refresh after returning from Settings screen. */
Original file line number Diff line number Diff line change @@ -15,6 +15,15 @@ String toDecimalString(BuildContext context, int number) {
1515 return localizations.formatDecimal (number);
1616}
1717
18+ /// Navigates to the given screen widget.
19+ Future <T ?> navigateToScreen <T >(BuildContext context, Widget screen) {
20+ return Navigator .of (context).push <T >(
21+ MaterialPageRoute <T >(
22+ builder: (context) => screen,
23+ ),
24+ );
25+ }
26+
1827/// Launches the specified [URL] in the mobile platform, using the default external application.
1928///
2029/// Shows an error [SnackBar] if there is no support for launching the URL.
You can’t perform that action at this time.
0 commit comments