Creta Counter

Flutter counter widget package targeting pub.dev.

  • Requirements: see doc/requirements.md
  • Example app entry: example/lib/main.dart

Usage

import 'package:creta_counter/creta_counter.dart';

CretaCounter(
  width: 260,
  height: 80,
  radius: 16,
  elevation: 2,
  showButtons: true,
  initialCount: 0,
  min: -5,
  max: 5,
  boundaryBehavior: CretaCounterBoundaryBehavior.clamp, // or wrap
  foregroundColor: Colors.black,
  backgroundColor: Colors.white,
  // If provided, overrides internal font scaling
  textStyle: TextStyle(fontSize: 28, fontWeight: FontWeight.w700),
  onChanged: (value) {
    // handle value
  },
);

Parameters

  • width, height: 가변 크기 지정. null이면 부모 제약에 따름
  • radius: 둥근 모서리 픽셀
  • showButtons: 좌/우 버튼 표시 여부
  • initialCount: 초기 카운트 값(음수 허용)
  • min, max: 최소/최대값(옵션)
  • boundaryBehavior: clamp(경계 고정) 또는 wrap(순환)
  • foregroundColor, backgroundColor: 전경/배경 색상
  • elevation: 그림자 세기(머티리얼 elevation)
  • Press-and-hold: 길게 누르면 가속 증감 (기본 활성화)

Example

실행:

flutter run -d chrome -t example/lib/main.dart

엔트리: example/lib/main.dart

Run on Windows

cd example
flutter run -d windows

Run on Android

cd example
flutter run -d android

Publishing

  1. Update version in pubspec.yaml (e.g., 0.1.0)
  2. Ensure clean analysis and tests pass
  3. Dry run:
dart pub publish --dry-run
  1. Tag and push (example):
git tag v0.1.0
git push origin v0.1.0
  1. Publish:
dart pub publish

Status

MVP complete. Tests and example included.

Libraries

creta_counter
Creta Counter package library entry.