dart_image_slider 0.0.1 copy "dart_image_slider: ^0.0.1" to clipboard
dart_image_slider: ^0.0.1 copied to clipboard

Easy way to add image as the Slider thumb

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Dart Image Slider'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var _currentValue = 0.0;

  Slider _getSlider() {
    return Slider(
      value: _currentValue,
      max: 100,
      divisions: 10,
      label: _currentValue.round().toString(),
      onChanged: (double value) {
        setState(() {
          _currentValue = value;
        });
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: DartImageSlider(
          slider: _getSlider(),
          imagePath: 'assets/button.png',
        ));
  }
}
1
likes
140
points
27
downloads

Publisher

verified publisherappmarchsoftware.com

Weekly Downloads

Easy way to add image as the Slider thumb

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on dart_image_slider