smart_seat_selector 0.0.3 copy "smart_seat_selector: ^0.0.3" to clipboard
smart_seat_selector: ^0.0.3 copied to clipboard

A universal grid-based seat selection widget for Flutter supporting Cinemas, Buses, Flights, and Event halls with zoom and pan interaction.

example/lib/main.dart

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

void main() {
  runApp(const MaterialApp(home: UniversalSeatExample()));
}

class UniversalSeatExample extends StatefulWidget {
  const UniversalSeatExample({super.key});

  @override
  State<UniversalSeatExample> createState() => _UniversalSeatExampleState();
}

class _UniversalSeatExampleState extends State<UniversalSeatExample> {
  // 1 = Available, 2 = Booked, 0 = Aisle
  final List<List<int>> _cinemaGrid = [
    [1, 1, 1, 0, 0, 1, 1, 1],
    [1, 1, 1, 0, 0, 1, 1, 1],
    [1, 1, 1, 0, 0, 2, 2, 1],
  ];

  late SeatController _controller;

  @override
  void initState() {
    super.initState();
    _controller = SeatController(seatGrid: _cinemaGrid);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Cinema Selection")),
      body: SeatLayoutWidget(
        controller: _controller,
        seatConfig: SeatLayoutConfig(
          seatSize: 30,
          selectedColor: Colors.red,
        ),
        // OPTION 1: CINEMA SCREEN
        headerWidget: Container(
          height: 40,
          width: 300,
          decoration: BoxDecoration(
            color: Colors.grey[300],
            borderRadius: BorderRadius.vertical(bottom: Radius.circular(100)),
            border: Border(top: BorderSide(color: Colors.grey, width: 4)),
          ),
          alignment: Alignment.center,
          child: const Text("SCREEN", style: TextStyle(letterSpacing: 3)),
        ),
        // OPTION 2: BUS DRIVER (Uncomment below to see Bus mode)
        /*
        headerWidget: const Row(
          mainAxisAlignment: MainAxisAlignment.end,
          children: [Icon(Icons.sports_motorsports, size: 40, color: Colors.grey)],
        ),
        */
        onSeatStateChanged: (selected) {
          print("Current Selection: $selected");
        },
      ),
    );
  }
}
2
likes
0
points
242
downloads

Publisher

unverified uploader

Weekly Downloads

A universal grid-based seat selection widget for Flutter supporting Cinemas, Buses, Flights, and Event halls with zoom and pan interaction.

Repository (GitHub)
View/report issues

Topics

#booking #cinema #widget #seat-selector #seat-picker

License

unknown (license)

Dependencies

flutter

More

Packages that depend on smart_seat_selector