gpt4 book ai didi

android - 状态栏 flutter 下的应用栏标题

转载 作者:行者123 更新时间:2023-12-03 03:54:21 29 4
gpt4 key购买 nike

我比较陌生,所以我不知道为什么我的应用栏看起来像这样
app screenshot

这是main.dart文件

import 'package:testapp/test_page.dart';
import 'package:flutter/material.dart';

void main() {
runApp(Home());
}


class Home extends
StatelessWidget {

@override
Widget build(BuildContext
context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Test App',
theme: ThemeData(primaryColor: Colors.purple),
home: TestPage(),
);
}
}

这是我的testpage.dart
import 'package:flutter/material.dart';

class TestPage extends
StatelessWidget {
@override
Widget build(BuildContext
context) {
return Scaffold(
primary: false,
appBar: AppBar(
title: Text(' Test app'),
),
body: Center(child: Text('Example Test')),
);
}
}

我尝试使用SafeArea无效。谢谢

最佳答案

您已将主要属性设置为false。

Whether this scaffold is being displayed at the top of the screen.

If true then the height of the appBar will be extended by the height of the screen's status bar, i.e. the top padding for MediaQuery.



https://api.flutter.dev/flutter/material/Scaffold/primary.html

关于android - 状态栏 flutter 下的应用栏标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61948421/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com