I’m working on a Flutter app for booking tables. The main screen needs a timeline view with tables as rows and hours as columns. The tricky part is making reservations adjustable. I want users to be able to tap and drag the edges of a reservation to change its duration.
For example, a booking from 3:00 PM to 3:30 PM should be extendable to 4:00 PM by dragging. I’ve looked into Synfusion but it doesn’t seem to have this feature. Their drag function only moves items around.
Has anyone built something similar? I’m looking for a way to create an interactive timeline where users can easily modify reservation lengths. Any suggestions for packages or custom implementations would be super helpful!
Here’s a basic code snippet of what I’m trying to achieve:
class ReservationTimeline extends StatefulWidget {
@override
_ReservationTimelineState createState() => _ReservationTimelineState();
}
class _ReservationTimelineState extends State<ReservationTimeline> {
List<Booking> bookings = [];
void updateBookingDuration(Booking booking, Duration newDuration) {
// Logic to extend or shorten booking
}
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: bookings.length,
itemBuilder: (context, index) {
return GestureDetector(
onHorizontalDragUpdate: (details) {
// Handle drag to update booking duration
},
child: BookingTile(booking: bookings[index]),
);
},
);
}
}
Any ideas on how to implement the drag-to-extend functionality?