FLUTTER ECOSYSTEM

santa112358/customizable_space_bar

AppBar,随着滚动速度改变内容。可实现“大标题”效果。

可自定义的空格栏 项目封面
Stars
18
Forks
2
最近推送(UTC)
2021年3月28日
项目状态
未归档
Santa Takahashi GitHub avatar
GITHUB User

Santa Takahashi ↗

cat enthusiast

FreelanceTokyo官方网站 ↗
语言DartHTMLSwiftKotlinObjective-C

此仓库发布的插件

使用的依赖

依赖清单 2 项
  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

customizable_space_bar

pub package License: MIT

AppBar which changes the content with scrolling rate. Enables to implement "Large Title"

13063567123474

Usage

This package is expected to be used with flexibleSpace: in SliverAppBar, which means you also need to use CustomScrollView.

    CustomScrollView(
        slivers: [
          SliverAppBar(
            pinned: true,
            leading: IconButton(icon: Icon(Icons.arrow_back_ios_sharp)),
            backgroundColor: Theme.of(context).scaffoldBackgroundColor,

            /// This is the part you use this package
            flexibleSpace: CustomizableSpaceBar(
              builder: (context, scrollingRate) {
                /// Example content
                return Padding(
                  padding: EdgeInsets.only(
                      bottom: 13, left: 12 + 40 * scrollingRate),
                  child: Align(
                    alignment: Alignment.bottomLeft,
                    child: Text(
                      "Hello World.",
                      style: TextStyle(
                          fontSize: 42 - 18 * scrollingRate,
                          fontWeight: FontWeight.bold),
                    ),
                  ),
                );
              },
            ),
            /// End of the part

            expandedHeight: 150,
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (context, index) {
                return ListTile(
                  title: Text("LIST ITEM"),
                );
              },
            ),
          )
        ],
      ),

You can control the layout in the AppBar with scrollingRate.

When the shape is fully expanded, scrollingRate is 0.0. When the shape is collapsed to AppBar, it reaches to the limit 1.0.

13063658045969

If you have any requests or questions, please feel free to ask on github.