joakimunge / flutter_dial_knob

A customizable knob widget for Flutter.
https://pub.dev/packages/flutter_dial_knob
MIT License
4 stars 0 forks source link
dart dial flutter knob widget

Knob

A customizable dial knob widget for Flutter.

screenshot

Features

Installation

Add this to your pubspec.yaml file:

dependencies:
  flutter_dial_knob: ^0.0.2

Then run:

flutter pub get

or

$ flutter pub add flutter_dial_knob

Usage

Import the package in your Dart file:

import 'package:flutter_dial_knob/flutter_dial_knob.dart';

Use the DialKnob widget in your Flutter app:

import 'package:flutter/material.dart';
import 'package:flutter_dial_knob/flutter_dial_knob.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Dial Knob Example'),
        ),
        body: Center(
          child: DialKnob(
            value: 0.5,
            onChanged: (newValue) {
              print(newValue);
            },
            min: 0,
            max: 1,
            size: 100,
            trackColor: Colors.grey,
            levelColorStart: Colors.green,
            levelColorEnd: Colors.red,
            knobColor: Colors.blue,
            indicatorColor: Colors.white,
          ),
        ),
      ),
    );
  }
}

Customizable Properties

Example

DialKnob(
  value: 0.5,
  onChanged: (newValue) {
    print(newValue);
  },
  min: 0,
  max: 1,
  size: 100,
  trackColor: Colors.grey,
  levelColorStart: Colors.green,
  levelColorEnd: Colors.red,
  knobColor: Colors.blue,
  indicatorColor: Colors.white,
)

License

MIT License. See LICENSE for more information.