Kod*_*ata 0 css android flutter
我想知道为什么边框半径不会在 Android 上应用小部件的上半部分。
这是Android上的图像
但是在网络上,它的工作方式如下图所示。
有谁知道为什么?
代码
Center(
child: Card(
elevation: 1.5,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0))),
child: SizedBox(
width: 250.0,
height: 150.0,
child: Column(
children: <Widget>[
Container(
width: double.infinity,
height: 60.0,
color: Colors.pink[200].withOpacity(0.95),
child: Center(
child: Text('Felicity Jones'),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Center(
child: Text('9:15'),
),
),
)
],
),
),
),
),
Run Code Online (Sandbox Code Playgroud)
如果您仔细观察opacity,暂时将颜色的更改为:
color: Colors.pink[200].withOpacity(0.2),
你会看到左上角和右上角被截断,没有被颜色填充:
为了避免这种情况,使用Card小部件的clipBehavior: Clip.antiAlias,属性,用给定的颜色覆盖卡片的所有角落。这是更新的结果:
希望这能回答你的问题。
| 归档时间: |
|
| 查看次数: |
686 次 |
| 最近记录: |