我正试图跟随左边图片的高度。但是,即使我调整了右边图片的填充,它也不会像左边那样变小。
左侧图片:
return WillPopScope(
onWillPop: () async {
return true;
},
child: Scaffold(
drawer: Drawer(
child: ListView(...)
),
body: UpgradeAlert(
canDismissDialog: false,
child: Column(
children: <Widget>[
Container(
width: Get.size.width,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20.0),
bottomRight: Radius.circular(20.0),
),
),
child: SafeArea(
bottom: false,
child: Padding(
padding: const EdgeInsets.only(
left: 16.0, right: 16.0, top: 0.0, bottom: 16.0),
child:右侧图片:
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.purple,
title: Text('Test'),
),
body: Column(
children: <Widget>[
Container(
width: Get.size.width,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondary,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20.0),
bottomRight: Radius.circular(20.0),
),
),
child: const SafeArea(
bottom: false,
child: Padding(
padding: EdgeInsets.only(
left: 16.0, right: 16.0, top: 0.0, bottom: 16.0),
),编辑:分别显示图片。
左侧图片:

右侧图片:

并排比较,以显示额外的高度在正确的图片。

发布于 2022-03-05 12:51:22
底部部分来自bottom填充。
Padding(
padding: EdgeInsets.only(
left: 16.0,
right: 16.0,
top: 0.0,
// bottom: 16.0, you can remove this to have desire result
),
),若要获得圆角,请在shape上使用AppBar属性。
appBar: AppBar(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25.0),
bottomRight: Radius.circular(25.0),
),
),
backgroundColor: Colors.purple,
title: Text('Test'),
),

https://stackoverflow.com/questions/71362097
复制相似问题