import 'package:comwell_key_app/overview/components/booking_list_item_view.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class BookingsTabView extends StatelessWidget {
final Iterable<Booking> bookings;
final String bookingsTitle;
final String bookingsSubtitle;
final String bookingsIcon;
final bool isCancelled;
const BookingsTabView({
required this.bookings,
required this.bookingsTitle,
required this.bookingsSubtitle,
required this.bookingsIcon,
required this.isCancelled,
super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
if (bookings.isEmpty) {
return Column(
children: [
const SizedBox(
height: 20,
),
Container(
height: 238,
padding: const EdgeInsetsDirectional.symmetric(horizontal: 32, vertical: 40),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
width: 1,
color: Colors.grey.shade300,
),
),
margin: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
children: [
SvgPicture.asset(bookingsIcon, height: 48, width: 48),
const SizedBox(
height: 25,
),
Text(bookingsTitle,
style: theme.textTheme.headlineLarge?.copyWith(
color: colorPrimaryText,
)),
const SizedBox(
height: 12
),
Text(
textAlign: TextAlign.center,
bookingsSubtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
),
],
),
),
],
);
} else {
return ListView.builder(
shrinkWrap: true,
itemCount: bookings.length,
itemBuilder: (context, index) => BookingListItemView(
booking: bookings.elementAt(index),
hotelName: bookings.elementAt(index).hotelName,
startDate: bookings.elementAt(index).startDate,
endDate: bookings.elementAt(index).endDate,
hotelImage: Image.asset(bookings.elementAt(index).image, fit: BoxFit.cover),
isCancelled: isCancelled,
),
);
}
}
}