75 lines
2.2 KiB
Dart
75 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/design/tokens.dart';
|
|
import '../../data/models/place_model.dart';
|
|
|
|
/// عنصر نتائج البحث عن مكان.
|
|
class PlaceTile extends StatelessWidget {
|
|
final PlaceModel place;
|
|
final VoidCallback? onTap;
|
|
final IconData? icon;
|
|
|
|
const PlaceTile({
|
|
super.key,
|
|
required this.place,
|
|
this.onTap,
|
|
this.icon,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final cs = Theme.of(context).colorScheme;
|
|
final displayIcon = icon ?? Icons.location_on_outlined;
|
|
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: T.pagePadding,
|
|
vertical: T.s12,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: cs.surfaceContainerHighest,
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(displayIcon, size: 20, color: cs.onSurfaceVariant),
|
|
),
|
|
const SizedBox(width: T.s12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
place.name,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
if (place.address != null && place.address!.isNotEmpty) ...[
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
place.address!,
|
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
|
color: cs.onSurfaceVariant,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
Icon(Icons.chevron_right_rounded, color: cs.onSurfaceVariant),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|