CupertinoSegmentedControl


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), // 點擊時候的顏色
)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM