Last active
March 11, 2025 18:33
-
-
Save loic-sharma/ffc756351255114fa5468e968ee38c2f to your computer and use it in GitHub Desktop.
Cupertino Segmented controls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return CupertinoApp( | |
title: 'Cupertino segmented control demo', | |
home: CupertinoPageScaffold( | |
child: Center( | |
child: Column( | |
spacing: 10, | |
children: [ | |
CupertinoSegmentedControl( | |
onValueChanged: (value) {}, | |
children: { | |
0: Text('Foo'), | |
1: Text('Bar'), | |
}, | |
), | |
CupertinoSlidingSegmentedControl( | |
onValueChanged: (value) {}, | |
children: { | |
0: Text('Foo'), | |
1: Text('Bar'), | |
}, | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment