搜索插件、代码仓与 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(),
),

所属分类

源码仓库

使用此插件的项目

暂无相关数据。