搜索插件、代码仓与 APP 分类

animate_gradient 封面
插件详情v0.0.4

animate_gradient

此包可让您轻松创建动画渐变。只需传入主色和次色,即可完成。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
6430
喜欢数
215
Pub 分数
160

安装插件

flutter pub add animate_gradient

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Animate Gradient 是一个 Flutter 包,可简化动画渐变的创建。只需提供主色和辅色,开发者即可轻松在各种 UI 元素上生成流畅、动态的渐变过渡。它支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台,非常适合跨平台应用。该包内部处理动画逻辑,减少样板代码,并可快速集成到现有项目中。适用于现代且视觉吸引力强的界面。

适合场景

  • 创建动态应用背景
  • 增强启动画面
  • 使用颜色过渡动画化UI元素
  • 设计交互式按钮
  • 构建视觉上吸引人的引导流程

主要特点

  • 基于颜色的简单配置
  • 平滑渐变动画
  • 跨平台兼容性
  • 所需设置最少
  • 内置动画处理

适合对象

  • Flutter 初学者
  • UI/UX 设计师
  • 跨平台应用程序开发者
  • 需要视觉魅力的应用程序

使用建议

  • 除了颜色和速度之外,自定义选项有限
  • 可能会影响低端设备的性能
  • 不适合复杂的渐变图案

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Animate Gradient

pub Animated-Gradient

This Package lets you make animated gradients without any hassle. Just pass the primary and secondary colors and you're done. You can do amazing effects using the alignments. For More info read the docs below.

Usage

Create your first animated gradient.

The only two required arguments are the primaryColors and secondaryColors.

| primaryColors length must greater or equal to 2.| | secondaryColors length must be equal to primaryColors length.|

    import 'package:animate_gradient/animate_gradient.dart';

     AnimateGradient(
        primaryColors: const [
          Colors.pink,
          Colors.pinkAccent,
          Colors.white,
        ],
        secondaryColors: const [
          Colors.blue,
          Colors.blueAccent,
          Colors.white,
        ],
        child: YourWidget(),
      ),
drawing
Play with alignments.

Alignments are optional. You can pass any of the following alignments.

primaryBegin primaryEnd secondaryBegin secondaryEnd

With this in place, you can have some crazy effects.

   import 'package:animate_gradient/animate_gradient.dart';

    AnimateGradient(
       primaryBegin: Alignment.topLeft,
       primaryEnd: Alignment.bottomLeft,
       secondaryBegin: Alignment.bottomLeft,
       secondaryEnd: Alignment.topRight,
       primaryColors: const [
         Colors.pink,
         Colors.pinkAccent,
         Colors.white,
       ],
       secondaryColors: const [
         Colors.white,
         Colors.blueAccent,
         Colors.blue,
       ],
       child: YourWidget(),
     ),
drawing
Alternatively! Use AlignemntGeometry for better control

With the apps built in rtl format normal Alignments cannot always work. So, you can use AlignemntGeometry instead.

primaryBegin --> primaryBeginGeometry

primaryEnd --> primaryEndGeometry

secondaryBegin --> secondaryBeginGeometry

secondaryEnd --> secondaryEndGeometry

With this, you also have an additional property textDirectionForGeometry. This will be used to resolve the AlignmentGeometry

   import 'package:animate_gradient/animate_gradient.dart';

    AnimateGradient(
      primaryBeginGeometry: const AlignmentDirectional(0, 1),
      primaryEndGeometry: const AlignmentDirectional(0, 2),
      secondaryBeginGeometry: const AlignmentDirectional(2, 0),
      secondaryEndGeometry: const AlignmentDirectional(0, -0.8),
      textDirectionForGeometry: TextDirection.rtl,
       primaryColors: const [
         Colors.pink,
         Colors.pinkAccent,
         Colors.white,
       ],
       secondaryColors: const [
         Colors.white,
         Colors.blueAccent,
         Colors.blue,
       ],
       child: YourWidget(),
     ),
drawing

Please note that AlignmentGeometry will be given more priority over Alignment

Available properties

Property Type Description
primaryColors List Starting colors of the animation.
secondaryColors List Ending colors of the animation.
primaryBegin Alignment? Starting Alignment of primaryColors.
primaryEnd Alignment? Ending Alignment of primaryColors.
secondaryBegin Alignment? Starting Alignment of secondaryColors.
secondaryEnd Alignment? Ending Alignment of secondaryColors.
primaryBeginGeometry AlignmentGeometry? Starting AlignmentGeometry of primaryColors.
primaryEndGeometry AlignmentGeometry? Ending AlignmentGeometry of primaryColors.
secondaryBeginGeometry AlignmentGeometry? Starting AlignmentGeometry of secondaryColors.
secondaryEndGeometry AlignmentGeometry? Ending AlignmentGeometry of secondaryColors.
textDirectionForGeometry TextDirection? TextDirection that will be used to resolve AlignmentGeometry
duration Duration? Duration between the transition.
controller AnimationController?
You can pass your own animation controller and use that

to control animation however you want.
animateAlignments bool? If you want to animate alignments.
reverse bool? If you want to reverse the animation.
repeat bool? If you want to repeat the animation.
curve Curve? The curve to use for the animation.
child Widget? You can pass your widget.

Author

This plugin is developed by Vikas Kumar.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。