Skip to content

Commit b452211

Browse files
author
LokeshPalani
committed
Added missed theme file for maps
1 parent a655ac4 commit b452211

File tree

1 file changed

+160
-0
lines changed
  • packages/syncfusion_flutter_maps/lib/src

1 file changed

+160
-0
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:syncfusion_flutter_core/theme.dart';
3+
4+
/// [SfMapsThemeDataM2] this class provides material2 themeData.
5+
/// SfMapsThemeDataM2 class extends the 'SfMapsThemeData' class and customize
6+
/// the appearance of a mapping component based on th color scheme obtained from
7+
/// the provided [BuildContext].
8+
class SfMapsThemeDataM2 extends SfMapsThemeData {
9+
/// This a constructor that takes a [BuildContext] as a parameter.This context
10+
/// is used for obtaining the color scheme of the current theme.
11+
SfMapsThemeDataM2(this.context);
12+
13+
/// Property that stores the provided [BuildContext]
14+
/// context is later used to obtain the color scheme.
15+
final BuildContext context;
16+
17+
/// A late-initialized property representing the color scheme obtained from
18+
/// the current theme using the provided [BuildContext]
19+
late final ColorScheme colorScheme = Theme.of(context).colorScheme;
20+
21+
/// Specifies the sub layer color of the maps widgets.
22+
Color get subLayerColor => colorScheme.brightness == Brightness.light
23+
? const Color.fromRGBO(198, 198, 198, 1)
24+
: const Color.fromRGBO(71, 71, 71, 1);
25+
26+
/// Specifies the sub layer stroke color of the maps widgets.
27+
Color get subLayerStrokeColor => colorScheme.brightness == Brightness.light
28+
? const Color.fromRGBO(145, 145, 145, 1)
29+
: const Color.fromRGBO(133, 133, 133, 1);
30+
31+
/// Specifies the sub layer width of the maps widgets.
32+
double get subLayerStrokeWidth =>
33+
colorScheme.brightness == Brightness.light ? 0.5 : 0.25;
34+
35+
@override
36+
Color? get layerColor => (colorScheme.brightness == Brightness.light
37+
? colorScheme.onSurface.withOpacity(0.11)
38+
: colorScheme.onSurface.withOpacity(0.24));
39+
40+
@override
41+
Color? get layerStrokeColor => (colorScheme.brightness == Brightness.light
42+
? colorScheme.onSurface.withOpacity(0.18)
43+
: colorScheme.onSurface.withOpacity(0.43));
44+
45+
@override
46+
Color? get markerIconColor => (colorScheme.brightness == Brightness.light
47+
? const Color.fromRGBO(98, 0, 238, 1)
48+
: const Color.fromRGBO(187, 134, 252, 1));
49+
50+
@override
51+
Color? get bubbleColor => (colorScheme.brightness == Brightness.light
52+
? const Color.fromRGBO(98, 0, 238, 0.5)
53+
: const Color.fromRGBO(187, 134, 252, 0.8));
54+
55+
@override
56+
Color? get bubbleStrokeColor => Colors.transparent;
57+
58+
@override
59+
Color? get selectionColor => (colorScheme.brightness == Brightness.light
60+
? colorScheme.onSurface.withOpacity(0.53)
61+
: colorScheme.onSurface.withOpacity(0.85));
62+
63+
@override
64+
Color? get selectionStrokeColor => (colorScheme.brightness == Brightness.light
65+
? colorScheme.onPrimary.withOpacity(0.29)
66+
: colorScheme.surface.withOpacity(0.56));
67+
68+
@override
69+
Color? get tooltipColor => (colorScheme.brightness == Brightness.light
70+
? const Color.fromRGBO(117, 117, 117, 1)
71+
: const Color.fromRGBO(245, 245, 245, 1));
72+
73+
@override
74+
Color? get toggledItemColor => (colorScheme.brightness == Brightness.light
75+
? colorScheme.onPrimary
76+
: colorScheme.onSurface.withOpacity(0.09));
77+
78+
@override
79+
Color? get toggledItemStrokeColor =>
80+
(colorScheme.brightness == Brightness.light
81+
? colorScheme.onSurface.withOpacity(0.37)
82+
: colorScheme.onSurface.withOpacity(0.17));
83+
}
84+
85+
/// [SfMapsThemeDataM3] this class provides material3 themeData.
86+
/// SfMapsThemeDataM2 class extends the 'SfMapsThemeData' class and customize
87+
/// the appearance of a mapping component based on th color scheme obtained from
88+
/// the provided [BuildContext].
89+
class SfMapsThemeDataM3 extends SfMapsThemeData {
90+
/// This a constructor that takes a [BuildContext] as a parameter.This context
91+
/// is used for obtaining the color scheme of the current theme.
92+
SfMapsThemeDataM3(this.context);
93+
94+
/// Property that stores the provided [BuildContext]
95+
/// context is later used to obtain the color scheme.
96+
final BuildContext context;
97+
98+
/// A late-initialized property representing the color scheme obtained from
99+
/// the current theme using the provided [BuildContext]
100+
late final ColorScheme colorScheme = Theme.of(context).colorScheme;
101+
102+
/// Specifies the sub layer color of the maps widgets.
103+
Color get subLayerColor => colorScheme.brightness == Brightness.light
104+
? const Color.fromRGBO(198, 198, 198, 1)
105+
: const Color.fromRGBO(71, 71, 71, 1);
106+
107+
/// Specifies the sub layer stroke color of the maps widgets.
108+
Color get subLayerStrokeColor => colorScheme.brightness == Brightness.light
109+
? const Color.fromRGBO(145, 145, 145, 1)
110+
: const Color.fromRGBO(133, 133, 133, 1);
111+
112+
/// Specifies the sub layer width of the maps widgets.
113+
double get subLayerStrokeWidth =>
114+
colorScheme.brightness == Brightness.light ? 0.5 : 0.25;
115+
116+
@override
117+
Color? get layerColor => (colorScheme.brightness == Brightness.light
118+
? const Color.fromRGBO(231, 224, 236, 1)
119+
: const Color.fromRGBO(54, 50, 59, 1));
120+
121+
@override
122+
Color? get layerStrokeColor => (colorScheme.brightness == Brightness.light
123+
? const Color.fromRGBO(202, 196, 208, 1)
124+
: const Color.fromRGBO(73, 69, 79, 1));
125+
126+
@override
127+
Color? get markerIconColor => colorScheme.primary;
128+
129+
@override
130+
Color? get bubbleColor => (colorScheme.brightness == Brightness.light
131+
? const Color.fromRGBO(255, 180, 0, 0.4)
132+
: const Color.fromRGBO(201, 88, 142, 0.4));
133+
134+
@override
135+
Color? get bubbleStrokeColor => const Color.fromRGBO(255, 255, 255, 0.4);
136+
137+
@override
138+
Color? get selectionColor => (colorScheme.brightness == Brightness.light
139+
? const Color.fromRGBO(202, 196, 208, 1)
140+
: const Color.fromRGBO(73, 69, 79, 1));
141+
142+
@override
143+
Color? get selectionStrokeColor => (colorScheme.brightness == Brightness.light
144+
? colorScheme.onPrimary.withOpacity(0.29)
145+
: const Color.fromRGBO(73, 69, 79, 1));
146+
147+
@override
148+
Color? get tooltipColor => colorScheme.inverseSurface;
149+
150+
@override
151+
Color? get toggledItemColor => (colorScheme.brightness == Brightness.light
152+
? colorScheme.onPrimary
153+
: colorScheme.onSurface.withOpacity(0.09));
154+
155+
@override
156+
Color? get toggledItemStrokeColor =>
157+
(colorScheme.brightness == Brightness.light
158+
? colorScheme.onSurface.withOpacity(0.37)
159+
: colorScheme.onSurface.withOpacity(0.17));
160+
}

0 commit comments

Comments
 (0)