flutter_2d_slider 0.1.1 copy "flutter_2d_slider: ^0.1.1" to clipboard
flutter_2d_slider: ^0.1.1 copied to clipboard

A Flutter 2D Slider package. Used to select from range of 2 dimensional values with boundary.

flutter_2d_slider #

A Flutter 2D Slider package. Used to select from a range of 2-dimensional values with boundary.

Gif

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_2d_slider: ^0.1.0

Usage #

this slider has 4 required parameters. x position [posx], y position [posy], a callback for thumb location changes Function(double x, double y) [onChange] and thumb size [thumbSize].

[thumbWidget] is optional. so you can modify the thumb widget if you want.

whereas this widget has not any internal state management system. you have to control your x and y values using the [onChange] callback.

Example #

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Offset offset;

  @override
  void initState() {
    offset = new Offset(50, 50);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("flutter 2D Slider Demo"),
      ),
      body: Slider2D(
        offset: offset,
        onChange: (newOffset) {
          setState(() {
            offset = newOffset;
          });
        },
        thumbSize: 20,
      ),
    );
  }
}
2
likes
120
pub points
0%
popularity

Publisher

unverified uploader

A Flutter 2D Slider package. Used to select from range of 2 dimensional values with boundary.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_2d_slider