Flutter increase height and width of Switch?

I creating game with single and two players. for selection i want slide look so i have tried with switch method but its look very small. how to increase height and width of switch? is there any way creating look like this is welcome?

    new Center(
      child:
      new Padding(padding:EdgeInsets.all(50.00),
          child:
        new Column(
        mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            new Switch(value: _value, onChanged: (bool value1)

            {
              _value=value1;

            },
              materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
              activeThumbImage: new AssetImage("assets/Images/1.png"),
              inactiveThumbImage: new AssetImage("assets/Images/1.png"),

            )
          ],
        )           ,
     ),
    )

You could wrap your Switch inside a Transform widget and change the scale.

        Transform.scale( scale: 2.0,
                          child: new Switch(
                            value: true,
                            onChanged: (bool value1) {},
                          ),
                        )

Scale = 1 is the default size , 0.5 half size , 2.0 double size, you can play with the values :)

How to increase the Switch size in Flutter In this Google flutter code example we are going to learn how to increase the Switch size in Flutter. You can copy and adopt this source code example to your android project without reinventing the wheel.

You can wrapper your Switch widget inside a SizedBox and set width and height to it.

SizedBox(
  width: 80,
  height: 40,
  child: Switch(
    value: isChecked,
    onChanged: (value) {
      //Do you things
    }
  )
)

flutter: SIZE of Red: Size(375.0, 152.9) now we know that our Red panel has 375.0 as width and 152.9 as height. It was easy, right? Let’s go to obtain the position in which our Widget is located.

You should put your switch inside a container and give it both a height and a width as per your requirement.

Customizing Size. As it doesn't provide option to adjust width or height, the easiest way to set the size is by wrapping it inside a Container or a SizedBox widget. Then, specify the desired width and height of the Container or SizedBox. Container( width: 200, height: 200, child: Card( ), ) Customizing Color

You can simply use Container that are more compatible everywhere.

flutter

Container(
                height: //whatever you want
                widget: //whatever you want
                child: Switch(
                    value: true, 
                    onChanged: (){

                }),
              )

the default textfield height is too big(the padding of top and bottom too big), i want little size, how can i implementation it? i known InputDecoration.collapsed can remove the space, but it can't use prefix and suffix.

Getting the screen size in Flutter is trivial, and not verobose (for the most part). This is how you do it. In certain layouts will require you to make some calculations on those sizes. You’ll

I tried to give width to SizedBox and Container whose child is a RaisedButton. It works if they are inside a Column, but it doesn't work if they are inside a ListView.

We can make the bottom sheet scrollable but it's not ideal. This height value cannot be configured without duplicating the entire BottomSheet class; all the inner classes are private so overriding BottomSheet isn't an option.

Comments
  • I'm also looking for ways to update the active and inactive images to use a canvas/picuture/image instead of having to use a local asset image or a network image, do you know how?
  • The solution is good. I was using SwitchListTile and there this solution does magnify the title too and makes the UI weird. Anyways +1 because it solved the question asked.