Skip to content

Commit 0e84596

Browse files
Sandip KakadiyaSandip Kakadiya
authored andcommitted
changes in rating component
1 parent 01cbc92 commit 0e84596

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

lib/components/rating/gf_rating.dart

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -83,32 +83,29 @@ class _GFRatingState extends State<GFRating> {
8383
Widget buildRatingBar(BuildContext context, int index) {
8484
Widget icon;
8585
if (index >= widget.value) {
86-
icon = widget.defaultIcon != null
87-
? widget.defaultIcon
88-
: Icon(
89-
Icons.star_border,
90-
color: widget.borderColor ?? Theme.of(context).primaryColor,
91-
size: GFSizesClass.getGFSize(widget.size),
92-
);
86+
icon = widget.defaultIcon ??
87+
Icon(
88+
Icons.star_border,
89+
color: widget.borderColor ?? Theme.of(context).primaryColor,
90+
size: GFSizesClass.getGFSize(widget.size),
91+
);
9392
} else if (!widget.showTextForm
9493
? index > widget.value - (widget.allowHalfRating ? 0.5 : 1.0) &&
9594
index < widget.value
9695
: index + 1 == widget.value + 0.5) {
97-
icon = widget.halfFilledIcon != null
98-
? widget.halfFilledIcon
99-
: Icon(
100-
Icons.star_half,
101-
color: widget.color ?? Theme.of(context).primaryColor,
102-
size: GFSizesClass.getGFSize(widget.size),
103-
);
96+
icon = widget.halfFilledIcon ??
97+
Icon(
98+
Icons.star_half,
99+
color: widget.color ?? Theme.of(context).primaryColor,
100+
size: GFSizesClass.getGFSize(widget.size),
101+
);
104102
} else {
105-
icon = widget.filledIcon != null
106-
? widget.filledIcon
107-
: Icon(
108-
Icons.star,
109-
color: widget.color ?? Theme.of(context).primaryColor,
110-
size: GFSizesClass.getGFSize(widget.size),
111-
);
103+
icon = widget.filledIcon ??
104+
Icon(
105+
Icons.star,
106+
color: widget.color ?? Theme.of(context).primaryColor,
107+
size: GFSizesClass.getGFSize(widget.size),
108+
);
112109
}
113110

114111
return GestureDetector(
@@ -145,14 +142,13 @@ class _GFRatingState extends State<GFRating> {
145142
child: TextFormField(
146143
controller: widget.controller,
147144
keyboardType: TextInputType.number,
148-
decoration: widget.inputDecorations == null
149-
? InputDecoration(
150-
border: const OutlineInputBorder(),
151-
hintText: 'Enter rating',
152-
labelText: 'Enter rating',
153-
suffixIcon: widget.suffixIcon,
154-
)
155-
: widget.inputDecorations,
145+
decoration: widget.inputDecorations ??
146+
InputDecoration(
147+
border: const OutlineInputBorder(),
148+
hintText: 'Enter rating',
149+
labelText: 'Enter rating',
150+
suffixIcon: widget.suffixIcon,
151+
),
156152
),
157153
),
158154
Material(

0 commit comments

Comments
 (0)