Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CupertinoExtendedPage and MaterialExtendedPage blocking navigation (sheet:1.0.0-pre) #343

Closed
Skogsfrae opened this issue Apr 20, 2023 · 1 comment · Fixed by #344
Closed

Comments

@Skogsfrae
Copy link
Contributor

When navigating between two routes at the same level, CupertinoExtendedPage and MaterialExtendedPage won't build the correct page widget. It works fine using Flutter MaterialPage.

I found out the problem being caused by an update on both _PageBasedCupertinoPageRoute and _PageBasedMaterialPageRoute buildContent method making it call super.builder instead of _page.child and causing the old route _page.child to be returned.

Screen Recording 2023-04-20 at 10 30 41

Route structure:
[GoRouter] Full paths for routes:
             => /home
             => /profile
Code Example:
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:sheet/route.dart';

void main() {
  runApp(const MainApp());
}

final _router = GoRouter(
  initialLocation: '/home',
  debugLogDiagnostics: true,
  routes: [
    GoRoute(
      path: '/home',
      pageBuilder: (context, state) => CupertinoExtendedPage(
        child: Scaffold(
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text('Home'),
                ElevatedButton(
                  onPressed: () {
                    GoRouter.of(context).go('/profile');
                  },
                  child: Text('go to profile'),
                ),
              ],
            ),
          ),
        ),
      ),
    ),
    GoRoute(
      path: '/profile',
      pageBuilder: (context, state) => CupertinoExtendedPage(
        child: Scaffold(
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text('profile'),
                ElevatedButton(
                  onPressed: () {
                    GoRouter.of(context).go('/home');
                  },
                  child: Text('go home'),
                ),
              ],
            ),
          ),
        ),
      ),
    ),
  ],
);

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerConfig: _router,
    );
  }
}
@thipokch
Copy link

Reproducible for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants