zeqinjie / tw_step_counter

一个简单步进组件

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tw_step_counter

This is a simple step caculator widget.

pub:tw_step_counter

introduce

Installing

Add tw_step_counter to your pubspec.yaml file:

dependencies:
  tw_step_counter: latest_version

import tw_step_counter in files that it will be used:

import 'package:tw_step_counter/tw_step_counter.dart';

Getting Started

some support property

/// 每次按钮点击递增递减值
  final double differValue;

  /// 每次输入倍数,失去焦点时触发
  final double? inputMultipleValue;

  /// 支持最小值
  final double mixValue;

  /// 支持最大值
  final double maxValue;

  /// 按钮宽度
  final double? btnWidth;

  /// 高度
  final double? height;

  /// 值颜色
  final Color? valueColor;

  /// 值字体大小
  final double? valueFontSize;

  /// 单位
  final String? unit;

  /// 单位颜色
  final Color? unitColor;

  /// 单位字体大小
  final double? unitFontSize;

  /// 当前值
  final double? currentValue;

  /// 点击回调
  final void Function(double value)? onTap;

  /// 输入的回调
  final void Function(double value)? inputTap;

  /// 默认颜色
  final Color? iconColor;

  /// 加按钮图标,默认系统
  final String? addIcon;

  /// 减按钮图标,默认系统
  final String? reduceIcon;

  /// 禁止加按钮图标,默认系统
  final String? addForbiddenIcon;

  /// 禁止减按钮图标,默认系统
  final String? reduceForbiddenIcon;

  /// 禁止点击颜色
  final Color? forbiddenIconColor;

  /// 保留多少位小数位
  final int decimalsCount;

  /// 高亮颜色
  final Color? highlightColor;

  /// 默认背景色
  final Color? defaultColor;

  /// 边线颜色
  final Color? borderLineColor;

  /// 间隙
  final EdgeInsetsGeometry? padding;

  /// 值的组件间隙
  final EdgeInsetsGeometry? valuePadding;

  /// 控制器
  final TWStepCounterController? controller;

  /// 是否自动限制值范围,默认会
  final bool isUpdateInLimitValue;

  /// 是否支持动画,默认会
  final bool isSupportAnimation;

  /// 是否输入时候更新
  final bool isUpdateInputChange;

  /// 限制输入的长度
  final int? limitLength;
  

example

TWStepCounter(
        unit: '元/天',
        currentValue: 130,
        mixValue: 75,
        maxValue: 250,
        onTap: (value) {
          print('点击回调===>$value');
        },
        inputTap: (value) {
          print('输入回调===>$value');
        },
        controller: controller,
        addForbiddenIcon: 'assets/forbidden_add.png',
        addIcon: 'assets/add.png',
        reduceForbiddenIcon: 'assets/forbidden_reduce.png',
        reduceIcon: 'assets/reduce.png',
        defaultColor: TWColors.twF5F5F5,
        highlightColor: Colors.yellow,
        borderLineColor: Colors.red,
        inputMultipleValue: 5,
        // limitLength: 8,
        // height: 70,
        // isUpdateInLimitValue: false,
        // isSupportAnimation: false,
        decimalsCount: 2,
        btnWidth: 64,
        height: 30,
        isUpdateInputChange: false,
        valuePadding: const EdgeInsets.only(
          left: 10,
          right: 10,
        ),
      )

About

一个简单步进组件

License:MIT License


Languages

Language:Dart 95.4%Language:Ruby 3.5%Language:Swift 1.0%Language:Objective-C 0.1%