小编She*_*chi的帖子

如何在flutter中使用bottomnavigationbar移动到新页面?

在颤动中使用底部导航栏中的三个图标时,我想移动到三个新页面(根据下面的代码)。我尝试了多种方法,但代码不起作用,也无法按照我的要求弄清楚。

在这种情况下,最重要的是使用现有代码并使用底部导航栏更改移动到新页面所需的更改。

如果有人知道如何使用底部导航栏(使用我现有的代码)导航到新页面,请告诉我。

先感谢您。

代码:

class dashboard extends StatefulWidget {
  @override
  _dashboardState createState() => _dashboardState();
}

// ignore: camel_case_types
class _dashboardState extends State<dashboard> {
  int currentIndex = 1;

  changeIndex(index) {
    setState(() {
      currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    final authService = Provider.of<AuthService>(context);
    return Scaffold(
      body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.only(top: 80.0, right: 250),
              child: Center(
                child: Container(
                  width: 200.0,
                  height: 20.0,
                  decoration:
                      BoxDecoration(borderRadius: BorderRadius.circular(15.0)),
                  child: (const Text(
                    'Hello',
                    textAlign: TextAlign.center,
                    style: TextStyle( …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-bottomnavigation flutter-routes

1
推荐指数
1
解决办法
7552
查看次数