56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class PoiChip extends StatelessWidget {
|
|
final String category;
|
|
|
|
const PoiChip({super.key, required this.category});
|
|
|
|
IconData _iconForCategory(String category) {
|
|
switch (category) {
|
|
case 'restaurant':
|
|
return Icons.restaurant;
|
|
case 'cafe':
|
|
return Icons.local_cafe;
|
|
case 'shop':
|
|
return Icons.shopping_bag;
|
|
case 'supermarket':
|
|
return Icons.shopping_cart;
|
|
case 'pharmacy':
|
|
return Icons.local_pharmacy;
|
|
case 'hospital':
|
|
return Icons.local_hospital;
|
|
case 'fuel':
|
|
return Icons.local_gas_station;
|
|
case 'parking':
|
|
return Icons.local_parking;
|
|
case 'atm':
|
|
return Icons.atm;
|
|
case 'public_transport':
|
|
return Icons.directions_bus;
|
|
case 'hotel':
|
|
return Icons.hotel;
|
|
case 'tourist_attraction':
|
|
return Icons.museum;
|
|
case 'park':
|
|
return Icons.park;
|
|
default:
|
|
return Icons.place;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Chip(
|
|
avatar: Icon(
|
|
_iconForCategory(category),
|
|
size: 16,
|
|
),
|
|
label: Text(
|
|
category.replaceAll('_', ' '),
|
|
style: Theme.of(context).textTheme.labelSmall,
|
|
),
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
visualDensity: VisualDensity.compact,
|
|
);
|
|
}
|
|
}
|