小编fua*_*yah的帖子

Flutter 应用程序在屏幕锁定时始终打开

只是询问当屏幕锁定时我的应用程序始终打开,并且我解锁,我的应用程序仍然存在,如果按后退按钮或关闭应用程序,则会显示锁屏。

我有什么不对吗?

我没有使用唤醒锁或类似的包。

颤动版本2.0.1

这是我的 main.dart 代码

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

  runApp(
    GetMaterialApp(
      home: MyApp(),
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        textTheme: GoogleFonts.interTextTheme(),
        primarySwatch: Colors.blue,
      ),
    ),
  );
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    ///disable automatic ui adjustment for navBar and notificationBar
    WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = false;

    ///only potrait orientation use
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
    ]);

    ///set overlay style of NavBar …
Run Code Online (Sandbox Code Playgroud)

android dart flutter

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

标签 统计

android ×1

dart ×1

flutter ×1