mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 23:08:59 +00:00
initial gallery
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user