Flutter-调整图标的大小 我想在此处减小图标的大小。有人可以建议我如何使用多个小部件连续调整图标的大小。
Widget buildFloatingButton() {
return Container(
height: 56.0,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: AssetImage("assets/images/btn1.png"), fit: BoxFit.cover),
),
child: FlatButton(
child: Row(//declared a row
children: <Widget>[
SizedBox(width: 16.0,),
Image.asset("assets/images/video.png"),//icon image
SizedBox(width: 20.0,),
Text( //heading text
'Random Videos',
style: TextStyle(
fontSize: 20.0,
fontFamily: 'Righteous',
fontWeight: FontWeight.bold,
),
),
],
),
textColor: Colors.white, //setting colors
color: Colors.transparent,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () {
print('button pressed');
Navigator.pop(context);//button action call back
},
),
);
}
答案 0 :(得分:1)
height and width
小部件中 放入 Image.asset
,并根据需要缩小/调整大小
Widget buildFloatingButton() {
return Container(
height: 56.0,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: AssetImage("assets/images/btn1.png"), fit: BoxFit.cover),
),
child: FlatButton(
child: Row(//declared a row
children: <Widget>[
SizedBox(width: 16.0,),
Image.asset("assets/images/video.png",height: value,,width: value),//icon image
SizedBox(width: 20.0,),
Text( //heading text
'Random Videos',
style: TextStyle(
fontSize: 20.0,
fontFamily: 'Righteous',
fontWeight: FontWeight.bold,
),
),
],
),
textColor: Colors.white, //setting colors
color: Colors.transparent,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () {
print('button pressed');
Navigator.pop(context);//button action call back
},
),
);
}