TcsCustomSelectionDialog constructor

const TcsCustomSelectionDialog({
  1. Key? key,
  2. String? title = "請選擇",
  3. String? buttonText = "取消",
  4. required List<CustomSelectionDialogOptionItem> items,
  5. dynamic onItemSelected(
    1. CustomSelectionDialogOptionItem selectedItem
    )?,
  6. int? initialSelectedIndex,
  7. int itemCountThreshold = 6,
  8. int scrollOffsetThreshold = 3,
})

彈跳視窗:選擇視窗樣式

說明:

  • initialSelectedIndex => 上次選中的項目索引,會加上底色
  • itemCountThreshold(6) => 項目數量閾值
    • 這個變數用來設定當項目items數量少於等於這個值時,不需要滾動。
      • ex:設定為 6,表示當項目數量少於等於 6 時,不執行滾動。
  • scrollOffsetThreshold(3) => 滾動距離閾值
    • 這個變數用來設定滾動的距離閾值,超過這個值才會進行滾動。
      • ex:設定為 3,表示滾動的距離閾值為 3 個項目的高度。

Implementation

const TcsCustomSelectionDialog({
  super.key,
  this.title = "請選擇",
  this.buttonText = "取消",
  required this.items,
  this.onItemSelected,
  this.initialSelectedIndex,
  this.itemCountThreshold = 6,
  this.scrollOffsetThreshold = 3,
});