shitead 0.0.5

SDKflutter
Platformandroidioswindowslinuxmacosweb

A modern Flutter package for building interactive passenger seat layouts with driver seat, selection functionality, and detailed seat information modals. Perfect for bus booking, cinema reservations, and airline seat selection apps.

Shitead - Flutter Seat Layout Package

A modern Flutter package for building interactive passenger seat layouts with driver seat, selection functionality, and detailed seat information modals.

Features

  • 🚗 Driver Seat Support: Optional driver seat with distinct styling
  • 🪑 Customizable Layout: Configure number of seats, seats per row, and layout
  • 🎯 Interactive Selection: Touch seats to select/deselect with visual feedback
  • 📱 Modern UI: Material Design 3 compliant with smooth animations
  • 📋 Detailed Info Modals: Bottom sheet modals showing seat information
  • 🔧 Flexible Configuration: Pre-booked seats, unavailable seats, custom metadata
  • 🎨 Themeable: Respects app's color scheme and theme
  • Well Tested: Comprehensive test coverage

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  shitead: ^0.0.1

Then run:

flutter pub get

Usage

Basic Example

import 'package:flutter/material.dart';
import 'package:shitead/shitead.dart';

class SeatSelectionScreen extends StatefulWidget {
  @override
  _SeatSelectionScreenState createState() => _SeatSelectionScreenState();
}

class _SeatSelectionScreenState extends State<SeatSelectionScreen> {
  List<Seat> selectedSeats = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Select Seats')),
      body: Padding(
        padding: EdgeInsets.all(16),
        child: SeatLayout(
          numberOfSeats: 20,
          seatsPerRow: 4,
          showDriverSeat: true,
          onSeatSelectionChanged: (seats) {
            setState(() {
              selectedSeats = seats;
            });
          },
        ),
      ),
    );
  }
}

Advanced Configuration

SeatLayout(
  numberOfSeats: 30,
  seatsPerRow: 4,
  showDriverSeat: true,
  allowMultipleSelection: true,
  seatSize: 55,
  seatSpacing: 10,

  // Pre-select some seats
  initialSelectedSeats: ['seat_5', 'seat_6'],

  // Mark some seats as booked
  bookedSeats: ['seat_1', 'seat_15', 'seat_20'],

  // Mark some seats as unavailable
  unavailableSeats: ['seat_10'],

  // Add passenger names
  passengerNames: {
    'driver': 'John Doe',
    'seat_1': 'Alice Smith',
    'seat_15': 'Bob Johnson',
  },

  // Add custom metadata
  seatMetadata: {
    'seat_1': {
      'booking_id': 'BK001',
      'price': 50.0,
      'meal_preference': 'Vegetarian'
    },
    'seat_10': {
      'reason': 'Maintenance required',
      'estimated_fix': '2024-01-15'
    },
  },

  onSeatSelectionChanged: (selectedSeats) {
    print('Selected seats: ${selectedSeats.map((s) => s.seatNumber).join(', ')}');
  },
)

Seat Status Types

  • Available: Open for selection
  • Selected: Currently selected by user
  • Booked: Already taken by another passenger
  • Unavailable: Out of order or maintenance
  • Driver: Special driver seat

Customization Options

SeatLayout Properties

PropertyTypeDefaultDescription
numberOfSeatsintRequiredNumber of passenger seats
seatsPerRowint4Seats per row in layout
showDriverSeatbooltrueWhether to show driver seat
allowMultipleSelectionbooltrueAllow selecting multiple seats
seatSizedouble50Size of individual seats
seatSpacingdouble8Spacing between seats
initialSelectedSeatsList<String>?nullInitially selected seat IDs
bookedSeatsList<String>?nullPre-booked seat IDs
unavailableSeatsList<String>?nullUnavailable seat IDs
passengerNamesMap<String, String>?nullCustom passenger names
seatMetadataMap<String, Map<String, dynamic>>?nullCustom seat metadata
onSeatSelectionChangedFunction(List<Seat>)?nullSelection change callback

Seat Model Properties

PropertyTypeDescription
idStringUnique seat identifier
seatNumberStringDisplay seat number
statusSeatStatusCurrent seat status
rowintRow position
columnintColumn position
isDriverboolWhether this is driver seat
passengerNameString?Passenger name (if any)
metadataMap<String, dynamic>?Additional seat data

Screenshots

Example App

Check out the example app in the example/ directory for a complete implementation with configuration options.

cd example
flutter run

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a list of changes.