seat_kit 0.2.0
seat_kit: ^0.2.0 copied to clipboard
A Flutter toolkit for modeling, rendering, and selecting seats on interactive seat maps for events and venues.
0.2.0 #
New bus layouts and dynamic, per-category seat filtering — no breaking changes.
sleeper44Layout— a 44-seat sleeper coach: single upper/lower berth columns (SU/SL), stacked seaters in the middle group, full-height DL (Double Lower) berths beneath them, and DU (Double Upper) berths on the right.sleeper60Layout— a 60-seat sleeper coach with four sub-columns either side of the aisle: CU berths, C-seaters over CL berths, D-seaters over DL berths, and DU berths, with mirrored numbering across the aisle and three independent price tiers.- Both new layouts are registered in the example app's layout registry — the Bus dropdown now lists all three (48/44/60-seater) sleeper layouts.
- Dynamic filter chips —
SeatFilterBar's category chips are now derived from the distinctSeatCategorys actually present in the loadedSeatMap, instead of a fixed list, so they automatically match whichever layout is selected. Each distinct category (including SU, SL, seater, DU, DL, CU, CL) gets its own chip with its own label — Upper and Lower berth categories are never grouped together. - Additive filter semantics — category chips now start OFF; activating one or more chips shows only the matching seat type(s) (union of active chips) and dims the rest. With nothing active, every seat is visible. "Available only" and custom predicates combine with the type filter using AND.
- Fixed the example's "Lower berths only" predicate to match only true lower berths (SL, DL, CL) — it previously also matched DU (Double Upper) berths.
0.1.0 #
First publish-ready release. Builds on the previous unpublished snapshots with a generic payload, a flagship bus reference layout, seat styles, and full public API documentation.
- Generic
<T>payload —SeatMap<T>andSeatElement<T>carry an opaque, kit-ignorant developer payloaddata: T?, returned as-is throughSeatMapView.onSelectionChanged.SeatMap<T>.fromJson/toJsonare hand-written (notjson_serializable-generated) to work around ajson_serializable6.13.x crash on generic list fields — see the README "Notes for maintainers" section. sleeper48Layout— the flagship shipping reference layout: a 48-seat Indian sleeper coach (SU/SL/seater/DU columns), right-hand-drive driver cabin, chassis outline, and an entry door drawn inside the bus body. This is the layout the example showcase wires up end-to-end and the one to copy when building a real bus booking screen.SeatStyle.filled/SeatStyle.outlined—SeatMapView.seatStylecontrols how available seats render: solid color fill (default) or a white/transparent fill with a colored border and label. Booked, unavailable, tagged, and selected seats always render filled in either style.- Tags —
SeatElement.tagis a free-form, opaque string for app-defined seat markers (e.g.'ladies','accessible'), rendered viaSeatMapView.tagColors/tagLabels. The kit never interprets tag values. - Filtering — an opt-in
bool Function(SeatElement<T>)?predicate (SeatMapView.filter) dims and excludes non-matching seats from hit-testing.SeatFilterBaris a ready-made category/availability toggle row that emits this predicate shape. canSelect/messageBuilder— app-owned hooks for business rules (e.g. adjacency restrictions) and rejection text. The kit ships zero hardcoded rejection strings and has no concept of gender, identity, or "ladies seat" rules; see the README for the full design rationale.- Five layout generators total:
sleeper48Layout(flagship, fully wired up in the example showcase) plus four foundational/basic generators —theaterGrid,busLayout,restaurantTables,gaSection— covering the common grid, table, and zone shapes for other venue types. - Full dartdoc coverage for every exported type, method, and parameter
(
public_member_api_docslint enabled).
0.0.1+1 #
- Added
SeatMapView.onTapResultcallback — fires withSelectionResulton every seat tap (success and rejection) so host apps can show feedback without direct controller access. - Added four layout generators:
theaterGrid,busLayout,restaurantTables,gaSection. Exported fromseat_kit.dart. - Added
GaZoneSpec,TableSpec,TableShape,zoneLabelForsupporting types. - Added runnable example app in
example/demonstrating all templates, live selection panel, rejection snackbars, status legend, and custom-JSON loading. - Updated README with real install + usage snippets.
0.0.1 #
- Initial release: Freezed data models for seat maps (
SeatMap,SeatElement,SeatDecoration,SeatCategory,SeatPosition,SeatStatus,SelectionRules) with JSON serialization. - Added
SeatSelectionController, a Riverpod (@riverpod) notifier that owns local seat selection for aSeatMapand enforces itsSelectionRules(availability,maxSelectable, row-adjacency) on every mutation, returning a typedSelectionResult(SelectionSuccess/SelectionRejectedwith aSelectionRejectionReason) instead of throwing. No booking, API calls, or hold timers — selection state only. - Added
SeatMapView, a single canvas-based widget that renders aSeatMapwith pan/pinch/scroll zoom (InteractiveViewer), fit-to-screen on first layout, accessible status visuals (color + glyph), and tap-to-select wired toSeatSelectionController. Built on a singleCustomPainter(SeatMapPainter, internal) with manual hit-testing so it scales to thousands of seats without per-seat widgets.SeatMapThemeexposes styling.onSelectionChangedreports the selection as plainSeatElements — the kit still owns no booking, pricing, or networking.