Skip to content

Commit

Permalink
update map marker size
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-ishita-g committed Dec 12, 2024
1 parent 4a4760e commit 564cb77
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions app/lib/ui/flow/home/map/map_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui;

import 'package:data/api/space/space_models.dart';
Expand All @@ -23,7 +24,8 @@ import 'map_view_model.dart';

const defaultCameraZoom = 15.0;
const defaultCameraZoomForSelectedUser = 17.0;
const markerSize = 50.0;
double markerSize = Platform.isAndroid ? 150.0 : 70.0;
double markerRadius = Platform.isAndroid ? 70.0 : 30.0;
const placeSize = 80;

class MapScreen extends ConsumerStatefulWidget {
Expand Down Expand Up @@ -375,11 +377,11 @@ class _MapScreenState extends ConsumerState<MapScreen> {
// Draw background rectangle
canvas.drawRRect(
RRect.fromRectAndCorners(
const Rect.fromLTWH(0.0, 0.0, markerSize, markerSize),
topLeft: const Radius.circular(20),
topRight: const Radius.circular(20),
Rect.fromLTWH(0.0, 0.0, markerSize, markerSize),
topLeft: Radius.circular(markerRadius),
topRight: Radius.circular(markerRadius),
bottomLeft: const Radius.circular(0),
bottomRight: const Radius.circular(20),
bottomRight: Radius.circular(markerRadius),
),
Paint()..color = markerBgColor,
);
Expand All @@ -399,12 +401,12 @@ class _MapScreenState extends ConsumerState<MapScreen> {
void _drawUserName(Canvas canvas, String userName, Color bgColor) {
final textPainter = TextPainter(textDirection: TextDirection.ltr);

canvas.drawCircle(const Offset(markerSize / 2, markerSize / 2), 20,
canvas.drawCircle(Offset(markerSize / 2, markerSize / 2), 30,
Paint()..color = bgColor);

textPainter.text = TextSpan(
text: userName.isNotEmpty ? userName[0] : '',
style: const TextStyle(fontSize: 30, color: Colors.white),
style: TextStyle(fontSize: Platform.isAndroid ? 70 : 40, color: Colors.white),
);
textPainter.layout();
textPainter.paint(
Expand All @@ -429,16 +431,16 @@ class _MapScreenState extends ConsumerState<MapScreen> {
final canvas = ui.Canvas(
recorder,
Rect.fromPoints(
const Offset(0, 0), const Offset(markerSize, markerSize)));
const Offset(0, 0), Offset(markerSize, markerSize)));

// Draw the rounded rectangle
canvas.drawRRect(
RRect.fromRectAndCorners(
const Rect.fromLTWH(0.0, 0.0, markerSize, markerSize),
topLeft: const Radius.circular(20),
topRight: const Radius.circular(20),
Rect.fromLTWH(0.0, 0.0, markerSize, markerSize),
topLeft: Radius.circular(markerRadius),
topRight: Radius.circular(markerRadius),
bottomLeft: const Radius.circular(0),
bottomRight: const Radius.circular(20),
bottomRight: Radius.circular(markerRadius),
),
Paint()..color = markerBgColor,
);
Expand Down

0 comments on commit 564cb77

Please sign in to comment.