【发布时间】:2020-08-15 09:04:31
【问题描述】:
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) {
final double appBarHeight = MediaQuery.of(context).size.height * .3;
return AppBar(
brightness: Brightness.light,
automaticallyImplyLeading: false, // hides leading widget
title: Padding(
padding: const EdgeInsets.only(top: 15.0),
child: TyperAnimatedTextKit(
speed: Duration(milliseconds: 200),
isRepeatingAnimation: false,
text: [
"SANDRA",
],
textStyle: GoogleFonts.permanentMarker(
fontSize: 30.0, color: Colors.black),
textAlign: TextAlign.start,
alignment: AlignmentDirectional.topStart // or Alignment.topLeft
),
),
centerTitle: true,
backgroundColor: Colors.white,
);
}
@override
Size get preferredSize => Size.fromHeight(88);
}
这是我的代码,我想使用媒体查询使应用程序在不同的屏幕上做出响应,在这种情况下如何使用媒体查询而不是代码末尾的 88?有什么建议吗?
【问题讨论】: