diff --git a/.gitignore b/.gitignore index 446ed0d..5bb589e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ build/ ios/.generated/ ios/Flutter/Generated.xcconfig ios/Runner/GeneratedPluginRegistrant.* +doc/ diff --git a/README.md b/README.md index 49e9e50..d14a494 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,29 @@ # wheel_spinner -WheelSpinner provides you with a simple number spinner that resembles a wheel, knob, or more specifically -pitch bender knobs. It allows you to update a single `double` value. +WheelSpinner provides you with a simple number spinner that resembles a wheel, knob, or more +specifically pitch bender knobs. It allows you to update a single `double` value with a finger fling +or drag as in the example below. -## Getting Started + + -- TODO +## How to use + +Simply import the package, and use the exposed `WheelSpinner` widget. + +See all the individual parameters for more details on theme and display customization, as well as +event handlers. Here is a simple usage example: + +```dart +Widget build(BuildContext context) { + return WheelSpinner( + value: value, + width: width, + min: 0.0, + max: 100.0, + borderRadius: borderRadius, + minMaxLabelBuilder: (value) => value, + onSlideUpdate: (val) => onChange(value), + ); +} +``` diff --git a/lib/utils.dart b/lib/utils.dart index e93c98d..9788cc2 100644 --- a/lib/utils.dart +++ b/lib/utils.dart @@ -1,5 +1,5 @@ import 'dart:math'; -/// clamps [value] to [min] and [max] +/// clamps [number] to [low] and [high] double clamp(T number, T low, T high) => max(low * 1.0, min(number * 1.0, high * 1.0)); diff --git a/lib/wheel_spinner.dart b/lib/wheel_spinner.dart index febd952..73fb754 100644 --- a/lib/wheel_spinner.dart +++ b/lib/wheel_spinner.dart @@ -1,3 +1,4 @@ +/// The main library for the wheel spinner. library wheel_spinner; import 'package:flutter/material.dart';