【发布时间】:2021-12-03 09:52:20
【问题描述】:
这发生在我使用 Flutter 2.5.3 的 Android 12 上
使用时
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
这是我正在使用的代码
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) => Scaffold(
body: Column(
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
);
}
我想知道我是否会遗漏一些东西
【问题讨论】:
-
添加到这个。我的手机有个打孔,是 Google Pixel 4a。
-
我刚刚在运行 Android 11 的三星 Galaxy A51 上进行了尝试,但它仍然会发生。它也有一个打孔相机。
标签: android flutter android-12 android-immersive