[英]Flutter : image overflow
導入大圖像時可以解決這個溢出問題嗎? 我正在做一個界面項目,我想在導入大圖像時解決這個問題
改變這個:
對此:
我的代碼:
Scaffold(
backgroundColor: Color(0xff131517),
appBar : AppBar(),
body: SafeArea(
child: Directionality(
textDirection: TextDirection.rtl,
child: Column(
children: [
SizedBox(height: 10,),
Container(child: Image.file(_image! , fit: BoxFit.contain , width: MediaQuery.of(context).size.width,)),
Spacer(),
Container(
height: 85,
color:Color(0xff1e1f23),
child: Center(
child: ListView(
scrollDirection: Axis.horizontal,
children: [],
),
),
)
],
)
),
),
您需要像這樣限制圖像所在容器(或圖像本身)的高度:
Scaffold(
backgroundColor: Color(0xff131517),
appBar : AppBar(),
body: SafeArea(
child: Directionality(
textDirection: TextDirection.rtl,
child: Column(
children: [
SizedBox(height: 10,),
Container(
height: MediaQuery.of(context).size.height*0.9,
child: Image.file(
_image!,
fit: BoxFit.contain,
width: MediaQuery.of(context).size.width,
)
),
Spacer(),
Container(
height: 85,
color:Color(0xff1e1f23),
child: Center(
child: ListView(
scrollDirection: Axis.horizontal,
children: [],
),
),
)
],
)
),
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.