【发布时间】:2020-11-06 19:07:26
【问题描述】:
我正在尝试使我的图像变圆,但作为背景。问题是,ClipRRect 没有做我认为应该做的事情。除了使用 Stack 之外,我还喜欢其他解决方案,因为那样的话,根据列调整图像大小会成为一个问题,因为图像比列大。非常感谢。
编辑:所以,我很抱歉大家。我的同事给我的图像似乎是无意中填充的,因此边框不起作用。目前,我和我的同事已经修复了图像,现在一切正常。我通过在合身时使用 BoxFit.fill 实现了这一点,所以如果有人偶然发现这一点,他们可能想尝试 Boxfit.first 来检查图像。
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
image: DecorationImage(
image: AssetImage(
'images/ic_blackbackground.png',
),
fit: BoxFit.cover,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
top: 24,
bottom: 16,
left: 24,
),
child: Text(
"Info Kios",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 16,
),
),
),
Container(
width: double.infinity,
height: 1,
color: Colors.white,
),
Padding(
padding: const EdgeInsets.only(top: 20, bottom: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
Text(
'Nama Kios',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
Text(
widget._kurirPengambilanModel.pedagang.namaKios,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
],
),
Column(
children: [
Text(
'Nomor Kios',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
Text(
widget
._kurirPengambilanModel.pedagang.nomorKios,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
],
)
],
),
),
],
),
),
),
【问题讨论】:
标签: flutter dart flutter-layout