52 lines
1.3 KiB
Dart
52 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../models/city_model.dart';
|
|
import '../views/city/city_view.dart';
|
|
|
|
class CityCard extends StatelessWidget {
|
|
final City city;
|
|
|
|
const CityCard({super.key, required this.city});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
elevation: 4,
|
|
margin: const EdgeInsets.all(10),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => CityView(city: city),
|
|
),
|
|
);
|
|
},
|
|
child: SizedBox(
|
|
height: 180,
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Image.asset(
|
|
city.image,
|
|
fit: BoxFit.cover,
|
|
),
|
|
Container(
|
|
alignment: Alignment.bottomLeft,
|
|
padding: const EdgeInsets.all(10),
|
|
color: Colors.black45,
|
|
child: Text(
|
|
city.name,
|
|
style: const TextStyle(
|
|
fontSize: 30,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|