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