Flutter 水平多段显示小部件

在这里插入图片描述

Github:

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

参数:

参数必填类型说明
defaultValuedouble
doubleValuesList<double>区间
stringValuesList<String>区间提示
colorValuesList<Color>区间颜色
strokeWidthdouble线的宽度,默认 3
radiusdouble线上圆的半径,默认 5
textStyleTextStyle文字风格, 默认 TextStyle(fontSize: 14,color: Colors.black)
textAlignTextAlign文字对齐方式,默认 TextAlign.center
textDirectionTextDirection文字方向,默认 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,
  ),
)

版权声明:本文为zhumj_zhumj原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。