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

gradient_borders 封面
套件詳情v1.0.4

gradient_borders

輸入框和容器的漸變邊框。邊框套件與基本的 Flutter 小部件(如容器和輸入裝飾)整合。使用簡單,平台無關。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
19.3萬
喜歡數
333
Pub 分數
160

安裝套件

flutter pub add gradient_borders

套件介紹

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

一個為容器和輸入欄位添加漸變邊框的 Flutter 套件,透過平滑的顏色過渡增強視覺吸引力。設計簡潔,相容所有主要平台——Android、iOS、Web、macOS、Windows 和 Linux。可無縫整合至標準 Flutter 小工具(如 Container 和 InputDecoration),設定簡單。適用於現代 UI 設計,透過微妙的漸變提升使用者體驗,而不需複雜操作。

適用情境

  • 為表單輸入添加時尚邊框
  • 增強卡片或容器的視覺效果
  • 在應用程式中創建現代使用者介面元素
  • 使用漸變設計響應式版面
  • 自定義按鈕或欄位邊框
  • 透過最少的程式碼提升應用美學

主要特色

  • 與 Container 和 InputDecoration 的輕鬆整合
  • 支援平滑的漸變過渡
  • 跨平台相容性
  • 所需設定最少
  • 與現有的 Flutter 小部件相容
  • 不需要額外的依賴

適合對象

  • 尋求視覺增強的UI設計師
  • 開發現代移動或Web應用的開發者
  • 需要優雅邊框效果的專案
  • 注重使用者介面細節的應用
  • 初學者探索 Flutter 裝飾選項
  • 希望實現跨平台樣式的團隊

使用建議

  • 可能影響低階裝置在具有許多漸變邊框時的效能
  • 除了漸變方向和顏色之外,自訂選項有限
  • 不適合複雜的邊框圖案
  • 需要仔細考慮對比度以確保可讀性
  • 建議謹慎使用,以避免視覺雜亂
  • 依賴於 Flutter 的渲染管道以確保一致性

原始 README

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

Gradient borders

style: very good analysis

Various borders that use gradient instead of boring plain colors.

Usage

Box borders:

Change your container borders to use fancy gradients:

Container(
  width: 100,
  height: 100,
  decoration: BoxDecoration(
    border: const GradientBoxBorder(
      gradient: LinearGradient(colors: [Colors.blue, Colors.red]),
      width: 4,
    ),
    borderRadius: BorderRadius.circular(16)
  ),
),

Works with both: border radius, and with BoxShape.circle

Parameters
Parameter Type Default Description
gradient Gradient required The gradient to use for the border color.
width double 1.0 The width of the border.
strokeAlign double BorderSide.strokeAlignInside The alignment of the stroke relative to the border edge. Use BorderSide.strokeAlignInside (-1), BorderSide.strokeAlignCenter (0), or BorderSide.strokeAlignOutside (1).

image

Input borders

You can use GradientOutlineInputBorder as a part of your input decoration:

TextField(
  decoration: InputDecoration(
    border: GradientOutlineInputBorder(
      gradient: LinearGradient(colors: [Colors.red, Colors.blue]),
      width: 2,
    ),
    focusedBorder: GradientOutlineInputBorder(
     gradient: LinearGradient(colors: [Colors.yellow, Colors.green]),
      width: 2
    ),
    label: Text("Example"),
  ),
),
Parameters
Parameter Type Default Description
gradient Gradient required The gradient to use for the border color.
width double 1.0 The width of the border.
gapPadding double 4.0 Horizontal padding around the label cutout in the border.
borderRadius BorderRadius BorderRadius.all(Radius.circular(4)) The border radius of the rounded corners.
borderAlignment OutlineBorderAlignment OutlineBorderAlignment.onEdge Controls where the stroke is drawn relative to the widget edge. onEdge draws the border centered on the widget boundary; inside draws it fully inside.

image

You can also use GradientUnderlineInputBorder as part of your input decoration:

TextField(
  decoration: InputDecoration(
    border: GradientOutlineInputBorder(
      gradient: LinearGradient(colors: [Colors.red, Colors.blue]),
      width: 2,
    ),
    focusedBorder: GradientUnderlineInputBorder(
     gradient: LinearGradient(colors: [Colors.yellow, Colors.green]),
      width: 2
    ),
    label: Text("Example"),
  ),
),
Sponsored by

The Code Brothers

所屬分類

原始碼儲存庫

使用此套件的專案