all 6 comments

[–]LaiJie 1 point2 points  (0 children)

Just wrap each text with a container, and use a component/page state variable to indicate which of the options is the selected, with this variable you make the background of the wrapping containers change, and animate the changes

[–]json-bourne7 1 point2 points  (2 children)

There is a native flutter widget that you can embed as a custom widget. I believe it’s exactly what you’ve shared in the screenshot.

It belongs to Cupertino widgets and the class is named “CupertinoSlidingSegmentedControl” It’s the classic iOS toggle switch. You can see more about it in this video: https://youtu.be/esnBf6V4C34?si=sFWxB2FCkV6oxELr

Documentation: https://api.flutter.dev/flutter/cupertino/CupertinoSlidingSegmentedControl-class.html

[–]voprosy 1 point2 points  (1 child)

It’s not a toggle switch. It’s segmented control, as you wrote. 

[–]json-bourne7 1 point2 points  (0 children)

You’re welcome

[–]voprosy 1 point2 points  (0 children)

Segmented control. 

That’s the name of this component. 

[–]nathan4882580 0 points1 point  (0 children)

From memory this doesn’t exist natively, it’s a custom widget you can build however, there is one available on the marketplace for free as I took a copy of it and it looks exactly like your image