|
|
@@ -1,3 +1,4 @@
|
|
|
+import 'package:application/service/map_watch.dart';
|
|
|
import 'package:common_pub/model/distance.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
@@ -90,7 +91,12 @@ class MapPage extends StatelessWidget {
|
|
|
mainAxisSpacing: 10,
|
|
|
childAspectRatio: 1.3),
|
|
|
itemBuilder: (context, i) {
|
|
|
- return GalleryCardWidget(data: c.mapList[i], position: c.position.value);
|
|
|
+ return Obx((){
|
|
|
+ final data = c.mapList[i];
|
|
|
+ final id = MapWatchService.instance?.id;
|
|
|
+ final s = id == MapId(data.mapId);
|
|
|
+ return GalleryCardWidget(data: data, position: c.position.value, isSelected: s);
|
|
|
+ }) ;
|
|
|
})))
|
|
|
],
|
|
|
),
|
|
|
@@ -102,32 +108,34 @@ class MapPage extends StatelessWidget {
|
|
|
class GalleryCardWidget extends StatelessWidget {
|
|
|
final MapInfo data;
|
|
|
final m.Position? position;
|
|
|
+ final bool isSelected;
|
|
|
|
|
|
const GalleryCardWidget({
|
|
|
super.key,
|
|
|
required this.data,
|
|
|
- required this.position});
|
|
|
+ required this.position, required this.isSelected});
|
|
|
|
|
|
- void onTap() async {
|
|
|
+ void onTap(int id) async {
|
|
|
+ await MapWatchService.setMapById(MapId(id));
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
var distance = '--';
|
|
|
-
|
|
|
if ( data.hasDistance()) {
|
|
|
distance = Distance(m: data.distance).toString();
|
|
|
}
|
|
|
|
|
|
return GestureDetector(
|
|
|
- onTap: onTap,
|
|
|
+ onTap: ()=>onTap(data.mapId),
|
|
|
child: Card(
|
|
|
color: Colors.white,
|
|
|
+ shadowColor: isSelected? Colors.red: null,
|
|
|
surfaceTintColor: Colors.white,
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
borderRadius: BorderRadius.all(Radius.circular(5.44))),
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
- elevation: 2,
|
|
|
+ elevation: isSelected?8:4,
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|