Flutter 计数器 (iOS & Android)

Flutter 计数器是用 Dart 编写的 Flutter 插件,非常简单且可定制。像使用其他组件一样创建它,根据您的需要添加参数,完成了!您将获得高度可定制的计数器,并带有回调。零样板代码!

gif-counter-control

入门

像使用其他组件一样创建此组件

Counter(
  initialValue: _defaultValue,
  minValue: 0,
  maxValue: 10,
  step: 0.5,
  decimalPlaces: 1,
  onChanged: (value) { // get the latest value from here
    setState(() {
      _defaultValue = value;
    });
  },
),

构造函数选项

有一些必需的值,其他用于自定义

  @required num initialValue    // default value
  @required this.minValue       // minimum value
  @required this.maxValue       // maximum value
  @required this.onChanged      // callback
  @required this.decimalPlaces  // decimal places you want to show the value of
  this.color                    // color of the buttons
  this.textStyle                // text style which displays the value
  this.step = 1                 // step you want to set to change value
  this.buttonSize = 25          // if you want to change size of button

使用提供的自定义选项美化您的组件。您还可以更改按钮和文本的颜色和大小。
实现起来非常简单,而且看起来很棒。您可以在示例应用中找到更多详细信息。

GitHub

https://github.com/salmaanahmed/flutterCounter