flutter_score_slider 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Flutter Score Slider #

Simple & customizable Flutter slider widget for score selections.

How to use #

Add flutter_score_slider to your project dependencies

dependencies:
  flutter_score_slider: ^1.0.0

And install it using flutter packages get on your project folder. After that, just import the module and use it:

import 'package:flutter_score_slider/flutter_score_slider.dart';

// ...

ScoreSlider(
  maxScore: 10,
  onScoreChanged: (newScore) {
    setState(() {
      _currentScore = newScore;
      });
    },
  )

Customize colors #

flutter_score_slider supports Flutter's themes and gets its look and feel by the app's default Theme style. If you want to change the colors of the widget you can use the following parameters to set your own colors:

ParameterDescription
backgroundColorSet the background color
thumbColorSet the thumb color (Selected value)
scoreDotColorSet the score values "dots" color

Change Log #

See Change Log page.

Contribution #

Please file feature requests and bugs at the issue tracker.

Author #

Tomer Shalom

[1.0.1] #

  • Fix onScoreChanged parameter typo

[1.0.0] #

  • Initial Release

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Score Slider Demo',
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      home: MyHomePage(title: 'Score Slider Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _currentScore;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              child: ScoreSlider(
                maxScore: 10,
                thumbColor: Colors.blue,
                scoreDotColor: Colors.white,
                onScoreChanged: (newScore) {
                  setState(() {
                    _currentScore = newScore;
                  });
                },
              ),
              padding: EdgeInsets.only(
                left: 20,
                right: 20,
              ),
            ),
            SizedBox(
              height: 5,
            ),
            Text(
              _currentScore == null
                  ? "No Score Selected"
                  : "Selected Score: $_currentScore",
                  style: Theme.of(context).textTheme.subtitle1,
            ),
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_score_slider: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_score_slider/flutter_score_slider.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_score_slider that is a package requiring null.

Health suggestions

Format lib/flutter_score_slider.dart.

Run flutter format to format lib/flutter_score_slider.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test