Skip to content

Commit 78592c2

Browse files
Merge pull request #78 from Sandipkakadiya/review
Review
2 parents e853451 + fe1fe33 commit 78592c2

7 files changed

Lines changed: 109 additions & 20 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ web/
3232
getflutter-app-kit
3333
getflutter-web-kit
3434
getflutter_app
35+
test/.test_coverage.dart
3536

3637
# Android related
3738
**/android/**/gradle-wrapper.jar

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ analyzer:
44
- getflutter_app
55
- getflutter-app-kit
66
- getflutter-web-kit
7+
- test/.test_coverage.dart
78

89
linter:
910
rules:
@@ -13,7 +14,7 @@ linter:
1314
# - always_put_required_named_parameters_first
1415
- always_require_non_null_named_parameters
1516
# - annotate_overrides
16-
# required to Allow bith GFColors and Colors
17+
# required to Allow both GFColors and Colors
1718
# - avoid_annotating_with_dynamic
1819
- avoid_as
1920
- avoid_bool_literals_in_conditional_expressions

example/lib/main.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class _MyHomePageState extends State<MyHomePage>
6767
'Xamarin2',
6868
];
6969

70-
var rating = 3.5;
70+
double rating = 3.5;
7171

7272
@override
7373
Widget build(BuildContext context) => Scaffold(
@@ -79,7 +79,7 @@ class _MyHomePageState extends State<MyHomePage>
7979
gradient: LinearGradient(
8080
begin: Alignment.topRight,
8181
end: Alignment.bottomLeft,
82-
stops: [0.1, 0.5, 0.7, 0.9],
82+
stops: const [0.1, 0.5, 0.7, 0.9],
8383
colors: [
8484
Colors.teal[800],
8585
Colors.teal[600],
@@ -234,21 +234,21 @@ class _MyHomePageState extends State<MyHomePage>
234234
GFCard(
235235
content: Column(
236236
children: <Widget>[
237-
GFTypography(
237+
const GFTypography(
238238
text: 'Toast',
239239
type: GFTypographyType.typo6,
240240
),
241-
SizedBox(
241+
const SizedBox(
242242
height: 20,
243243
),
244-
SizedBox(
244+
const SizedBox(
245245
height: 20,
246246
),
247247
GFToast(
248248
text: 'Happy New Year',
249249
button: GFButton(
250250
onPressed: () {
251-
print("dfr");
251+
print('dfr');
252252
},
253253
text: 'OK',
254254
type: GFButtonType.outline,

lib/components/rating/gf_rating.dart

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import 'package:flutter/material.dart';
22

3-
typedef void RatingChangeCallback(double rating);
3+
typedef RatingChangeCallback = void Function(double rating);
44

55
class GFRating extends StatelessWidget {
6-
GFRating({
6+
const GFRating({
77
this.itemCount = 5,
88
this.spacing = 0.0,
99
this.rating = 0.0,
@@ -15,9 +15,7 @@ class GFRating extends StatelessWidget {
1515
this.filledIcon,
1616
this.halfFilledIcon,
1717
this.allowHalfRating = true,
18-
}) {
19-
assert(this.rating != null);
20-
}
18+
}) : assert(rating != null);
2119

2220
/// defines total number of rating items
2321
final int itemCount;
@@ -61,7 +59,7 @@ class GFRating extends StatelessWidget {
6159
size: itemSize,
6260
);
6361
} else if (index > rating - (allowHalfRating ? 0.5 : 1.0) &&
64-
index < rating) {
62+
index <= rating) {
6563
icon = Icon(
6664
halfFilledIcon != null ? halfFilledIcon : Icons.star_half,
6765
color: color ?? Theme.of(context).primaryColor,
@@ -77,9 +75,10 @@ class GFRating extends StatelessWidget {
7775

7876
return GestureDetector(
7977
onTap: () {
80-
if (onRatingChanged != null) onRatingChanged(index + 1.0);
78+
if (onRatingChanged != null) {
79+
onRatingChanged(index + 1.0);
80+
}
8181
},
82-
// onHorizontalDragStart: ,
8382
child: icon,
8483
);
8584
}
@@ -88,9 +87,12 @@ class GFRating extends StatelessWidget {
8887
Widget build(BuildContext context) => Material(
8988
color: Colors.transparent,
9089
child: Wrap(
91-
alignment: WrapAlignment.center,
92-
spacing: spacing,
93-
children: List.generate(
94-
itemCount, (index) => buildRatingBar(context, index))),
90+
alignment: WrapAlignment.center,
91+
spacing: spacing,
92+
children: List.generate(
93+
itemCount,
94+
(index) => buildRatingBar(context, index),
95+
),
96+
),
9597
);
9698
}

pubspec.lock

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ packages:
5050
url: "https://pub.dartlang.org"
5151
source: hosted
5252
version: "2.1.1"
53+
coverage:
54+
dependency: transitive
55+
description:
56+
name: coverage
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "0.13.4"
5360
crypto:
5461
dependency: transitive
5562
description:
@@ -67,13 +74,48 @@ packages:
6774
description: flutter
6875
source: sdk
6976
version: "0.0.0"
77+
glob:
78+
dependency: transitive
79+
description:
80+
name: glob
81+
url: "https://pub.dartlang.org"
82+
source: hosted
83+
version: "1.2.0"
7084
image:
7185
dependency: transitive
7286
description:
7387
name: image
7488
url: "https://pub.dartlang.org"
7589
source: hosted
7690
version: "2.1.4"
91+
js:
92+
dependency: transitive
93+
description:
94+
name: js
95+
url: "https://pub.dartlang.org"
96+
source: hosted
97+
version: "0.6.1+1"
98+
json_annotation:
99+
dependency: transitive
100+
description:
101+
name: json_annotation
102+
url: "https://pub.dartlang.org"
103+
source: hosted
104+
version: "3.0.1"
105+
lcov:
106+
dependency: transitive
107+
description:
108+
name: lcov
109+
url: "https://pub.dartlang.org"
110+
source: hosted
111+
version: "5.5.0"
112+
logging:
113+
dependency: transitive
114+
description:
115+
name: logging
116+
url: "https://pub.dartlang.org"
117+
source: hosted
118+
version: "0.11.4"
77119
matcher:
78120
dependency: transitive
79121
description:
@@ -88,6 +130,27 @@ packages:
88130
url: "https://pub.dartlang.org"
89131
source: hosted
90132
version: "1.1.8"
133+
node_interop:
134+
dependency: transitive
135+
description:
136+
name: node_interop
137+
url: "https://pub.dartlang.org"
138+
source: hosted
139+
version: "1.0.3"
140+
node_io:
141+
dependency: transitive
142+
description:
143+
name: node_io
144+
url: "https://pub.dartlang.org"
145+
source: hosted
146+
version: "1.0.1+2"
147+
package_config:
148+
dependency: transitive
149+
description:
150+
name: package_config
151+
url: "https://pub.dartlang.org"
152+
source: hosted
153+
version: "1.1.0"
91154
path:
92155
dependency: transitive
93156
description:
@@ -121,6 +184,13 @@ packages:
121184
description: flutter
122185
source: sdk
123186
version: "0.0.99"
187+
source_maps:
188+
dependency: transitive
189+
description:
190+
name: source_maps
191+
url: "https://pub.dartlang.org"
192+
source: hosted
193+
version: "0.10.8"
124194
source_span:
125195
dependency: transitive
126196
description:
@@ -163,6 +233,13 @@ packages:
163233
url: "https://pub.dartlang.org"
164234
source: hosted
165235
version: "0.2.11"
236+
test_coverage:
237+
dependency: "direct dev"
238+
description:
239+
name: test_coverage
240+
url: "https://pub.dartlang.org"
241+
source: hosted
242+
version: "0.4.1"
166243
typed_data:
167244
dependency: transitive
168245
description:
@@ -177,6 +254,13 @@ packages:
177254
url: "https://pub.dartlang.org"
178255
source: hosted
179256
version: "2.0.8"
257+
vm_service:
258+
dependency: transitive
259+
description:
260+
name: vm_service
261+
url: "https://pub.dartlang.org"
262+
source: hosted
263+
version: "2.3.1"
180264
xml:
181265
dependency: transitive
182266
description:
@@ -185,4 +269,4 @@ packages:
185269
source: hosted
186270
version: "3.5.0"
187271
sdks:
188-
dart: ">=2.4.0 <3.0.0"
272+
dart: ">=2.6.0 <3.0.0"

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies:
1515
dev_dependencies:
1616
flutter_test:
1717
sdk: flutter
18+
test_coverage: ^0.4.1
1819

1920
flutter:
2021
uses-material-design: true

0 commit comments

Comments
 (0)