Skip to content

Commit 701bb17

Browse files
improve map and metric style (#54)
* improve map and metric style * edit screenshots
1 parent 616f642 commit 701bb17

14 files changed

Lines changed: 105 additions & 67 deletions

File tree

banner.png

13.7 KB
Loading

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class MyApp extends HookConsumerWidget {
9191
selectionHandleColor: ColorUtils.main,
9292
),
9393
primaryColor: ColorUtils.main,
94+
splashColor: ColorUtils.blueGreyDarker,
9495
bottomSheetTheme:
9596
BottomSheetThemeData(backgroundColor: ColorUtils.transparent),
9697
),

lib/presentation/common/core/utils/color_utils.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ColorUtils {
2626
static Color greyLight = Colors.grey.shade300;
2727
static Color blueGrey = Colors.blueGrey;
2828
static Color blueGreyDarker = Colors.blueGrey.shade900;
29+
static Color backgroundLight = Colors.white;
2930

3031
/// List of colors used for generating color tuples.
3132
static List<Color> colorList = [

lib/presentation/common/core/utils/image_utils.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ImageUtils {
1616
try {
1717
RenderRepaintBoundary boundary = boundaryKey.currentContext!
1818
.findRenderObject() as RenderRepaintBoundary;
19+
1920
ui.Image image = await boundary.toImage();
2021
ByteData? byteData =
2122
await image.toByteData(format: ui.ImageByteFormat.png);

lib/presentation/common/location/widgets/current_location_map.dart

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class CurrentLocationMap extends HookConsumerWidget {
3737
height: 80,
3838
point: LatLng(currentLatitude, currentLongitude),
3939
child: Icon(
40-
Icons.run_circle_sharp,
41-
size: 30,
42-
color: ColorUtils.red,
40+
Icons.circle,
41+
size: 20,
42+
color: ColorUtils.errorDarker,
4343
),
4444
),
4545
];
@@ -75,12 +75,19 @@ class CurrentLocationMap extends HookConsumerWidget {
7575

7676
return futureProvider.when(data: (total) {
7777
return Expanded(
78-
child: LocationMap(
79-
points: points,
80-
markers: markers,
81-
currentPosition: LatLng(currentLatitude, currentLongitude),
82-
mapController: provider.mapController ?? MapController(),
83-
));
78+
child: SizedBox(
79+
height: 500,
80+
child: ClipRRect(
81+
borderRadius: const BorderRadius.only(
82+
topLeft: Radius.circular(150),
83+
topRight: Radius.circular(150),
84+
),
85+
child: LocationMap(
86+
points: points,
87+
markers: markers,
88+
currentPosition: LatLng(currentLatitude, currentLongitude),
89+
mapController: provider.mapController ?? MapController(),
90+
))));
8491
}, loading: () {
8592
return Expanded(child: Center(child: UIUtils.loader));
8693
}, error: (error, stackTrace) {

lib/presentation/common/location/widgets/location_map.dart

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,29 @@ class LocationMap extends HookConsumerWidget {
2727
final zoomLevel = MapUtils.getZoomLevel(points, center);
2828

2929
return points.isNotEmpty || currentPosition != null
30-
? SizedBox(
31-
height: 500,
32-
child: FlutterMap(
33-
key: ValueKey(MediaQuery.of(context).orientation),
34-
mapController: mapController,
35-
options: MapOptions(
36-
initialCenter: points.isNotEmpty
37-
? center
38-
: currentPosition ?? const LatLng(0, 0),
39-
initialZoom: zoomLevel,
40-
),
41-
children: [
42-
TileLayer(
43-
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
44-
),
45-
PolylineLayer(
46-
polylines: [
47-
Polyline(
48-
points: points,
49-
strokeWidth: 4,
50-
color: ColorUtils.blueGrey),
51-
],
52-
),
53-
MarkerLayer(markers: markers),
54-
],
30+
? FlutterMap(
31+
key: ValueKey(MediaQuery.of(context).orientation),
32+
mapController: mapController,
33+
options: MapOptions(
34+
initialCenter: points.isNotEmpty
35+
? center
36+
: currentPosition ?? const LatLng(0, 0),
37+
initialZoom: zoomLevel,
5538
),
39+
children: [
40+
TileLayer(
41+
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
42+
),
43+
PolylineLayer(
44+
polylines: [
45+
Polyline(
46+
points: points,
47+
strokeWidth: 4,
48+
color: ColorUtils.blueGrey),
49+
],
50+
),
51+
MarkerLayer(markers: markers),
52+
],
5653
)
5754
: Center(child: UIUtils.loader);
5855
}

lib/presentation/common/metrics/widgets/metrics.dart

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Metrics extends HookConsumerWidget {
1414
@override
1515
Widget build(BuildContext context, WidgetRef ref) {
1616
final state = ref.watch(metricsViewModelProvider);
17-
const textStyle = TextStyle(fontSize: 30.0);
17+
const textStyle = TextStyle(fontSize: 26.0, fontWeight: FontWeight.bold);
1818

1919
double speedToDisplay = state.globalSpeed;
2020
double distanceToDisplay = state.distance;
@@ -28,22 +28,36 @@ class Metrics extends HookConsumerWidget {
2828

2929
return Center(
3030
child: Row(
31-
mainAxisSize: MainAxisSize.min,
3231
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
3332
children: [
34-
const Icon(Icons.location_on),
35-
const SizedBox(width: 8),
36-
Text(
37-
'${distanceToDisplay.toStringAsFixed(2)} km',
38-
style: textStyle,
39-
),
40-
const SizedBox(width: 40),
41-
const Icon(Icons.speed),
42-
const SizedBox(width: 8),
43-
Text(
44-
'${speedToDisplay.toStringAsFixed(2)} km/h',
45-
style: textStyle,
46-
),
33+
Row(children: [
34+
const Icon(
35+
Icons.location_on,
36+
size: 45,
37+
),
38+
const SizedBox(width: 8),
39+
Column(children: [
40+
Text(
41+
distanceToDisplay.toStringAsFixed(2),
42+
style: textStyle,
43+
),
44+
const Text('km'),
45+
])
46+
]),
47+
Row(children: [
48+
Column(mainAxisAlignment: MainAxisAlignment.start, children: [
49+
Text(
50+
speedToDisplay.toStringAsFixed(2),
51+
style: textStyle,
52+
),
53+
const Text('km/h'),
54+
]),
55+
const SizedBox(width: 8),
56+
const Icon(
57+
Icons.speed,
58+
size: 45,
59+
),
60+
])
4761
],
4862
),
4963
);

lib/presentation/common/timer/widgets/timer_start.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ class TimerStart extends HookConsumerWidget {
1616

1717
return FloatingActionButton(
1818
heroTag: 'start_button',
19-
backgroundColor:
20-
timerViewModel.hasTimerStarted() ? ColorUtils.red : ColorUtils.main,
19+
backgroundColor: timerViewModel.hasTimerStarted()
20+
? ColorUtils.errorDarker
21+
: ColorUtils.main,
2122
elevation: 4.0,
2223
child: AnimatedSwitcher(
2324
duration: const Duration(milliseconds: 300),

lib/presentation/home/screens/home_screen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class HomeScreen extends HookConsumerWidget {
4444
padding: const EdgeInsets.all(16),
4545
selectedIndex: currentIndex,
4646
onTabChange: (value) {
47-
//locationViewModel.cancelLocationStream();
4847
homeViewModel.setCurrentIndex(value);
4948
},
5049
gap: 8,

lib/presentation/my_activities/widgets/details_tab.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,22 @@ class DetailsTab extends HookConsumerWidget {
102102
speed: displayedActivity.speed,
103103
),
104104
Expanded(
105-
child: RepaintBoundary(
106-
key: state.boundaryKey,
107-
child: LocationMap(
108-
points: points,
109-
markers: markers,
110-
mapController: MapController(),
111-
),
112-
),
105+
child: SizedBox(
106+
height: 500,
107+
child: ClipRRect(
108+
borderRadius: const BorderRadius.only(
109+
topLeft: Radius.circular(150),
110+
topRight: Radius.circular(150),
111+
),
112+
child: RepaintBoundary(
113+
key: state.boundaryKey,
114+
child: LocationMap(
115+
points: points,
116+
markers: markers,
117+
mapController: MapController(),
118+
),
119+
),
120+
)),
113121
)
114122
],
115123
),

0 commit comments

Comments
 (0)