搜索插件、代码仓与 APP 分类

插件详情v1.0.3

flutter_counter

Flutter Counter 是一个用 Dart 编写的简单且可自定义的插件,适用于 Flutter。像使用其他小部件一样创建它,根据您的需要添加参数,即可完成!

近 30 天下载
42
喜欢数
9
Pub 分数
40

安装插件

flutter pub add flutter_counter

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Flutter Counter 是一个轻量级、可自定义的 Dart 包,专为 Flutter 设计,提供了一个简单的计数器控件。可轻松集成到任何 Flutter 应用中,使开发者能够创建可递增和递减的计数器,并支持配置初始值、步长和范围限制等选项。该控件设计直观且灵活,支持自定义样式和状态变化回调。适用于表单、数量选择器或交互式 UI 元素,仅需最少设置即可提升用户体验。

适合场景

  • 表单输入控件
  • 购物车中的数量选择器
  • 交互式 UI 元素
  • 用户偏好设置
  • 游戏得分追踪

主要特点

  • 可自定义的初始值
  • 可配置的步长
  • 范围限制支持
  • 更改时的回调
  • 简单集成

适合对象

  • 初学者 Flutter 开发者
  • 简单表单组件
  • 轻量级 UI 增强
  • 快速原型设计
  • 基本数值输入需求

使用建议

  • 仅限基本计数功能
  • 无内置验证
  • 不适合复杂的状态管理
  • 需要手动样式设置以实现高级设计
  • 无平台特定优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Counter (iOS & Android)

Description

Flutter Counter is a plugin written in dart for flutter which is really simple and customizeable. Create it like any other widget, add params according to your need and presto! You have got the highly customizeable counter with callbacks. Zero boilerplate!



Getting Started

Create this widget as you do with other widgets

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

Constructor Options

There are some required values and other are for the customization

  @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

Beautify your widget with provided customization. You can also change color and size of both buttons and text. Very simple to implement and looks awesome. You can find more details in sample app.

Contributions and Licence

FlutterCounter is available under the MIT license. See the LICENSE file for more info.

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using Counter in your app, send an email to [Salmaan Ahmed](mailto:salmaan.ahmed@hotmail.com)

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。