jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.38k stars 1.62k forks source link

Getx 4.1.1 GetNavigator Error #1244

Open fxioi opened 3 years ago

fxioi commented 3 years ago

Describe the bug An error occurs when using GetNavigator, Expected a value of type "int", but got one of type "Null".

Reproduction code

import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() {
  runApp(GetMaterialApp(home: GetXNv()));
}

class GetXNv extends StatelessWidget {
  const GetXNv({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Nv demo")),
      body: Container(
        // child: NestPageOne(),
        child: GetNavigator(
          initialRoute: '/',
          getPages: [
            GetPage(name: '/', page: () => NestPageOne()),
            GetPage(name: '/two', page: () => NestPageTwo()),
          ],
        ),
      ),
      floatingActionButton:
          FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
    );
  }
}

class NestPageOne extends StatelessWidget {
  const NestPageOne({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text('Nest Page 1'),
    );
  }
}

class NestPageTwo extends StatelessWidget {
  const NestPageTwo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text('Nest Page 2'),
    );
  }
}

To Reproduce Steps to reproduce the behavior:

  1. Run main()

Expected behavior Show pages.

Screenshots image

Flutter Version: 2.0.2

Getx Version: 4.1.1

Describe on which device you found the bug: Chrome 89.0.4389.90

tva77 commented 2 years ago

I just found a solution to nested navigation using bottombar navigation and getx https://github.com/tva77/getx_persistent_bottombar