mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Migrate veggieseasons to go_router (#1544)
* add go_router * wip migration to go_router * small fixes * home screen cleanup * remove unused * small fixes * details should be fullscreen dialog * remove comment * fix navigation outside the shell by using the correct navigation keys * add restoration id to all pages * test passing, but parts are commented out, wip * uncommented more test code * Add TODOs * fix lint issues * fix tests * use FadeTransitionPage * remove unnecessary builders * FadeTransitionPage same as CustomTransitionPage * add comments regarding relative routes * add missing pageKey * add missing const --------- Co-authored-by: Brett Morgan <brettmorgan@google.com>
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/screens/details.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
class ZoomClipAssetImage extends StatelessWidget {
|
||||
@@ -72,7 +72,13 @@ class VeggieHeadline extends StatelessWidget {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => DetailsScreen.show(Navigator.of(context), veggie.id),
|
||||
onTap: () {
|
||||
// GoRouter does not support relative routes,
|
||||
// so navigate to the absolute route, which can be either
|
||||
// `/favorites/details/${veggie.id}` or `/search/details/${veggie.id}`
|
||||
// see https://github.com/flutter/flutter/issues/108177
|
||||
context.go('${GoRouter.of(context).location}/details/${veggie.id}');
|
||||
},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user