1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-09 06:18:49 +00:00

Migrate testing_app to go_router (#1541)

* add go_router

* migrate testing_app to go_router
This commit is contained in:
Miguel Beltran
2022-12-20 17:53:39 +01:00
committed by GitHub
parent 329c531dfc
commit 616aa8d6be
5 changed files with 39 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
import 'package:testing_app/models/favorites.dart';
import 'package:testing_app/screens/favorites.dart';
@@ -21,7 +22,7 @@ class HomePage extends StatelessWidget {
TextButton.icon(
style: TextButton.styleFrom(foregroundColor: Colors.white),
onPressed: () {
Navigator.pushNamed(context, FavoritesPage.routeName);
context.go(FavoritesPage.fullPath);
},
icon: const Icon(Icons.favorite_border),
label: const Text('Favorites'),