GithubHelp home page GithubHelp logo

rvamsikrishna / flutter_fluid_slider Goto Github PK

View Code? Open in Web Editor NEW
322.0 5.0 47.0 74 KB

A fluid design slider that works just like the Slider material widget.

License: MIT License

Java 4.74% Objective-C 3.87% Dart 89.13% Shell 2.26%
widget fluid-slider slider flutter flutter-plugin

flutter_fluid_slider's Introduction

Fluid Slider for Flutter

Awesome Flutter

Inspired by a dribbble by Virgil Pana.

demo

A fluid design slider that works just like the Slider material widget.

Used to select from a range of values.

Installation

Just add the package to your dependencies in the pubspec.yaml file:

dependencies:
  flutter_fluid_slider: ^1.0.2

Basic Usage

Place the FluidSlider in your widget tree.

FluidSlider(
  value: _value,
  onChanged: (double newValue) {
    setState(() {
      _value = newValue;
    });
  },
  min: 0.0,
  max: 100.0,
),

Properties

  • value : [Required] The currently selected value for this slider. The slider's thumb is drawn at a position that corresponds to this value.

  • min : The minimum value the user can select. Defaults to 0.0. Must be less than or equal to max.

  • max : The maximum value the user can select. Defaults to 1.0. Must be less than or equal to min.

  • start : The widget to be displayed as the min label. For eg: an Icon can be displayed. If not provided the min value is displayed as text.

  • end : The widget to be displayed as the max label. For eg: an Icon can be displayed. If not provided the max value is displayed as text.

  • onChanged : [Required] Called during a drag when the user is selecting a new value for the slider

    by dragging.

    • The slider passes the new value to the callback but does not actually change state until the parent widget rebuilds the slider with the new value.

    • If null, the slider will be displayed as disabled.

  • onChangeStart : Called when the user starts selecting a new value for the slider. The value passed will be the last value that the slider had before the change began.

  • onChangeEnd : Called when the user is done selecting a new value for the slider.

  • labelsTextStyle : The styling of the min and max text that gets displayed on the slider. If not provided the ancestor Theme's accentTextTheme text style will be applied.

  • valueTextStyle : The styling of the current value text that gets displayed on the slider. If not provided the ancestor Theme's textTheme.title text style with bold will be applied .

  • sliderColor : The color of the slider. If not provided the ancestor Theme's primaryColor will be applied.

  • thumbColor : The color of the thumb. If not provided the Colors.white will be applied.

  • showDecimalValue : Whether to display the first decimal value of the slider value. Defaults to false.

  • mapValueToString : called with value for the String to be rendered in the slider's thumb. E.g. display roman integers as follows:

    FluidSlider(
      value:_val,
      min:1.0,
      max:5.0,
      onChanged:(){},
      mapValueToString: (double value){
        List<String> romanNumerals=['I', 'II', 'III', 'IV', 'V'];
        return _romanNumerals[value.toInt() - 1];
      }
    )

    See example. If null the value is converted to String based on [showDecimalValue].

Credits:

flutter_fluid_slider's People

Contributors

diegoveloper avatar jcsena avatar radeksvarz avatar rvamsikrishna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flutter_fluid_slider's Issues

Bounce effect is delayed

The bounce effect in the thumb the comes in with a delay, which seems a bit jittery or off.

example

Proposed a couple of solutions in #14

Does this support web?

I see in pub.dev that it support web but i don't see the slider works in web, could you please confirm.

TextTheme error when using flutter_fluid_slider

Compile failed

../.pub-cache/hosted/pub.dartlang.org/flutter_fluid_slider-1.0.3/lib/flutter_fluid_slider.dart:292:14: Error: The getter 'subhead' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('packages/flutter/lib/src/material/text_theme.dart').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'subhead'.

        .subhead

         ^^^^^^^

../.pub-cache/hosted/pub.dartlang.org/flutter_fluid_slider-1.0.3/lib/flutter_fluid_slider.dart:296:14: Error: The getter 'title' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('packages/flutter/lib/src/material/text_theme.dart').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'title'.

        .title

         ^^^^^

../.pub-cache/hosted/pub.dartlang.org/flutter_fluid_slider-1.0.3/lib/flutter_fluid_slider.dart:482:69: Error: The getter 'title' isn't defined for the class 'TextTheme'.

  • 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('packages/flutter/lib/src/material/text_theme.dart').

Try correcting the name to the name of an existing getter, or defining a getter or field named 'title'.

          style: textStyle ?? Theme.of(context).accentTextTheme.title,

                                                                ^^^^^

Migrate to NNBD

🚀 Feature Requests

Migrate to NNBD

Any plans on null-safety migration?

Platforms affected

IOS
ANDROID

Slider value changes when selecting it or when removing finger

With decimals shown and a range of 1.0-30.0 the slider will jump several values when you press on it and when you remove your finger too.

IE, initial value of 7.0 - apply finger, jumps to 7.8. Adjust value to 12.4 and remove finger, the value jumps to 12.2. It's not a consistent jump but makes it nearly impossible to select the exact value that you wish.

Can't slide :(

Hello,

Good job ! Everything works fine except that I can't slide :/ The fluid animation appen when I press the slider but nothing when I slide to left or right :/

[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.5, on Microsoft Windows [version 10.0.18362.418], locale fr-FR)
• Flutter version 1.9.1+hotfix.5 at C:\src\flutter
• Framework revision 1aedbb1835 (3 days ago), 2019-10-17 08:37:27 -0700
• Engine revision b863200c37
• Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\quent\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[!] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.39.2)
• VS Code at C:\Users\quent\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.5.1

[√] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 8.0.0 (API 26) (emulator)

! Doctor found issues in 1 category.
exit code 0

slider disables when onClick happend

Is there any way to stop the slider from disabling when er was a onClick event. I want all times te value can be changed, in the app the slider is a volume slider.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.