
Screenshot_1606210471.png
Github:
https://github.com/zhumj/HorizontalMultiSegmentDisplayWidget-flutter.git
參數(shù):
| 參數(shù) | 必填 | 類型 | 說明 |
|---|---|---|---|
| defaultValue | 是 | double | 值 |
| doubleValues | 是 | List<double> | 區(qū)間 |
| stringValues | 是 | List<String> | 區(qū)間提示 |
| colorValues | 是 | List<Color> | 區(qū)間顏色 |
| strokeWidth | 否 | double | 線的寬度,默認(rèn) 3 |
| radius | 否 | double | 線上圓的半徑,默認(rèn) 5 |
| textStyle | 否 | TextStyle | 文字風(fēng)格, 默認(rèn) TextStyle(fontSize: 14,color: Colors.black) |
| textAlign | 否 | TextAlign | 文字對齊方式,默認(rèn) TextAlign.center |
| textDirection | 否 | TextDirection | 文字方向,默認(rèn) TextDirection.ltr |
使用:
double defaultValue = 37.5;
List<double> doubleValues = [0, 18.5, 25.0, 30.0, 45.0,];
List<String> stringValues = ['偏瘦', '健康', '偏胖', '肥胖',];
List<Color> colorValues = [Colors.greenAccent, Colors.lightBlueAccent, Colors.orange, Colors.red,];
Container(
width: MediaQuery.of(context).size.width,
height: 80,
color: Colors.brown,
margin: EdgeInsets.only(top: 8),
child: HorizontalMultiSegmentDisplayWidget(
defaultValue, doubleValues, stringValues, colorValues,
),
)