gpt4 book ai didi

flutter - 是否可以使用脚手架和导航器?

转载 作者:行者123 更新时间:2023-12-03 04:14:03 25 4
gpt4 key购买 nike

我需要使用脚手架,这样我才能使用抽屉,但我还需要使用导航器。这是我到目前为止所拥有的,但不确定如何在家里使用脚手架?

void main() {
setupLocator();
runApp(new App());
}

class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle.dark.copyWith(statusBarColor: Colors.transparent),
);

return LifeCycleManager(
child: MaterialApp(
builder: (context, widget) => SafeArea(
child: Navigator(
onGenerateRoute: Router.generateRoute,
initialRoute: routes.RegisterRoute,
),
top: true,
bottom: true,
left: false,
right: false,
// title: 'Register',
// home: OnBoardingPage(), <-- probably where my scaffold should go but using initialRoute above?
),
));
}
}

最佳答案

我可能有一个解决方案,但我不知道它会有多大帮助。

我喜欢打电话

void main() async {
//staff I want to do before app starts
//maybe I want to call something saved in phone memory or idk,mabye this
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle.dark.copyWith(statusBarColor: Colors.transparent),
);

Widget _defaultHome = new IntroScreen();
//I recommend this because you can make some tests before

runApp(new MaterialApp(
home: defaultHome,//or call direct the page you want
routes: <String, WidgetBuilder>{
//routes
'/login': (BuildContext context) => new MyLoginPage(),//example
},
));
}
}

您可以在需要时调用电话:
Navigator.pushNamed(context,'/login');

关于flutter - 是否可以使用脚手架和导航器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62030526/

25 4 0
文章推荐: 通过 map 函数将 Dart 映射到另一个 map
文章推荐: flutter - Flutter使触摸事件通过AppBar传递
文章推荐: android - Gradle同步失败-无法确定当前字符
文章推荐: dart - 如何在Dart中接受对象或List 作为参数?