关于 wi_custom_bar

Pub

“wi_custom_bar” 是一个自定义条形小部件,由 wannai 团队创建,用于实现温度计仪表盘。

安装

在你的 pubspec.yaml 中

dependencies:
  wi_custom_bar: ^0.0.1
import 'package:wi_custom_bar/wi_custom_bar.dart';

基本用法

  TemperatureVerticalBar(10, 5),

  TemperatureHorizontalBar(10, 6)

使用场景

可用于显示某个任务或成就的进度。
例如,完成10个任务,进度条显示5/10。

sample image

如何使用

  1. 输入仪表盘的最大值和当前值。(必填)
  • 请输入当前仪表盘值,不得超过最大值。
  1. 当前的成就计数显示在仪表盘的右侧。(可选)
    用法:showCountView: true (默认:false)

  2. 对于仪表盘的渐变色,从下到上,从左到右输入颜色值。
    (可选,有默认值。)
    用法:gradientStartColor: Colors.blueAccent, gradientEndColor: Colors.yellowAccent,

  3. 可调整仪表盘的上下左右长度和圆角大小
    (可选)

自定义用法

属性 描述
maxIndex 仪表盘的最大值。
currentIndex 仪表盘的当前值。
baseBgColor 仪表盘周围的默认边框和仪表盘刻度线的颜色。(默认为白色)
gradientBottomColor 或 gradientStartColor 仪表盘渐变的起始颜色。
gradientTopColor 或 gradientEndColor 仪表盘渐变的结束颜色。
barWidth 仪表盘的粗细。
barHeight 仪表盘的高度。
barPointCount 仪表盘刻度的数量。
showCountView 仪表盘的最大值和最小值计数显示(标记位置:右下角)

示例代码(源代码

GitHub

查看 Github