Zimme
Zimme

Reputation: 125

Is there a way to increase the height of track in Flutter switch?

I want to make my switch look like this:

But i haven't found a way to increase the size of track. Is there any?

Upvotes: 1

Views: 1970

Answers (2)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63649

To increase the height of track we have to use constraints and FittedBox.

check this

Container(
          // color: Colors.cyanAccent,
          constraints: BoxConstraints(
            minHeight: 170,
            maxHeight: 170,
            minWidth: 200,
            maxWidth: 200,
          ),
          child: FittedBox(
            child: CupertinoSwitch(
              value: _on,
              onChanged: (value) {
                setState(() {
                  _on = value;
                });
                print(value);
              },
            ),
          ),
        ),

Upvotes: 1

Damian A.
Damian A.

Reputation: 41

It looks like you want to use a CupertinoSwitch.

Cupertino switches are the iOS style switches where the track is larger than the node.

Upvotes: 1

Related Questions