mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 00:14:42 +01:00
Improve map marker readability
This commit is contained in:
parent
17e7aa55f3
commit
0c8b611e46
1 changed files with 17 additions and 6 deletions
|
@ -60,7 +60,13 @@ class _MapViewState extends State<_MapView> {
|
||||||
}) async {
|
}) async {
|
||||||
final PictureRecorder pictureRecorder = PictureRecorder();
|
final PictureRecorder pictureRecorder = PictureRecorder();
|
||||||
final Canvas canvas = Canvas(pictureRecorder);
|
final Canvas canvas = Canvas(pictureRecorder);
|
||||||
final Paint paint1 = Paint()..color = color;
|
final fillPaint = Paint()..color = color;
|
||||||
|
final outlinePaint = Paint()
|
||||||
|
..color = Theme.of(context).brightness == Brightness.light
|
||||||
|
? Colors.black.withOpacity(.28)
|
||||||
|
: Colors.white.withOpacity(.6)
|
||||||
|
..strokeWidth = size / 28
|
||||||
|
..style = PaintingStyle.stroke;
|
||||||
|
|
||||||
const shadowPadding = 6.0;
|
const shadowPadding = 6.0;
|
||||||
const shadowPaddingHalf = shadowPadding / 2;
|
const shadowPaddingHalf = shadowPadding / 2;
|
||||||
|
@ -71,7 +77,12 @@ class _MapViewState extends State<_MapView> {
|
||||||
canvas.drawCircle(
|
canvas.drawCircle(
|
||||||
Offset(size / 2 - shadowPaddingHalf, size / 2 - shadowPaddingHalf),
|
Offset(size / 2 - shadowPaddingHalf, size / 2 - shadowPaddingHalf),
|
||||||
size / 2 - shadowPaddingHalf,
|
size / 2 - shadowPaddingHalf,
|
||||||
paint1,
|
fillPaint,
|
||||||
|
);
|
||||||
|
canvas.drawCircle(
|
||||||
|
Offset(size / 2 - shadowPaddingHalf, size / 2 - shadowPaddingHalf),
|
||||||
|
size / 2 - shadowPaddingHalf - (size / 28 / 2),
|
||||||
|
outlinePaint,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
|
@ -79,7 +90,7 @@ class _MapViewState extends State<_MapView> {
|
||||||
painter.text = TextSpan(
|
painter.text = TextSpan(
|
||||||
text: text,
|
text: text,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size / 3.5,
|
fontSize: size / 3 - ((text.length / 6) * (size * 0.1)),
|
||||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
|
@ -134,14 +145,14 @@ class _MapViewState extends State<_MapView> {
|
||||||
return HSLColor.fromAHSL(
|
return HSLColor.fromAHSL(
|
||||||
1,
|
1,
|
||||||
_colorHsl.hue,
|
_colorHsl.hue,
|
||||||
r * .8 + .2,
|
r * .7 + .3,
|
||||||
(_colorHsl.lightness - (.1 - r * .1)).clamp(0, 1),
|
(_colorHsl.lightness - (.1 - r * .1)).clamp(0, 1),
|
||||||
).toColor();
|
).toColor();
|
||||||
} else {
|
} else {
|
||||||
return HSLColor.fromAHSL(
|
return HSLColor.fromAHSL(
|
||||||
1,
|
1,
|
||||||
_colorHsl.hue,
|
_colorHsl.hue,
|
||||||
r * .65 + .35,
|
r * .6 + .4,
|
||||||
(_colorHsl.lightness - (.1 - r * .1)).clamp(0, 1),
|
(_colorHsl.lightness - (.1 - r * .1)).clamp(0, 1),
|
||||||
).toColor();
|
).toColor();
|
||||||
}
|
}
|
||||||
|
@ -162,7 +173,7 @@ class _MapViewState extends State<_MapView> {
|
||||||
default:
|
default:
|
||||||
r = (count / 10) * step;
|
r = (count / 10) * step;
|
||||||
}
|
}
|
||||||
return (r * 85).toInt() + 75;
|
return (r * 85).toInt() + 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
late final _clusterManager = ClusterManager<_DataPoint>(
|
late final _clusterManager = ClusterManager<_DataPoint>(
|
||||||
|
|
Loading…
Add table
Reference in a new issue