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

flutter_switch_clipper 封面
套件詳情v0.0.7

flutter_switch_clipper

一個 Flutter 套件,讓兩個小部件之間切換,預設使用裁剪器或自訂裁剪器。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
50
喜歡數
60
Pub 分數
160

安裝套件

flutter pub add flutter_switch_clipper

套件介紹

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

一個 Flutter 套件,可使用預設或自訂剪裁器在兩個組件之間實現順暢切換。它透過動畫剪裁效果增強 UI 轉場,非常適合創造動態且視覺吸引人的介面。此套件支援多個平台,並能無縫整合至 Flutter 應用程式中。開發者可自訂剪裁器行為以符合特定設計需求,提供動畫風格與效能上的彈性。非常適合用於標籤頁、切換按鈕或內容切換等互動元件。

適用情境

  • 動畫小部件過渡
  • 自定義標籤指示器
  • 互動式 UI 組件
  • 動態內容切換
  • 平滑的螢幕轉場
  • 注重設計的動畫

主要特色

  • 預設與自訂裁剪器支援
  • 跨平台相容性
  • 平滑過渡動畫
  • 與 Flutter 的輕鬆整合
  • 靈活的組件切換
  • 高度可自訂的裁剪效果

適合對象

  • 尋求視覺魅力的UI設計師
  • 開發互動式介面的開發者
  • 需要動態內容切換的應用程式
  • 具有自定義動畫需求的專案
  • Flutter 初學者探索裁剪器效果

使用建議

  • 複雜裁剪帶來的效能影響
  • 需要理解 Clipper 類
  • 大型 widget 可能需要優化
  • 除了基本用法之外,文件內容有限
  • 不適合簡單的靜態佈局

原始 README

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

Flutter Switch Clipper

A Flutter package that two widgets switch with clipper.

pub package GitHub stars GitHub forks CodeFactor FlutterCandies

体验一下

体验网址:Demo

使用

使用FillClipper并自定义相关参数

View code
SwitchClipper(
    initSelect: true,
    child: const Icon(Icons.favorite, size: 200, color: Colors.redAccent),
    background: const Icon(Icons.favorite, size: 200, color: Colors.white),
    duration: const Duration(milliseconds: 800),
    animationClip: FillClipper(fillAlignment: _alignment,fillOffset: 50),
),

使用默认FillClipper

View code
const SwitchClipper(
    enableWhenAnimating: false,
    child: Text(
        'FlutterCandies',
        style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 50,
            color: Colors.amber,
            height: 2,
        ),
    ),
    background: Text(
        'FlutterCandies',
        style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 50,
            color: Colors.white,
            height: 2,
        ),
    ),
    curve: Curves.slowMiddle,
    reverseCurve: Curves.linear,
),

使用CircleClipper切换图标颜色

View code
SwitchClipper(
    child: const Icon(Icons.accessibility_new_rounded, size: 200, color: Colors.blueAccent),
    background: const Icon(Icons.accessibility_new_rounded, size: 200, color: Colors.white),
    curve: Curves.ease,
    duration: const Duration(milliseconds: 800),
    animationClip: CircleClipper(),
),

使用CircleClipper切换两个图标

View code
SwitchClipper(
    child: ColoredBox(
    color: Colors.blueGrey[200] ?? Colors.blueGrey,
    child: const Icon(Icons.accessibility_new_rounded, size: 200, color: Colors.white)),
    background: const Icon(Icons.accessible_forward_outlined, size: 200, color: Colors.white),
    curve: Curves.ease,
    duration: const Duration(milliseconds: 800),
    animationClip: CircleClipper(),
),

使用ShutterClipper

View code
SwitchClipper(
    child: ColoredBox(
        color: Colors.blueGrey[200] ?? Colors.blueGrey,
        child: const Icon(Icons.accessibility_new_rounded, size: 200, color: Colors.white)),
    background: const Icon(Icons.accessible_forward_outlined, size: 200, color: Colors.white),
    curve: Curves.ease,
    duration: const Duration(milliseconds: 800),
    animationClip: ShutterClipper(activeAlignment: _alignment),
),

使用WaveClipper

View code
SwitchClipper(
    child: const Icon(Icons.access_time_filled_rounded, size: 200, color: Colors.blue),
    background: const Icon(Icons.access_time_filled_rounded, size: 200, color: Colors.white),
    curve: Curves.ease,
    duration: const Duration(milliseconds: 2000),
    animationClip: WaveClipper(
        waveAlignment: _alignment == FillAlignment.left ? WaveAlignment.left : WaveAlignment.right,
    ),
),

使用CameraClipper

View code
SwitchClipper(
    child: Container(
        width: 200,
        height: 200,
        alignment: Alignment.center,
        decoration: const BoxDecoration(
            shape: BoxShape.circle,
            color: Colors.blue,
        ),
        child: const Text(
            'Camera',
            style: TextStyle(color: Colors.white, fontSize: 40, fontWeight: FontWeight.bold),
        ),
    ),
    background: Container(
        width: 200,
        height: 200,
        decoration: const BoxDecoration(
            shape: BoxShape.circle,
            color: Colors.white,
        ),
    ),
    duration: const Duration(milliseconds: 2000),
    animationClip: CameraClipper(),
),

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。