182 lines
5.9 KiB
Dart
182 lines
5.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:wisata_app/models/destination.dart';
|
|
import 'package:wisata_app/widgets/destination_image.dart';
|
|
|
|
class DestinationCard extends StatelessWidget {
|
|
const DestinationCard({
|
|
super.key,
|
|
required this.destination,
|
|
required this.onTap,
|
|
});
|
|
|
|
final Destination destination;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// ignore: avoid_print
|
|
print(destination.imagePath);
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 20),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(28),
|
|
child: Ink(
|
|
height: 286,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(28),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xFF0F172A).withValues(alpha: 0.13),
|
|
blurRadius: 30,
|
|
offset: const Offset(0, 18),
|
|
),
|
|
],
|
|
),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(28),
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Hero(
|
|
tag: 'destination-${destination.id}',
|
|
child: DestinationImage(
|
|
path: destination.imagePath,
|
|
width: double.infinity,
|
|
),
|
|
),
|
|
const DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Color(0x22000000),
|
|
Color(0x05000000),
|
|
Color(0xEE07130F),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: 18,
|
|
left: 18,
|
|
child: _GlassPill(
|
|
icon: Icons.landscape_rounded,
|
|
label: destination.category,
|
|
),
|
|
),
|
|
Positioned(
|
|
right: 18,
|
|
top: 18,
|
|
child: _GlassPill(
|
|
icon: Icons.star_rounded,
|
|
label: destination.rating.toStringAsFixed(1),
|
|
accent: const Color(0xFFFFD36A),
|
|
),
|
|
),
|
|
Positioned(
|
|
left: 20,
|
|
right: 20,
|
|
bottom: 20,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
destination.title,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style:
|
|
Theme.of(context).textTheme.headlineSmall?.copyWith(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w900,
|
|
height: 1.08,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
children: [
|
|
const Icon(
|
|
Icons.place_rounded,
|
|
color: Color(0xFFD9EEF8),
|
|
size: 18,
|
|
),
|
|
const SizedBox(width: 4),
|
|
Expanded(
|
|
child: Text(
|
|
destination.displayLocation,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
color: Color(0xFFD9EEF8),
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 16),
|
|
FilledButton.icon(
|
|
onPressed: onTap,
|
|
icon: const Icon(Icons.arrow_forward_rounded, size: 18),
|
|
label: const Text('Lihat Detail'),
|
|
style: FilledButton.styleFrom(
|
|
backgroundColor: Colors.white,
|
|
foregroundColor: const Color(0xFF0F4C81),
|
|
visualDensity: VisualDensity.compact,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(999),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _GlassPill extends StatelessWidget {
|
|
const _GlassPill({
|
|
required this.icon,
|
|
required this.label,
|
|
this.accent,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final Color? accent;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withValues(alpha: 0.20),
|
|
borderRadius: BorderRadius.circular(999),
|
|
border: Border.all(color: Colors.white.withValues(alpha: 0.34)),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(icon, color: accent ?? Colors.white, size: 16),
|
|
const SizedBox(width: 6),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w900,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|