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

GetRouterOutlet not effect #3242

Open
ANC1024GO opened this issue Oct 21, 2024 · 2 comments
Open

GetRouterOutlet not effect #3242

ANC1024GO opened this issue Oct 21, 2024 · 2 comments
Assignees

Comments

@ANC1024GO
Copy link

log
not log, not eorro

example:

//main.dart
GetMaterialApp(
      getPages: AppRoute().routes,
      initialRoute:AppRouteName.home,
)
//AppRoute
class AppRoute {
  final List<GetPage> routes = [
    GetPage(
      name:  AppRouteName.home,
      page: () => HomePage(title: 'Hello',),

    ),
    GetPage(
      name:  AppRouteName.listPage,
      page: () => Container(child: Center(child: Text('hello list'),),color: Colors.orange.withOpacity(0.3),),
      children:[
        GetPage(
          name:  AppRouteName.widget,
          page: ()=>WidgetPage(),
        ),
        GetPage(
          name:  AppRouteName.test,
          page: ()=>TestPage(),
        ),
      ]
    ),
    GetPage(
      name:  AppRouteName.login,
      page: () => LoginPage(),

    ),
  ];

}
class AppRouteName {
  static const String home = '/';
  static const String listPage = '/list';
  static const String widget = '/list/widget';
  static const String test = '/list/test';

  static const String login = '/login';

}
// home page
class HomePage extends StatefulWidget {
  const HomePage({super.key});
  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        title: Text('home '),
      ),
      body: Row(
        children: [
          Container(
              width: 200,
              child: ListView(children: [
                ListTile(
                  title: Text('widget'),
                  onTap: () {
                    Get.toNamed(AppRouteName.widget,id:1);
                  },
                ),
                ListTile(
                  title: Text('test'),
                  onTap: () {
                    Get.toNamed(AppRouteName.test,id: 1);
                  },
                ),
              ])),
            Expanded(
              flex: 1,
              child: GetRouterOutlet(
                  anchorRoute:AppRouteName.listPage,
                  initialRoute:AppRouteName.widget,
                  key: Get.nestedKey(1),
                  filterPages: (afterAnchor) {
                    return afterAnchor.take(1);
                  },
                ),
            )
        ],
      ),
      // This trailing comma makes auto-formatting nicer for build methods.
  }
}

Screenshots

Flutter Version:
Flutter 3.22.3 • channel stable

Getx Version:
(get: ^4.6.6)

@ANC1024GO
Copy link
Author

There is no response when clicking the button,https://i.makeagif.com/media/10-21-2024/sC-rqK.gif

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

No branches or pull requests

3 participants
@jonataslaw @ANC1024GO and others