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

套件詳情v2.1.0

animated_svg

用於顯示和動畫化可縮放向量圖形 1.1 檔案的 Flutter 套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
978
喜歡數
113
Pub 分數
160

安裝套件

flutter pub add animated_svg

套件介紹

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

Animated SVG 是一個 Flutter 套件,可讓 Flutter 應用程式顯示和動畫化可縮放向量圖形 (SVG) 檔案。它支援 SVG 1.1 格式,並允許開發者在多個平台以平滑動畫呈現向量圖形。此套件可無縫整合至 Flutter 專案中,提供輕量級解決方案,用於動態且與解析度無關的視覺效果。它特別適用於建立互動式 UI 元素、載入指示器或動畫插圖。支援 Android、iOS、Web、macOS、Windows 及 Linux,確保在各裝置上的一致呈現。

適用情境

  • 建立動畫加載指示器
  • 使用動畫渲染可縮放圖示
  • 構建互動式UI插圖
  • 顯示動畫商標
  • 提升應用入門體驗

主要特色

  • 支援 SVG 1.1 格式
  • 平滑動畫播放
  • 跨平台相容性
  • 輕量且高效
  • 與 Flutter 的輕鬆整合
  • 動態 SVG 渲染

適合對象

  • 需要向量動畫的應用程式開發者
  • 設計師整合SVG資產
  • 需要可擴展 UI 元素的專案
  • 互動式移動和網路應用
  • 以使用者介面為重點的應用程式,具備視覺敘事

使用建議

  • 限於 SVG 1.1(不支援 SMIL 或進階功能)
  • 效能可能會因複雜的 SVG 而有所差異
  • 需要對 SVG 檔案進行適當的優化
  • 不適用於高度動態或基於腳本的 SVG
  • 動畫控制在進階使用案例中需要手動設定

原始 README

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

Animated SVG | Flutter Package

Flutter package for displaying and animating Scalable Vector Graphics 1.1 files. The package has been written solely in Dart language.

animated_svg coverage style: very good analysis License: MIT

animated_svg_first_gif animated_svg_second_gif

Features

A powerful and fully customizable widget. With this package, you can animate SVGs without effort and make your UI look more lovely.

The AnimatedSvg widget creates a smooth transition between the two SVGs you assign.

   

Getting started

Let's take a look at how to implement AnimatedSvg to quickly create cool transition animation between SVGs.

First, add the following line to pubspec.yaml:

animated_svg: ^2.1.0

Second, import AnimatedSvg:

import 'package:animated_svg/animated_svg.dart';

Usage

Basic usage example:

main.dart

// Define an SvgController
late final SvgController controller;

@override
void initState() {
    // Initialize SvgController
    controller = AnimatedSvgController();
    super.initState();
}

@override
void dispose() {
    // Dispose SvgController
    controller.dispose();
    super.dispose();
}

@override
Widget build(BuildContext context) {
    // Call the AnimatedSvg widget anywhere in your widget tree.
    return AnimatedSvg(
        controller: controller,
        duration: const Duration(milliseconds: 600),
        onTap: () {},
        size: 80,
        clockwise: false,
        isActive: true,
        children: [
            SvgPicture.asset(
                'assets/play.svg',
            ),
            SvgPicture.asset(
                'assets/pause.svg',
            ),
        ],
    );
}

Example

More examples can be found in /example folder on GitHub.

Media Player - an example of basic implementation of AnimatedSvg. Simple project that simulates a media player. As usual, the player needs play and pause buttons. Thanks to the AnimatedSvg package, it is so easy to create a smooth transition between play and pause SVGs.

Additional information

This package has been written solely in Dart Language yet it has the flutter_svg as a dependency.

For more information please visit GitHub.

Feature requests and bugs

Please file feature requests and bugs at the issue tracker.

Maintainers

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。