그리드 항목 요소에서 잘리지 않도록 이미지를 약간 축소하려고합니다. 실제 이미지 크기는 300x300입니다.
아래는 이미지 너비와 높이를 명시 적으로 줄이려는 코드이며 맞춤 유형으로 많은 조합을 시도했습니다. 그래도 눈에 띄는 영향은 보이지 않습니다. 어떻게해야하는지 알려 주실 수 있나요? 양해 해 주셔서 감사합니다.
@override
Widget build(BuildContext context) {
return Scaffold(
body: GridView.count(
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
childAspectRatio: 1.5,
crossAxisCount: 2,
children: List.generate(
8,
(index) {
return Center(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(5),
child: CircleAvatar(
backgroundImage: Image.asset(
'assets/icons/antenna_icon.png',
height: 30,
width: 30,
fit: BoxFit.fitWidth,
).image,
backgroundColor: Colors.grey.shade300,
radius: 50,
)),
Text(
"Evve",
style: GoogleFonts.roboto(color: Colors.black87, fontSize: 15),
),
],
));
},
),
));
}
Transform.scale
의 자식으로 사용 CircleAvatar
하고 이미지를의 자식으로 설정할 수 있습니다 Transform.scale
.
CircleAvatar(
child: Transform.scale(
scale: 0.8,
child: Image.asset(
'assets/icons/antenna_icon.png',
height: 30,
width: 30,
fit: BoxFit.fitWidth,
),
),
backgroundColor: Colors.grey.shade300,
radius: 50,
)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다