如何调整行抖动中图标的填充/大小

问题描述 投票:0回答:1

Flutter-调整图标的大小I have used multiple widgets to create buttons like containers我想在这里减小图标的大小。有人可以建议我如何使用多个小部件连续调整图标的大小。

    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
            },
          ),
        );
      }
flutter containers row flutter-layout
1个回答
0
投票

Put 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
            },
          ),
        );
      }
© www.soinside.com 2019 - 2024. All rights reserved.