很抱歉,我從未見過或使用過帶有 android OS 的實際設備,例如 Google pixcel,但我發現螢屏頂部的灰色區域如下圖所示。*這是從 vsCode 呼叫的“Pixcel 4 API 30 移動模擬器”。

我在 Pixcel 5 模擬器上也發現了這種死區,但我不確定這是否是所有 android 作業系統的共同點。最后,我想問一下,我是否應該避免在這里顯示一些東西,或者這只是模擬器問題而不必關心這個?
如果我必須通過顫振開發來關心這個區域,我是否應該故意將這些設備和其他設備之間的代碼或設計分開,因為我通常使用 Iphone 模擬器和實際機器但從未見過這個區域并且相信我不需要關心這種區域并針對這個問題采用 top-margin。
感謝您的有用評論。
添加的代碼:
class holder extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.watch(_modalProvider );
return Scaffold(
body: Column(
children: [
Container(
margin: const EdgeInsets.only(bottom: 10),
// flex: 1,
child: Container(
margin: EdgeInsets.only(top: 40),//should I do this to avoid this area?
width: double.infinity,
height: 40,
// color: Colors.grey,
alignment: Alignment.topLeft,
child: Image.asset('images/flutter.png'),
),
),
Flexible(
child: ListView(
scrollDirection: Axis.vertical,
shrinkWrap: true,
children: [
Folders(
name: "list",
subTitle: null,
),
],
)
),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
floatingActionButton: Container(
width: 50.0,
child: FloatingActionButton(
backgroundColor: Colors.white,
child: const Icon(
Icons.search_sharp,
color: MyStyle.mainColor,
),
onPressed: () {
ref.read(_modalProvider.notifier).update((state){
showTopModalSheet<String?>(context, DumyModal());
});
},
),
),
);
}
}
uj5u.com熱心網友回復:
該區域在真實設備中也可見,因此您應該考慮該區域。但是Scaffold小部件將從該點以下開始渲染,因此您不必考慮它。如果你想改變那個區域的顏色,你可以
Container(
decoration: BoxDecoration(color: Color.white),
child: SafeArea(
Scaffold:...
)
)
它對IOS和Android設備的影響也不同,我相信這就是為什么它只在某些設備中可見
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/524831.html
標籤:安卓扑安卓模拟器
