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

套件詳情v1.0.0

sliver_fab

一個包裝器小部件,允許將小部件放置在 FlexibleSpacebar 的邊緣

近 30 天下載
1210
喜歡數
76
Pub 分數
40

安裝套件

flutter pub add sliver_fab

套件介紹

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

sliver_fab 套件提供了一個包裝元件,可於 Flutter 的 FlexibleSpaceBar 邊緣放置浮動操作按鈕(FAB)或任何其他元件。它專為在 CustomScrollView 中順暢運作而設計,能精確定位相對於可滾動內容的 UI 元素。這在使用帶有視差效果的複雜應用列欄時,提升了視覺與互動體驗。此套件輕量且專注於解決現代 Flutter 應用中的特定佈局挑戰。

適用情境

  • 將 FAB 放在可摺疊應用欄的邊緣附近
  • 建立視覺上一致的可捲動介面
  • 增強固定位置小部件的使用者互動
  • 將小部件整合到 FlexibleSpaceBar 排版中
  • 設計具有動態行為的響應式應用欄

主要特色

  • 精確的控件邊緣定位
  • 與 CustomScrollView 的相容性
  • 支援 FlexibleSpaceBar 集成
  • 最小性能開銷
  • 簡單 API 用於常見使用案例

適合對象

  • 使用自定應用欄開發 Material Design 應用的開發者
  • 使用浮動元素實現滾動驅動UI的團隊
  • 在可滾動視圖中需要優雅的 FAB 定位的項目

使用建議

  • 僅限在 CustomScrollView 環境中使用
  • 不支援非邊緣放置
  • 需要了解滑塊組件和佈局約束
  • 可能需要額外的樣式來實現複雜的動畫

原始 README

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

sliver_fab

A wrapper widget allowing to place a widget on the edge of FlexibleSpacebar.

gif

gif

Example usage

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Builder(
        builder: (context) =>
        new SliverFab(
          floatingWidget: FloatingActionButton(
            onPressed: () =>
                Scaffold.of(context).showSnackBar(
                    SnackBar(content: Text("You clicked FAB!"))),
            child: Icon(Icons.add),
          ),
          floatingPosition: FloatingPosition(right: 16),
          expandedHeight: 256.0,
          slivers: <Widget>[
            new SliverAppBar(
              expandedHeight: 256.0,
              pinned: true,
              flexibleSpace: new FlexibleSpaceBar(
                title: new Text("SliverFab Example"),
                background: new Image.asset(
                  "img.jpg",
                  fit: BoxFit.cover,
                ),
              ),
            ),
            new SliverList(
              delegate: new SliverChildListDelegate(
                new List.generate(
                  30,
                      (int index) =>
                  new ListTile(title: new Text("Item $index")),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Installing

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  sliver_fab: "^1.0.0"

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:sliver_fab/sliver_fab.dart';

Contributing

This package was made mostly for use case I needed. If you fill it is missing any features or you have found a bug, pull requests are very welcome!

所屬分類

原始碼儲存庫

使用此套件的專案