搜尋分類、套件與程式碼儲存庫

auto_direction 封面
套件詳情v0.0.7

auto_direction

此套件會根據所提供的文字語言,將組件方向從從左到右(LTR)變更為從右到左(RTL),反之亦然。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1640
喜歡數
88
Pub 分數
40

安裝套件

flutter pub add auto_direction

套件介紹

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

auto_direction 套件可自動根據檢測到的語言調整 Flutter 應用程式中元件的文字方向,切換左右(LTR)與右左(RTL)版面配置。它透過動態適應 UI 方向,無需手動介入,簡化國際化,確保阿拉伯語、希伯來語等使用 RTL 字元的語言能正確顯示。此套件可順暢整合至針對多語言使用者的應用程式中。

適用情境

  • 動態UI佈局適應
  • 多語言應用程式支援
  • RTL/LTR 文字方向切換
  • 國際化使用者介面
  • 自動語言佈局調整

主要特色

  • 基於語言的方向檢測
  • 自動 LTR/RTL 切換
  • 與 Flutter 小部件的無縫整合
  • 支援多個平台
  • 所需設定最少

適合對象

  • 面向全球受眾的應用
  • 使用 Flutter 進行國際化開發的開發者
  • 需要動態文字方向的專案
  • 包含混合語言內容的 UI
  • 支援 RTL 語言的 Web 與行動應用程式

使用建議

  • 需要準確的語言檢測
  • 可能需要額外的邏輯來處理複雜佈局
  • 不適用於靜態方向設計
  • 取決於正確的區域設定
  • 僅限文字方向變更,不支援完整從右到左主題

原始 README

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

auto_direction

This widget changes the direction of a widget from ltr direction into rtl direction and vice versa based on the language of the text provided.

Auto RTL on a TextField

Getting Started

This widget will wrap its child with a Directionality widget and it will decide the direction based on the provided text.

...
String text = "";
...
AutoDirection(
  text: text,
  child: TextField(
    onChanged: (str){
      setState(() {
        text = str;
      });
    },
  ),
)

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案