Skip to content

Commit 671ed72

Browse files
committed
Switch from sy_flutter_widgets package to rating_bar package for FormBuilderRate field
1 parent 2095f3b commit 671ed72

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

lib/src/fields/form_builder_rate.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/widgets.dart';
33
import 'package:flutter_form_builder/flutter_form_builder.dart';
4-
import 'package:sy_flutter_widgets/sy_flutter_widgets.dart';
4+
import 'package:rating_bar/rating_bar.dart';
55

66
class FormBuilderRate extends StatefulWidget {
77
final String attribute;
@@ -20,11 +20,11 @@ class FormBuilderRate extends StatefulWidget {
2020
FormBuilderRate({
2121
Key key,
2222
@required this.attribute,
23-
this.initialValue = 1,
23+
this.initialValue = 1.0,
2424
this.validators = const [],
2525
this.readOnly = false,
2626
this.decoration = const InputDecoration(),
27-
this.max,
27+
this.max = 5.0,
2828
this.icon = Icons.star,
2929
this.iconSize = 24.0,
3030
this.onChanged,
@@ -91,13 +91,13 @@ class _FormBuilderRateState extends State<FormBuilderRate> {
9191
enabled: !_readOnly,
9292
errorText: field.errorText,
9393
),
94-
child: SyRate(
95-
value: field.value,
96-
total: widget.max,
97-
icon: widget.icon,
98-
iconSize: widget.iconSize,
99-
//TODO: When disabled change icon color (Probably deep grey)
100-
onTap: _readOnly
94+
child: RatingBar(
95+
initialRating: field.value,
96+
maxRating: widget.max.toInt(),
97+
filledIcon: widget.icon,
98+
emptyIcon: widget.icon,
99+
size: widget.iconSize,
100+
onRatingChanged: _readOnly
101101
? null
102102
: (value) {
103103
FocusScope.of(context).requestFocus(FocusNode());

pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,13 @@ packages:
333333
url: "https://pub.dartlang.org"
334334
source: hosted
335335
version: "2.0.5"
336+
rating_bar:
337+
dependency: "direct main"
338+
description:
339+
name: rating_bar
340+
url: "https://pub.dartlang.org"
341+
source: hosted
342+
version: "0.2.0"
336343
shelf:
337344
dependency: transitive
338345
description:
@@ -408,13 +415,6 @@ packages:
408415
url: "https://pub.dartlang.org"
409416
source: hosted
410417
version: "1.0.5"
411-
sy_flutter_widgets:
412-
dependency: "direct main"
413-
description:
414-
name: sy_flutter_widgets
415-
url: "https://pub.dartlang.org"
416-
source: hosted
417-
version: "0.1.4"
418418
term_glyph:
419419
dependency: transitive
420420
description:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313

1414
flutter_typeahead: ^1.8.0
1515
intl: ^0.16.1
16-
sy_flutter_widgets: ^0.1.4
1716
flutter_chips_input: ^1.8.1
1817
datetime_picker_formfield: ^1.0.0
1918
flutter_colorpicker: ^0.3.4
@@ -22,6 +21,7 @@ dependencies:
2221
date_range_picker: ^1.0.6
2322
flutter_touch_spin: ^1.0.1
2423
image_picker: ^0.6.5+3
24+
rating_bar: ^0.2.0
2525

2626
dev_dependencies:
2727
flutter_test:

0 commit comments

Comments
 (0)