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