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

cupertino_height_picker 封面
套件詳情v1.0.1

cupertino_height_picker

此套件提供無縫的 Cupertino 風格高度選擇器,支援公制的公分與英制的英尺/英吋,為使用者提供多樣性與精確度。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
189
喜歡數
8
Pub 分數
160

安裝套件

flutter pub add cupertino_height_picker

套件介紹

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

cupertino_height_picker 套件為 Flutter 應用提供類似原生的 Cupertino 風格身高選擇器,支援公制(公分)與英制(英呎/英吋)單位。它提供流暢、互動性強的介面,無縫整合 iOS 設計指南,同時在 Android、Web、macOS、Windows 與 Linux 上亦能正常運作。設計上注重精確度與易用性,讓使用者透過直覺的滾動操作與清晰的視覺反饋來選擇身高。此選擇器高度可自訂,適用於需要精確輸入身高的表單。

適用情境

  • 使用者資料設定
  • 健康與健身應用
  • 醫療數據收集
  • 基於年齡/身高形式輸入
  • 應用中可自定義高度選擇

主要特色

  • Cupertino 風格的 UI
  • 支援公制與英制單位
  • 跨平台相容性
  • 平滑滾動介面
  • 可自訂外觀
  • 精確高度選擇

適合對象

  • 面向iOS的Flutter應用
  • 跨平台健康應用
  • 表單密集型應用
  • 設計一致的使用者介面
  • 尋求原生樣式的選擇器的開發者

使用建議

  • 需要 Flutter 3.0 或更高版本
  • 對內部佈局的自訂有限
  • 非 Cupertino 主題可能需要額外的樣式
  • 未針對非常大的資料集進行優化
  • 依賴於平台特定的渲染行為

原始 README

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

🎚️ Cupertino Height Picker Plugin

pub package

A seamless Cupertino-style height picker widget for Flutter. Supports height selection in both centimeters (metric) and feet/inches (imperial), providing versatility and precision for users.

Imperial System Metric System Automatic Unit Conversion
Imperial System Demo Metric System Demo Unit Conversion Demo

Features

  • Automatic Unit Conversion: Effortlessly switch between centimeters and feet/inches with automatic conversions.
  • Decimal Value Precision: Allows for precise height measurements.
  • Cupertino Styled Number Picker: A clean, intuitive interface consistent with iOS design.
  • Light & Dark Themes: Built-in support for both light and dark themes, adapting to the user's theme settings.

Getting started

1. Depend on it

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

dependencies:
  cupertino_height_picker: ^1.0.1
2. Install it

You can install packages from the command line:

$ flutter pub get
3. Import it

Now in your Dart code, you can use:

import 'package:cupertino_height_picker/cupertino_height_picker.dart';

Usage

Call the default showCupertinoHeightPicker Function which always returns the height in centimeters and has automatic unit conversion enabled by default

screenshot_1
await showCupertinoHeightPicker(
  context: context,
  onHeightChanged: (val) {
    setState(() {
      heightInCm = val;
      });
  },
);




Allow Height to be input only from metric system

screenshot_2
await showCupertinoHeightPicker(
  context: context,
  initialSelectedHeightUnit:HeightUnit.cm,
  canConvertUnit: false,
  onHeightChanged: (val) {
    print(val);
  },
);




Start from a custom initial height and don't show the separation text between feet and inches

screenshot_3
await showCupertinoHeightPicker(
  context: context,
  initialHeight: 185.5,
  showSeparationText: false,
  onHeightChanged: (val) {
    print(val);
  },
);




Customize the Look of the Modal to your liking!

screenshot_4
await showCupertinoHeightPicker(
  context: context,
  modalHeight: 300,
  maxModalWidth: 500,
  modalBackgroundColor: CupertinoColors.systemTeal,
  barrierColor: CupertinoColors.systemGreen.withOpacity(0.5),
  onHeightChanged: (val) {
    print(val);
  },
);


Parameters
  • context: (Required) The BuildContext object, which is necessary for rendering the height picker within the widget tree.

  • onHeightChanged: (Required) A callback function that handles height changes when the user scrolls through different height values. The selected height is returned in centimeters.

  • initialHeight: Sets the default initial height value when the picker is opened. The default is 150.0 cm.

  • initialSelectedHeightUnit: Specifies the default height unit (either HeightUnit.inches or HeightUnit.cm) when the picker is opened. The default is HeightUnit.inches.

  • canConvertUnit: A boolean that determines whether the height picker allows conversion between imperial and metric systems. The default is true.

  • showSeparationText: A boolean that controls whether a separation text (e.g., 'feet') or a decimal point text is shown between the two sliders. The default is true.

  • modalHeight: Specifies the height of the modal sheet. The default value is 216.0.

  • maxModalWidth: Defines the maximum width of the modal sheet. This is useful for responsiveness on larger screens, such as tablets and laptops. If null, the modal takes up the full device width. The default is null.

  • modalBackgroundColor: Defines the background color of the modal sheet. The default is null.

  • barrierColor: Sets the color of the screen behind the modal, allowing for a custom background color with reduced opacity. The default is kCupertinoModalBarrierColor.

Maintainers

Aditya R

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。