[英]AppBar not showing in scaffold
I've being studying Flutter for about 4 days, it's becoming tedius, now I want put something together.我已经学习 Flutter 大约 4 天了,它变得乏味,现在我想把一些东西放在一起。 I want to show a different AppBar content at each screen.
我想在每个屏幕上显示不同的 AppBar 内容。 But it seems my Scaffold's AppBar is begin ignored.
但似乎我的 Scaffold 的 AppBar 开始被忽略了。
Here's my code:这是我的代码:
class Login extends StatelessWidget{
Widget build(BuildContext context){
return Scaffold(appBar: AppBar(title:Text( 'Identification') ), body: Stack( children: [RaisedButton( child: Text("logar"), onPressed: () => {
Navigator.pushNamed(context, '/other-screen')
})]));
}
}
The app bar above it seems invisible, doesn't show上面的应用栏似乎不可见,不显示
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'title placedholder',
initialRoute: '/',
routes: {
'/' : (BuildContext context) => Login(),
'/other-screen' : (BuildContext context) => Scaffold(body: Row(children: <Widget>[],))
},
Try running flutter clean
and then running it again.尝试运行
flutter clean
然后再次运行它。
I find this fixes most issues when the code is correct but the application doesn't reflect the intended behaviour.我发现当代码正确但应用程序没有反映预期的行为时,这可以解决大多数问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.