flutter

flutter 水平多段显示小部件

2020-11-25  本文已影响0人  头发还没秃
Screenshot_1606210471.png

Github:

https://github.com/zhumj/HorizontalMultiSegmentDisplayWidget-flutter.git

参数:

参数 必填 类型 说明
defaultValue double
doubleValues List<double> 区间
stringValues List<String> 区间提示
colorValues List<Color> 区间颜色
strokeWidth double 线的宽度,默认 3
radius double 线上圆的半径,默认 5
textStyle TextStyle 文字风格, 默认 TextStyle(fontSize: 14,color: Colors.black)
textAlign TextAlign 文字对齐方式,默认 TextAlign.center
textDirection TextDirection 文字方向,默认 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,
  ),
)
上一篇 下一篇

猜你喜欢

热点阅读