【发布时间】:2020-04-11 21:39:04
【问题描述】:
我启动了一个 Flutter 应用,并向该应用添加了一些代码,然后,当我在 android 设备上运行我的应用时,我的应用的状态栏会自动隐藏?
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: Colors.black,
accentColor: Colors.amber,
appBarTheme: AppBarTheme(
textTheme: ThemeData.light().textTheme.copyWith(
title: TextStyle(
color: Colors.amber,
fontFamily: 'OpenSans',
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
title: 'Currency App',
home: HomePage(),
routes: {
ExchangePage.routeName: (ctx) => ExchangePage(),
GrowsPage.routeName: (ctx) => GrowsPage(),
CurrencyPage.routeName: (ctx) => CurrencyPage(),
ReorderListItemScreen.routeName: (ctx) => ReorderListItemScreen(),
},
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
_portraitModeOnly();
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.amber),
title: const Text('Currency App'),
),
body: ImageCarousel(),
drawer: DrawerCode(),
);
}
void _portraitModeOnly() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
}
这是我的代码,我搜索了很多网站,但没有找到合适的,请帮助我,谢谢
【问题讨论】: