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

swipe_image_gallery 封面
套件詳情v0.11.0

swipe_image_gallery

一個可滾動、可透過滑動關閉、可縮放的相簿,您可以在其上新增動態覆蓋層。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.1萬
喜歡數
101
Pub 分數
160

安裝套件

flutter pub add swipe_image_gallery

套件介紹

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

Swipe Image Gallery 是一個 Flutter 套件,讓開發者能夠建立具備滑動關閉、縮放與動態覆疊功能的互動式影像畫廊。它支援多個平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。此畫廊允許使用者滾動瀏覽圖片,透過滑動來關閉圖片,並可放大/縮小以進行詳細檢視。開發者可利用動態覆疊(例如文字或圖示)來自訂畫廊。非常適合用於照片分享應用、產品展示,或任何需要直覺影像導航的應用。

適用情境

  • 照片分享應用
  • 產品圖片檢視器
  • 互動敘事
  • 影像審核工作流程
  • 數位專輯展示

主要特色

  • 滑動關閉功能
  • 可縮放的圖像
  • 動態疊加支援
  • 跨平台相容性
  • 可自訂手勢控制
  • 流暢的滾動體驗

適合對象

  • 移動和網頁圖像畫廊
  • 需要互動式圖像關閉的應用程式
  • 尋求可自定義圖像 UI 的開發者
  • 需要縮放和滑動手勢的項目
  • 以使用者體驗為導向的視覺化應用

使用建議

  • 可能需要對大型圖像集進行性能優化
  • 疊加定位可能需要仔細的佈局管理
  • 與其他小部件可能產生手勢衝突
  • 有限的內建動畫自訂
  • 最適合每畫廊中等數量的圖像

原始 README

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

Swipe Image Gallery

Pub Version

A scrollable, dismissable by swiping, zoomable gallery on which you can add a dynamic overlay. While it is intended for an image gallery different types of widgets can also be used.

Installation

Add swipe_image_gallery as a dependency in your pubspec.yaml file.

Usage

With a List of Image Widgets
final assets = const [
  Image(image: AssetImage('assets/1.jpeg')),
  Image(image: AssetImage('assets/2.jpeg')),
  Image(image: AssetImage('assets/3.jpeg')),
  Image(image: AssetImage('assets/4.jpeg')),
];

...

SwipeImageGallery(
  context: context,
  children: assets,
).show();

Image Widgets

With a List of Widgets
final widgets = [
  Container(
    color: Colors.white,
    child: Center(
      child: Text('First Page', style: TextStyle(fontSize: 24.0)),
    ),
  ),
  Container(
    color: Colors.grey,
    child: Center(
      child: Text('Second Page', style: TextStyle(fontSize: 24.0)),
    ),
  ),
];

...

SwipeImageGallery(
  context: context,
  children: widgets,
).show();

Widgets

Using Builder
final urls = [
  'https://via.placeholder.com/400',
  'https://via.placeholder.com/800',
  'https://via.placeholder.com/900x350',
  'https://via.placeholder.com/1000',
  'https://via.placeholder.com/100',
];

...

SwipeImageGallery(
  context: context,
  itemBuilder: (context, index) {
    return Image.network(urls[index]);
  },
  itemCount: urls.length,
).show();

Add an Overlay

You can find the OverlayExample widget here.

  StreamController<Widget> overlayController =
      StreamController<Widget>.broadcast();

  @override
  void dispose() {
    overlayController.close();
    super.dispose();
  }

  ...

  SwipeImageGallery(
    context: context,
    children: remoteImages,
    onSwipe: (index) {
      overlayController.add(OverlayExample(
        title: '${index + 1}/${remoteImages.length}',
      ));
    },
    overlayController: overlayController,
    initialOverlay: OverlayExample(
      title: '1/${remoteImages.length}',
    ),
  ).show();

overlay

Hero Animation
final heroProperties = [
  ImageGalleryHeroProperties(tag: 'imageId1'),
  ImageGalleryHeroProperties(tag: 'imageId2'),
];

final assets = const [
  Image(image: AssetImage('assets/1.jpeg')),
  Image(image: AssetImage('assets/2.jpeg')),
];

...

Row(
  children: [
    Expanded(
      child: InkWell(
        onTap: () => SwipeImageGallery(
          context: context,
          children: assets,
          heroProperties: heroProperties,
        ).show(),
        child: Hero(
          tag: 'imageId1',
          child: Image(
            image: AssetImage('assets/1.jpeg'),
          ),
        ),
      ),
    ),
    Expanded(
      child: InkWell(
        onTap: () => SwipeImageGallery(
          context: context,
          children: assets,
          initialIndex: 1,
          heroProperties: heroProperties,
        ).show(),
        child: Hero(
          tag: 'imageId2',
          child: Image(
            image: AssetImage('assets/2.jpeg'),
          ),
        ),
      ),
    ),
  ],
),

hero

For more detailed examples you can check out the example project.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。