Skip to content

Commit 112fd13

Browse files
committed
Add optional borders to Many Circles demo
1 parent c340b5e commit 112fd13

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

example/lib/pages/many_circles.dart

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class _ManyCirclesPageState extends State<ManyCirclesPage> {
3131
int numOfCircles = _maxCirclesCount ~/ 10;
3232
List<CircleMarker> allCircles = [];
3333

34+
bool useBorders = false;
3435
bool useRadiusInMeters = false;
3536
bool optimizeRadiusInMeters = true;
3637

@@ -49,7 +50,9 @@ class _ManyCirclesPageState extends State<ManyCirclesPage> {
4950
color: HSLColor.fromAHSL(1, x % 360, 1, doubleInRange(r, 0.3, 0.7))
5051
.toColor(),
5152
radius: 5,
52-
useRadiusInMeter: useRadiusInMeters,
53+
useRadiusInMeter: false,
54+
borderStrokeWidth: 0,
55+
borderColor: Colors.black,
5356
),
5457
);
5558
}
@@ -113,6 +116,31 @@ class _ManyCirclesPageState extends State<ManyCirclesPage> {
113116
),
114117
child: Row(
115118
children: [
119+
const Tooltip(
120+
message: 'Use Borders',
121+
child: Icon(Icons.circle_outlined),
122+
),
123+
const SizedBox(width: 8),
124+
Switch.adaptive(
125+
value: useBorders,
126+
onChanged: (v) {
127+
allCircles = allCircles
128+
.map(
129+
(c) => CircleMarker(
130+
point: c.point,
131+
radius: c.radius,
132+
color: c.color,
133+
useRadiusInMeter: c.useRadiusInMeter,
134+
borderColor: c.borderColor,
135+
borderStrokeWidth: v ? 5 : 0,
136+
),
137+
)
138+
.toList(growable: false);
139+
useBorders = v;
140+
setState(() {});
141+
},
142+
),
143+
const SizedBox(width: 16),
116144
const Tooltip(
117145
message: 'Use Radius In Meters',
118146
child: Icon(Icons.straighten),
@@ -122,12 +150,16 @@ class _ManyCirclesPageState extends State<ManyCirclesPage> {
122150
value: useRadiusInMeters,
123151
onChanged: (v) {
124152
allCircles = allCircles
125-
.map((c) => CircleMarker(
126-
point: c.point,
127-
radius: v ? 25000 : 5,
128-
color: c.color,
129-
useRadiusInMeter: v,
130-
))
153+
.map(
154+
(c) => CircleMarker(
155+
point: c.point,
156+
radius: v ? 25000 : 5,
157+
color: c.color,
158+
useRadiusInMeter: v,
159+
borderColor: c.borderColor,
160+
borderStrokeWidth: c.borderStrokeWidth,
161+
),
162+
)
131163
.toList(growable: false);
132164
useRadiusInMeters = v;
133165
setState(() {});

0 commit comments

Comments
 (0)