搜尋套件、儲存庫與 APP 分類

book_my_seat 封面
套件詳情v1.0.1

book_my_seat

這是一個用於建立巴士、劇院、飛機等座位預訂佈局的Flutter套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
80
喜歡數
69
Pub 分數
140

安裝套件

flutter pub add book_my_seat

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個專為交通與活動場所(如巴士、劇院和飛機)設計的 Flutter 套件,用於建立互動式座位預訂佈局。它提供可自訂的 UI 元件來表示座位,讓使用者能輕鬆選擇、強調及管理預訂。此套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合需要直覺式座位選擇介面的跨平台應用程式。

適用情境

  • 巴士票預訂
  • 劇院座位預訂
  • 飛機座位佈局
  • 事件票務系統
  • 多場館預訂應用
  • 互動座位圖

主要特色

  • 可自訂的座位樣式
  • 即時座位選擇
  • 支援多種座位安排
  • 跨平台相容性
  • 內建座位狀態管理
  • 適用於所有裝置的響應式設計

適合對象

  • 旅行與交通應用
  • 活動和場地管理軟體
  • 票務平台
  • 行動與網頁預訂介面
  • 需要可重用座位UI組件的開發人員

使用建議

  • 需要手動整合預訂邏輯
  • 座位衝突的內建驗證有限
  • 最適合靜態或半動態的座位配置
  • 複雜的工作流程可能需要額外的狀態管理
  • 依賴外部資料取得座位可用性

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

book_my_seat

This is a flutter package to create seat booking layout for bus, theatre, aeroplane etc. This gives you facility to select a seat by gestures like zoom-in, zoom-out, pan etc.

Some examples(below is for theatre but you can implement the package for bus etc also)

" " gif

Example project and blog for better understanding 🚀

Read my article with example

Getting Started 🤩

Add this dependency in your pubspec.yaml file

dependencies:
  book_my_seat: <version number>

How to use ⌨️

First, import it:
import 'package:book_my_seat/book_my_seat.dart';
Simply create SeatLayoutWidget widget and add the required parameters.

Example:

SeatLayoutWidget(
  onSeatStateChanged: (rowIndex, colIndex, updatedSeatState) {
    print("tapped $rowIndex $colIndex $updatedSeatState");
  },
  stateModel: SeatLayoutStateModel(
    rows: 12,
    cols: 15,
    seatSvgSize: 30,
    pathUnSelectedSeat: 'assets/svg_unselected_bus_seat.svg',
    pathSelectedSeat: 'assets/svg_selected_bus_seat.svg',
    pathSoldSeat: 'assets/svg_sold_bus_seat.svg',
    pathDisabledSeat: 'assets/svg_disabled_bus_seat.svg',
    currentSeatsState: <explained below>,
  ),
)
Parameters explained:
  • onSeatStateChanged: - This is a callback method which gets called when user clicks on a seat which has current state equals to either SeatState.selected or SeatState.unselected. The params in this method are:
    rowIndex - the index of the row where this seat is situated
    colIndex - the index of the column where this seat is situated
    updatedSeatState - this is the updated state of the seat after user clicks on the seat. It is an enum of type SeatState

  • stateModel: - It is an object of class SeatLayoutStateModel which describes the initial state of the whole layout(maybe bus or aeroplane or theatre). The params in this method are:
    rows - number of rows in the area(I will refer bus/aeroplane/theatre etc as area from now onwards)
    cols - number of columns in the area.
    seatSvgSize - size of individual seat
    pathUnSelectedSeat, pathSelectedSeat, pathSoldSeat, pathDisabledSeat - path of the svg assets you want to show for unselected(available), selected(by you right now), already sold and disabled(non-choosable) seats respectively
    currentSeatsState - this is the main parameter. It is a 2D list i.e. of type List<List<SeatState>> (SeatState enum is explained below). This describes the initial state of the area i.e. state of each seat whether it is already sold or unselected(available) or selected by you or disabled(non-selectable).

SeatState enum:

It is a dart enum. This describes the current state of individual seat. This currently holds 5 states unselected, selected, sold, disabled and empty.
Brief description of each:

  • unselected - state when a seat is available and user can select it
  • selected - state when user has selected an unselected(available) seat (i.e. a seat which had its state == unselected)
  • sold - state when it is already sold to some other user
  • disabled - state when a seat is disabled and nobody can select it
  • empty - state of the cell in 2D area which is an empty place(consider vacant ground) in the bus/theatre/aeroplane etc. This can mimic staircase or aisle or some other place in the area where there are no seats

NOTE: User can only click on seats which have state equals to SeatState.selected or SeatState.unselected.

Example project and blog for better understanding 🚀

Read my article with example

Contributors 💻

Prateek Sharma - Linkedin | Github

If you like this package, please do a thumbs up on it on pub.dev, give star on github and you can buy me a coffee also 🙏👇

Buy Me A Coffee

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。