I tried using this kind of approach to have all of my UI (here only a Text
) in the application below the status bar, but without AppBar:
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
title: "example",
home: Scaffold(
body: Text("text widget"),
),
));
这个问题已经有asked次类似于我的文本,但the answer to it (which is also accepted)只考虑了margin
.对我来说,这似乎不是一个令人满意的解决方案,尤其是因为您需要访问MediaQuery.of(context).padding
,在我的简单示例中,我甚至不知道如何使用context
.
我的代码给出了以下结果:
但我想看看这个:
现在,为了明确我的问题和其他问题之间的区别:我不是在寻找margin,我是在寻找一种合法的惯用方式来做到这一点.我的意思可能如下所示:
ScaffoldWithoutAppBar(body: ...
显然这是不存在的,但我不想要a margin fix.