Skip to content

Commit 58bf319

Browse files
committed
adding descriptions to variables
1 parent 1a23748 commit 58bf319

File tree

8 files changed

+370
-82
lines changed

8 files changed

+370
-82
lines changed

example/lib/main.dart

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,29 @@ class MyApp extends StatelessWidget {
1010
Widget build(BuildContext context) => MaterialApp(
1111
title: 'GetWidget',
1212
debugShowCheckedModeBanner: false,
13-
home: MyHomePage(),
13+
home: GF(),
1414
);
1515
}
1616

17-
//
17+
class GF extends StatefulWidget {
18+
@override
19+
_GFState createState() => _GFState();
20+
}
21+
22+
class _GFState extends State<GF> {
23+
@override
24+
Widget build(BuildContext context) {
25+
return Scaffold(
26+
body: Container(
27+
child: GFBorder(
28+
child: Text('gvhjnk'),
29+
type: GFBorderType.Oval,
30+
dashedLine: [2, 2],
31+
),
32+
));
33+
}
34+
}
35+
1836
class MyHomePage extends StatefulWidget {
1937
@override
2038
_MyHomePageState createState() => _MyHomePageState();

example/pubspec.lock

Lines changed: 40 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
4+
async:
55
dependency: transitive
66
description:
7-
name: archive
7+
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.0.11"
11-
args:
10+
version: "2.5.0-nullsafety"
11+
boolean_selector:
1212
dependency: transitive
1313
description:
14-
name: args
14+
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.5.2"
18-
async:
17+
version: "2.1.0-nullsafety"
18+
characters:
1919
dependency: transitive
2020
description:
21-
name: async
21+
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "2.4.0"
25-
boolean_selector:
24+
version: "1.1.0-nullsafety.2"
25+
charcode:
2626
dependency: transitive
2727
description:
28-
name: boolean_selector
28+
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.0.5"
32-
charcode:
31+
version: "1.2.0-nullsafety"
32+
clock:
3333
dependency: transitive
3434
description:
35-
name: charcode
35+
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.2"
38+
version: "1.1.0-nullsafety"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.11"
45+
version: "1.15.0-nullsafety.2"
4646
convert:
4747
dependency: transitive
4848
description:
4949
name: convert
5050
url: "https://pub.dartlang.org"
5151
source: hosted
5252
version: "2.1.1"
53-
crypto:
54-
dependency: transitive
55-
description:
56-
name: crypto
57-
url: "https://pub.dartlang.org"
58-
source: hosted
59-
version: "2.1.3"
6053
cupertino_icons:
6154
dependency: "direct main"
6255
description:
6356
name: cupertino_icons
6457
url: "https://pub.dartlang.org"
6558
source: hosted
6659
version: "0.1.3"
60+
fake_async:
61+
dependency: transitive
62+
description:
63+
name: fake_async
64+
url: "https://pub.dartlang.org"
65+
source: hosted
66+
version: "1.1.0-nullsafety"
6767
flutter:
6868
dependency: "direct main"
6969
description: flutter
@@ -75,7 +75,7 @@ packages:
7575
name: flutter_svg
7676
url: "https://pub.dartlang.org"
7777
source: hosted
78-
version: "0.17.1"
78+
version: "0.18.1"
7979
flutter_test:
8080
dependency: "direct dev"
8181
description: flutter
@@ -93,76 +93,55 @@ packages:
9393
relative: true
9494
source: path
9595
version: "1.1.3"
96-
image:
97-
dependency: transitive
98-
description:
99-
name: image
100-
url: "https://pub.dartlang.org"
101-
source: hosted
102-
version: "2.1.4"
10396
matcher:
10497
dependency: transitive
10598
description:
10699
name: matcher
107100
url: "https://pub.dartlang.org"
108101
source: hosted
109-
version: "0.12.6"
102+
version: "0.12.10-nullsafety"
110103
meta:
111104
dependency: transitive
112105
description:
113106
name: meta
114107
url: "https://pub.dartlang.org"
115108
source: hosted
116-
version: "1.1.8"
109+
version: "1.3.0-nullsafety.2"
117110
path:
118111
dependency: transitive
119112
description:
120113
name: path
121114
url: "https://pub.dartlang.org"
122115
source: hosted
123-
version: "1.6.4"
116+
version: "1.8.0-nullsafety"
124117
path_drawing:
125118
dependency: transitive
126119
description:
127120
name: path_drawing
128121
url: "https://pub.dartlang.org"
129122
source: hosted
130-
version: "0.4.1"
123+
version: "0.4.1+1"
131124
path_parsing:
132125
dependency: transitive
133126
description:
134127
name: path_parsing
135128
url: "https://pub.dartlang.org"
136129
source: hosted
137130
version: "0.1.4"
138-
pedantic:
139-
dependency: transitive
140-
description:
141-
name: pedantic
142-
url: "https://pub.dartlang.org"
143-
source: hosted
144-
version: "1.8.0+1"
145131
petitparser:
146132
dependency: transitive
147133
description:
148134
name: petitparser
149135
url: "https://pub.dartlang.org"
150136
source: hosted
151-
version: "2.4.0"
137+
version: "3.0.4"
152138
plugin_platform_interface:
153139
dependency: transitive
154140
description:
155141
name: plugin_platform_interface
156142
url: "https://pub.dartlang.org"
157143
source: hosted
158144
version: "1.0.1"
159-
quiver:
160-
dependency: transitive
161-
description:
162-
name: quiver
163-
url: "https://pub.dartlang.org"
164-
source: hosted
165-
version: "2.0.5"
166145
sky_engine:
167146
dependency: transitive
168147
description: flutter
@@ -174,49 +153,49 @@ packages:
174153
name: source_span
175154
url: "https://pub.dartlang.org"
176155
source: hosted
177-
version: "1.5.5"
156+
version: "1.8.0-nullsafety"
178157
stack_trace:
179158
dependency: transitive
180159
description:
181160
name: stack_trace
182161
url: "https://pub.dartlang.org"
183162
source: hosted
184-
version: "1.9.3"
163+
version: "1.10.0-nullsafety"
185164
stream_channel:
186165
dependency: transitive
187166
description:
188167
name: stream_channel
189168
url: "https://pub.dartlang.org"
190169
source: hosted
191-
version: "2.0.0"
170+
version: "2.1.0-nullsafety"
192171
string_scanner:
193172
dependency: transitive
194173
description:
195174
name: string_scanner
196175
url: "https://pub.dartlang.org"
197176
source: hosted
198-
version: "1.0.5"
177+
version: "1.1.0-nullsafety"
199178
term_glyph:
200179
dependency: transitive
201180
description:
202181
name: term_glyph
203182
url: "https://pub.dartlang.org"
204183
source: hosted
205-
version: "1.1.0"
184+
version: "1.2.0-nullsafety"
206185
test_api:
207186
dependency: transitive
208187
description:
209188
name: test_api
210189
url: "https://pub.dartlang.org"
211190
source: hosted
212-
version: "0.2.11"
191+
version: "0.2.19-nullsafety"
213192
typed_data:
214193
dependency: transitive
215194
description:
216195
name: typed_data
217196
url: "https://pub.dartlang.org"
218197
source: hosted
219-
version: "1.1.6"
198+
version: "1.3.0-nullsafety.2"
220199
url_launcher:
221200
dependency: "direct main"
222201
description:
@@ -251,14 +230,14 @@ packages:
251230
name: vector_math
252231
url: "https://pub.dartlang.org"
253232
source: hosted
254-
version: "2.0.8"
233+
version: "2.1.0-nullsafety.2"
255234
xml:
256235
dependency: transitive
257236
description:
258237
name: xml
259238
url: "https://pub.dartlang.org"
260239
source: hosted
261-
version: "3.5.0"
240+
version: "4.2.0"
262241
sdks:
263-
dart: ">=2.4.0 <3.0.0"
264-
flutter: ">=1.12.8 <2.0.0"
242+
dart: ">=2.10.0-0.0.dev <2.10.0"
243+
flutter: ">=1.18.0-6.0.pre <2.0.0"

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
getwidget:
1313
path: ../
1414
cupertino_icons: ^0.1.2
15-
flutter_svg: ^0.17.1
15+
flutter_svg: ^0.18.0
1616
url_launcher: ^5.4.1
1717

1818
dev_dependencies:
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import 'dart:ui';
2+
import 'package:flutter/material.dart';
3+
import 'package:getwidget/components/border/gf_dashed_border.dart';
4+
import 'package:getwidget/types/gf_border_type.dart';
5+
6+
class GFBorder extends StatelessWidget {
7+
GFBorder({
8+
@required this.child,
9+
this.color = Colors.black,
10+
this.strokeWidth = 1,
11+
this.type = GFBorderType.Rect,
12+
this.dashedLine = const <double>[3, 1],
13+
this.padding = const EdgeInsets.all(10),
14+
this.radius = const Radius.circular(0),
15+
this.customPath,
16+
}) : assert(child != null),
17+
assert(_isValiddashedLine(dashedLine), 'Invalid dash pattern');
18+
19+
/// child of type [Widget] which can be any component or text , etc
20+
final Widget child;
21+
22+
/// padding of time [EdgeInsets] where in padding is given to the border types
23+
final EdgeInsets padding;
24+
25+
/// storkeWidth of type [double] which is used to define the thickness of the border
26+
final double strokeWidth;
27+
28+
/// color of type [Color] or GFColor which is used to change the color of the border type
29+
final Color color;
30+
31+
/// dashedLine of type [List<double>] which is used for the linear and simple dashed line of border
32+
final List<double> dashedLine;
33+
34+
/// type of [GFBorderType] which is used to define the different types of borders ie, circle, Rect, RRect and oval
35+
final GFBorderType type;
36+
37+
/// radius of type [Radius] used to give a curved border only when the border type is RRect, in other cases radius will not work
38+
final Radius radius;
39+
40+
/// customPath of type [PathBuilder] used for drawing the paths
41+
final PathBuilder customPath;
42+
43+
@override
44+
Widget build(BuildContext context) => Stack(
45+
children: <Widget>[
46+
Positioned.fill(
47+
child: CustomPaint(
48+
painter: DashedType(
49+
strokeWidth: strokeWidth,
50+
radius: radius,
51+
color: color,
52+
type: type,
53+
dashedLine: dashedLine,
54+
customPath: customPath,
55+
),
56+
),
57+
),
58+
Container(padding: padding, child: child),
59+
],
60+
);
61+
}
62+
63+
/// the value of dashedLine cannot be 0 or null, it should have some definite and proper value
64+
bool _isValiddashedLine(List<double> dash) {
65+
final Set<double> _dashSet = dash.toSet();
66+
if (_dashSet == null) {
67+
return false;
68+
}
69+
if (_dashSet.length == 1 && _dashSet.elementAt(0) == 0.0) {
70+
return false;
71+
}
72+
if (_dashSet.isEmpty) {
73+
return false;
74+
}
75+
return true;
76+
}

0 commit comments

Comments
 (0)