flutter_custom_slider 0.0.7 copy "flutter_custom_slider: ^0.0.7" to clipboard
flutter_custom_slider: ^0.0.7 copied to clipboard

A Flutter Custom Slider.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_custom_slider/custom_slider.dart';

void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final themeData = SliderTheme.of(context).copyWith(
        trackHeight: 10,
        overlayColor: Colors.lightGreen.withAlpha(32),
        activeTickMarkColor: Colors.lightGreen,
        activeTrackColor: Colors.grey[300],
        inactiveTrackColor: Colors.grey[300],
        inactiveTickMarkColor: Colors.grey[500]
    );

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Custom Slider Example'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Text("Horizontal with Divisions"),
            CustomSlider(
              activeTrackColor:Colors.green,
              activeTickMarkColor:Colors.amber,
              activeThumpColor:Colors.blue,
              inactiveTrackColor: Colors.grey,
              inactiveTickMarkColor:Colors.amber,
              thumpRadius: 15,
              tickMarkRadius: 5,
              trackHeight: 19,
              onChanged: (value) {
                // Do something
              },
              value: 3,
              divisions: 5,
              marginTrackShape: 30,
            ),
            Divider(),
            Text("Horizontal with Divisions"),
            CustomSlider(
              activeTrackColor:Colors.green,
              activeTickMarkColor:Colors.amber,
              activeThumpColor:Colors.blue,
              inactiveTrackColor: Colors.grey,
              inactiveTickMarkColor:Colors.black,
              thumpRadius: 15,
              tickMarkRadius: 17,
              trackHeight: 19,
              onChanged: (value) {
                // Do something
              },
              value: 3,
              divisions: 5,
              marginTrackShape: 30,
            ),

            Divider(),
            Text("Default"),
            CustomSlider(
              onChanged: (value) { /* no-op */ },
            ),
            Divider(),
            Text("Vertical Orientation"),
            SliderTheme(
              data: themeData,
              child: CustomSlider(
                orientation: RadioSliderOrientation.Vertical,
                onChanged: (value) {
                  print("Value changed: ${value.toString()}");
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
20
pub points
12%
popularity

Publisher

unverified uploader

A Flutter Custom Slider.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_custom_slider