Skip to content

About

Continuation of the deprecated flutter_number_picker package

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Flutter Number Picker plus is a custom widget designed for choosing an integer or decimal number by using add and minus buttons. This package is a continuation of the package flutter_number_picker by phuongtinhbien, that has not received updates in years and seems to be broken.

Getting Started

  1. Head to /pubspec.yaml and add the dependency like this:
dependencies:
  flutter:
    sdk: flutter
  flutter_number_picker: <latest_version>

OR

dependencies:
  flutter:
    sdk: flutter
  flutter_number_picker:
      git: https://github.com/dreamaviator/flutter_number_picker_plus.git
  1. Run flutter packages get or use the GUI equivalent
  2. Now in your code import 'package:flutter_number_picker_plus/flutter_number_picker.dart';
  3. You're ready to go!

Creating FlutterNumberPicker Widget

CustomNumberPicker(
  initialValue: 10000,
  maxValue: 1000000,
  minValue: 0,
  step: 10000,
  onValue: (num value) {//the value is of the type 'num', so be careful when using float or int
    print(value.toString());
  },
)

Attribute

  • minValue [required] is the minimum value of the ButtonPicker.
  • maxValue [required] is the maximum value of the ButtonPicker.
  • initialValue [required] is the value displayed on load.
  • onValue [required] returns the current value.
  • step defines how much the value should increase or decrease on tap. default = 1.
  • valueTextStyle is the TextStyle of the value.
  • shape is the ShapeBorder of the picker.
  • customAddButton is the Widget.
  • customAddButton is the Widget.

Usage examples

See examples directory for full examples.

Standalone widget

vertical

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plutter number picker'),
        ),
        body: Center(
          child: Container(
            child: CustomNumberPicker(
              initialValue: 10000,
              maxValue: 1000000,
              minValue: 0,
              step: 10000,
              onValue: (value) {
                print(value.toString());
              },
            ),
          ),
        ),
      ),
    );
  }
}

About

Continuation of the deprecated flutter_number_picker package

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages