mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-08-06 00:49:46 +08:00
36 lines
795 B
Dart
36 lines
795 B
Dart
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CupertinoSegmentedControlDemo extends StatefulWidget {
|
|
_Demo createState() => _Demo();
|
|
}
|
|
|
|
class _Demo extends State<CupertinoSegmentedControlDemo> {
|
|
String value = 'a';
|
|
Widget build(BuildContext context) {
|
|
return CupertinoSegmentedControl(
|
|
onValueChanged: (v) {
|
|
this.setState(() {
|
|
value = v;
|
|
});
|
|
},
|
|
pressedColor: Color(0xff7c1c25),
|
|
borderColor: Color(0xffac172a),
|
|
selectedColor: Color(0xffac172a),
|
|
groupValue: value,
|
|
children: {
|
|
'a': Container(
|
|
alignment: Alignment.center,
|
|
width: 130.0,
|
|
child: Text('a')
|
|
),
|
|
'c': Text('C'),
|
|
'b': Text('B'),
|
|
},
|
|
);
|
|
}
|
|
|
|
}
|
|
|