Skip to content

Commit

Permalink
version 2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-Azmoud committed Jul 14, 2019
1 parent e1b2862 commit a139826
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 82 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@

## [2.4.3] - 04/11/2019

* hatchMark label textStyle added
* hatchMark label textStyle added

## [2.4.4] - 07/14/2019

* hatchMark label position bug fixed
* trackbar style changed to BoxDecoration
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# flutter_xlider

(Flutter Xlider) A material design slider and range slider, horizontal and vertical, with rtl support and lots of options and customizations for flutter
(Flutter Slider) A material design slider and range slider, horizontal and vertical, with rtl support and lots of options and customizations for flutter

**Version 2.4.1 and above, will break functionality of older versions**
**Version 2.4.4 and above, break functionality of older versions**

## Get Started

Expand Down Expand Up @@ -136,14 +136,35 @@ To customize track bars you can use `FlutterSliderTrackBar`. [You can see the de
FlutterSlider(
...
trackBar: FlutterSliderTrackBar(
activeTrackBarColor: Colors.redAccent,
activeTrackBarHeight: 5,
inactiveTrackBarColor: Colors.greenAccent.withOpacity(0.5),
),
...
)
```


`inactiveTrackBarColor` and `activeTrackBarColor` properties are removed. use `inactiveTrackBar` and `activeTrackBar` instead.

```dart
FlutterSlider(
...
trackBar: FlutterSliderTrackBar(
inactiveTrackBar: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black12,
border: Border.all(width: 3, color: Colors.blue),
),
activeTrackBar: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.blue.withOpacity(0.5)
),
),
...
)
```

![](images/trackbar_box_decoration.PNG)

## Tooltips

In order to customize your tooltips, you can use `FlutterSliderTooltip` class. [You can see all properties here](https://pub.dartlang.org/documentation/flutter_xlider/latest/flutter_xlider/FlutterSliderTooltip/FlutterSliderTooltip.html)
Expand Down
64 changes: 35 additions & 29 deletions example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class _MyHomePageState extends State<MyHomePage> {
curve: Curves.elasticOut,
reverseCurve: null,
duration: Duration(milliseconds: 700),
scale: 1.4
),
scale: 1.4),
onDragging: (handlerIndex, lowerValue, upperValue) {
_lowerValue = lowerValue;
_upperValue = upperValue;
Expand All @@ -84,7 +83,6 @@ class _MyHomePageState extends State<MyHomePage> {
jump: true,

trackBar: FlutterSliderTrackBar(
activeTrackBarColor: Colors.redAccent,
activeTrackBarHeight: 5,
),
tooltip: FlutterSliderTooltip(
Expand All @@ -99,11 +97,18 @@ class _MyHomePageState extends State<MyHomePage> {
elevation: 10,
child: Container(
padding: EdgeInsets.all(5),
child: Icon(Icons.adjust, size: 25,)),
child: Icon(
Icons.adjust,
size: 25,
)),
),
),
rightHandler: FlutterSliderHandler(
child: Icon(Icons.chevron_left, color: Colors.red, size: 24,),
child: Icon(
Icons.chevron_left,
color: Colors.red,
size: 24,
),
),
disabled: false,

Expand All @@ -113,7 +118,6 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {});
},
)),

Container(
margin: EdgeInsets.only(top: 50, left: 20, right: 20),
alignment: Alignment.centerLeft,
Expand All @@ -131,7 +135,6 @@ class _MyHomePageState extends State<MyHomePage> {
step: 100,
jump: true,
trackBar: FlutterSliderTrackBar(
activeTrackBarColor: Colors.blue.withOpacity(0.6),
inactiveTrackBarHeight: 2,
activeTrackBarHeight: 3,
),
Expand All @@ -142,8 +145,16 @@ class _MyHomePageState extends State<MyHomePage> {
rightHandler: customHandler(Icons.chevron_left),
tooltip: FlutterSliderTooltip(
numberFormat: intl.NumberFormat(),
leftPrefix: Icon(Icons.attach_money, size: 19, color: Colors.black45,),
rightSuffix: Icon(Icons.attach_money, size: 19, color: Colors.black45,),
leftPrefix: Icon(
Icons.attach_money,
size: 19,
color: Colors.black45,
),
rightSuffix: Icon(
Icons.attach_money,
size: 19,
color: Colors.black45,
),
textStyle: TextStyle(fontSize: 17, color: Colors.black45),
),

Expand All @@ -153,7 +164,6 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {});
},
)),

Container(
margin: EdgeInsets.only(top: 20, left: 20, right: 20),
alignment: Alignment.centerLeft,
Expand All @@ -176,11 +186,6 @@ class _MyHomePageState extends State<MyHomePage> {
},
),
),





Container(
margin: EdgeInsets.only(top: 50, left: 50, right: 50),
alignment: Alignment.centerLeft,
Expand All @@ -190,6 +195,18 @@ class _MyHomePageState extends State<MyHomePage> {
max: 100,
min: 0,
visibleTouchArea: true,
trackBar: FlutterSliderTrackBar(
inactiveTrackBarHeight: 14,
activeTrackBarHeight: 10,
inactiveTrackBar: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black12,
border: Border.all(width: 3, color: Colors.blue),
),
activeTrackBar: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.blue.withOpacity(0.5)),
),
onDragging: (handlerIndex, lowerValue, upperValue) {
_lowerValue = lowerValue;
_upperValue = upperValue;
Expand All @@ -198,10 +215,6 @@ class _MyHomePageState extends State<MyHomePage> {
),
),





/*Hatch Mark Example*/
Container(
height: 50,
Expand All @@ -220,9 +233,7 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
jump: true,
trackBar: FlutterSliderTrackBar(
activeTrackBarColor: Colors.blue[500],
),
trackBar: FlutterSliderTrackBar(),
handler: FlutterSliderHandler(
decoration: BoxDecoration(),
child: Container(
Expand Down Expand Up @@ -251,8 +262,6 @@ class _MyHomePageState extends State<MyHomePage> {
onDragging: (handlerIndex, lowerValue, upperValue) {},
),
),


SizedBox(
height: 50,
),
Expand All @@ -264,17 +273,14 @@ class _MyHomePageState extends State<MyHomePage> {
);
}


customHandler(IconData icon){
customHandler(IconData icon) {
return FlutterSliderHandler(
decoration: BoxDecoration(),
child: Container(
child: Container(
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.3),
shape: BoxShape.circle
),
color: Colors.blue.withOpacity(0.3), shape: BoxShape.circle),
child: Icon(
icon,
color: Colors.white,
Expand Down
Binary file added images/trackbar_box_decoration.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a139826

Please sign in to comment.