FLUTTER ECOSYSTEM

fluttercandies/flutter_switch_clipper

एक Flutter पैकेज जो दो विजेट को क्लिपर के साथ स्विच करता है।

flutter_switch_clipper प्रोजेक्ट कवर
Stars
31
Forks
2
अंतिम पुश (UTC)
11 जून 2025
प्रोजेक्ट स्थिति
सक्रिय
FlutterCandies GitHub avatar
GITHUB Organization

FlutterCandies ↗

Custom Flutter candies (packages) for you to build your Flutter app easily. Enjoy it!

भाषाएँDartC++CMakeHTMLRubyCSwiftObjective-CJava

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 3 आइटम
  • flutter{"sdk":"flutter"}
  • flutter_testडेवलपमेंट{"sdk":"flutter"}
  • flutter_lintsडेवलपमेंट^1.0.0

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

Flutter Switch Clipper

A Flutter package that two widgets switch with clipper.

pub package GitHub stars GitHub forks CodeFactor FlutterCandies

体验一下

体验网址:Demo

使用

使用FillClipper并自定义相关参数

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/fv.gif
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

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/fc.gif
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切换图标颜色

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/cs.gif
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切换两个图标

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/cs2.gif
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

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/cs3.gif
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

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/cs4.gif
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

https://raw.githubusercontent.com/fluttercandies/flutter_switch_clipper/master/preview/cs5.gif
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(),
),