mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
988 B
39 lines
988 B
import 'package:flutter/cupertino.dart';
|
|
|
|
class SlidingSegmentedControlPage extends StatefulWidget {
|
|
const SlidingSegmentedControlPage({super.key});
|
|
|
|
@override
|
|
State<SlidingSegmentedControlPage> createState() =>
|
|
_SlidingSegmentedControlPageState();
|
|
}
|
|
|
|
class _SlidingSegmentedControlPageState
|
|
extends State<SlidingSegmentedControlPage> {
|
|
int? _groupValue = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CupertinoPageScaffold(
|
|
navigationBar: const CupertinoNavigationBar(
|
|
middle: Text('Sliding Segmented Control'),
|
|
),
|
|
child: Center(
|
|
child: CupertinoSlidingSegmentedControl<int>(
|
|
children: const <int, Widget>{
|
|
0: Text('One'),
|
|
1: Text('Two'),
|
|
2: Text('Three'),
|
|
},
|
|
onValueChanged: (int? value) {
|
|
setState(() {
|
|
_groupValue = value;
|
|
});
|
|
},
|
|
groupValue: _groupValue,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|