Map<String, Text> map = {'apple': Text('Apple'), 'orange': Text('Orange'), 'banana': Text('Banana')}; String _fruit = 'apple'; CupertinoSegmentedControl( children: map, // 數據 groupValue: _fruit, // 選中的數據 onValueChanged: (fruit) { setState(() { // 數據改變時通過setState改變選中狀態 _fruit = fruit; }); }, unselectedColor: CupertinoColors.white, // 未選中顏色 selectedColor: CupertinoColors.activeBlue, // 選中顏色 borderColor: CupertinoColors.activeBlue, // 邊框顏色 pressedColor: const Color(0x33007AFF), // 點擊時候的顏色 )