slider_gradient 0.2.0
slider_gradient: ^0.2.0 copied to clipboard

A slider with gradient background color.

example/lib/main.dart

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: new MyHomePage(),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  Color color;
  double val1 = 40;
  double val2 = 40;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('slider_gradient'),
      ),
      body: Container(
          // padding: EdgeInsets.all(20),
          child: Column(
        children: [
          SizedBox(
            height: 40,
          ),
          SliderGradient(
            value: val1,
            onChange: (valData) {
              setState(() {
                val1 = valData.value;
              });
            },
            isGradientBg: false,
            isShowLabel: true,
          ),
          SizedBox(
            height: 40,
          ),
          SliderGradient(
            value: val2,
            isShowLabel: true,
            label: "${color ?? 0}",
            onChange: (data) {
              setState(() {
                val2 = data.value;
                color = data.color;
              });
            },
            colors: [Colors.red, Colors.green, Colors.yellow],
          ),
        ],
      )),
    );
  }
}
1
likes
100
pub points
31%
popularity

A slider with gradient background color.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on slider_gradient