搜尋分類、套件與程式碼儲存庫

flutter_image_slideshow 封面
套件詳情v0.1.6

flutter_image_slideshow

一個簡單的圖片幻燈片組件。主要用於圖片組件,但也可以使用其他組件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
7080
喜歡數
202
Pub 分數
160

安裝套件

flutter pub add flutter_image_slideshow

套件介紹

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

一個輕量級的 Flutter 小部件,用於建立具有平滑過渡效果的影像幻燈片。主要設計用於顯示圖片,同時也支援在幻燈片中使用自訂小部件。非常適合用於相簿、產品展示或介紹畫面。此套件跨平台,可在 Android、iOS、Web、macOS、Windows 和 Linux 上順暢運作。透過單一依賴項即可輕鬆整合,並提供簡潔的 API 來管理幻燈片與動畫。

適用情境

  • 圖像畫廊
  • 產品輪播
  • 入門畫面
  • 數位看板
  • 演示介面

主要特色

  • 平滑的滑動過渡
  • 對自定義組件的支援
  • 跨平台相容性
  • 簡單設定,使用 pub add
  • 可設定的自動播放和持續時間

適合對象

  • 開發視覺內容顯示的開發者
  • 需要互動式圖像展示的應用程式
  • 專案需要最少的設定即可進行簡報

使用建議

  • 可能需要對大型圖像集進行優化
  • 複雜動畫的自訂選項有限
  • 不適合高性能量影片幻燈片

原始 README

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

flutter_image_slideshow

A simple image slideshow widget. Mainly intended for image widget, but other widgets can also be used.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  flutter:
    sdk:
  flutter_image_slideshow: any

In your library add the following import:

  import 'package:flutter_image_slideshow/flutter_image_slideshow.dart';

Usage

These are The ImageSlideshow properties.

/// The widgets to display in the [ImageSlideshow].
///
/// Mainly intended for image widget, but other widgets can also be used.
List<Widget> children

/// Width of the [ImageSlideshow].
double width

/// Height of the [ImageSlideshow].
double height

/// The page to show when first creating the [ImageSlideshow].
int initialPage

/// The color to paint the indicator.
Color indicatorColor

/// The color to paint behind th indicator.
Color indicatorBackgroundColor

/// Called whenever the page in the center of the viewport changes.
ValueChanged<int> onPageChanged

/// Auto scroll interval.
///
/// Do not auto scroll with null or 0.
int autoPlayInterval

/// Loops back to first slide.
bool isLoop

/// Radius of circle indicator.
double indicatorRadius

/// Disable page changes by the user.
bool disableUserScrolling

Example

Create the ImageSlideshow widget. And pass the parameters.

import 'package:flutter/material.dart';
import 'package:flutter_image_slideshow_test/flutter_image_slideshow.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Demo'),
        ),
        body: ImageSlideshow(

          /// Width of the [ImageSlideshow].
          width: double.infinity,

          /// Height of the [ImageSlideshow].
          height: 200,

          /// The page to show when first creating the [ImageSlideshow].
          initialPage: 0,

          /// The color to paint the indicator.
          indicatorColor: Colors.blue,

          /// The color to paint behind th indicator.
          indicatorBackgroundColor: Colors.grey,

          /// The widgets to display in the [ImageSlideshow].
          /// Add the sample image file into the images folder
          children: [
            Image.asset(
              'images/sample_image_1.jpg',
              fit: BoxFit.cover,
            ),
            Image.asset(
              'images/sample_image_2.jpg',
              fit: BoxFit.cover,
            ),
            Image.asset(
              'images/sample_image_3.jpg',
              fit: BoxFit.cover,
            ),
          ],

          /// Called whenever the page in the center of the viewport changes.
          onPageChanged: (value) {
            print('Page changed: $value');
          },

          /// Auto scroll interval.
          /// Do not auto scroll with null or 0.
          autoPlayInterval: 3000,

          /// Loops back to first slide.
          isLoop: true,
        ),
      ),
    );
  }
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。