-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom_ui_route.dart
82 lines (76 loc) · 2.53 KB
/
custom_ui_route.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import 'package:design_system_flutter/design_system_flutter.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:sbb_maps_example/env.dart';
import 'package:sbb_maps_example/theme_provider.dart';
import 'package:sbb_maps_example/widgets/theme_segmented_button.dart';
import 'package:sbb_maps_flutter/sbb_maps_flutter.dart';
class CustomUiRoute extends StatefulWidget {
const CustomUiRoute({super.key});
@override
State<CustomUiRoute> createState() => _CustomUiRouteState();
}
class _CustomUiRouteState extends State<CustomUiRoute> {
@override
Widget build(BuildContext context) {
final mapStyler = SBBRokasMapStyler.full(
apiKey: Env.journeyMapsTilesApiKey,
isDarkMode: Provider.of<ThemeProvider>(context).isDark,
);
return Scaffold(
appBar: const SBBHeader(title: 'Custom UI'),
body: SBBMap(
mapStyler: mapStyler,
isMyLocationEnabled: true,
isFloorSwitchingEnabled: true,
builder: (context) => const Align(
alignment: Alignment.topRight,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_ShadowedThemeButton(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.only(right: sbbDefaultSpacing, bottom: sbbDefaultSpacing * 2),
child: SBBMapStyleSwitcher(),
),
Padding(
padding: EdgeInsets.only(right: sbbDefaultSpacing, bottom: sbbDefaultSpacing * 2),
child: SBBMapMyLocationButton(),
),
],
)
],
),
),
),
);
}
}
class _ShadowedThemeButton extends StatelessWidget {
final _blurRadius = 2.0;
final _shadowOffset = const Offset(0, 1);
const _ShadowedThemeButton();
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(sbbDefaultSpacing),
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(sbbDefaultSpacing),
boxShadow: [
BoxShadow(
blurRadius: _blurRadius,
color: SBBColors.black.withOpacity(0.1),
offset: _shadowOffset,
)
],
),
child: const ThemeSegmentedButton(),
),
);
}
}