搜索插件、代码仓与 APP 分类

插件详情v4.0.4

bottom_sheet

具有滚动内容功能的灵活底部弹出窗口,即使没有列表也能滚动内容。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
3万
喜欢数
410
Pub 分数
140

安装插件

flutter pub add bottom_sheet

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个灵活的底部抽屉小部件,适用于 Flutter,即使内容未包裹在列表中也能支持滚动。它提供平滑且可自定义的过渡效果,并设计用于跨多个平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)使用。该包通过从屏幕底部呈现交互式内容并具备响应式行为,提升了用户体验。非常适合用于模态框、筛选器或需要空间但无需全屏导航的详细视图。

适合场景

  • 模态对话框
  • 筛选面板
  • 详细内容查看
  • 交互式表单
  • 快速操作菜单

主要特点

  • 无 ListView 的可滚动内容
  • 跨平台支持
  • 可自定义的动画
  • 灵活的高度控制
  • 响应式设计
  • 轻松集成

适合对象

  • 开发多平台应用的开发者
  • UI 密集型应用
  • 需要可扩展内容区域的应用程序
  • 需要一致底部表单的设计系统
  • 使用 Surf Studio 的 Flutter 组件的团队

使用建议

  • 需要仔细处理嵌套的可滚动组件
  • 复杂布局可能需要额外的样式
  • 使用大量内容时的性能影响
  • 除了基本用法外,文档有限
  • 未针对超大数据集进行优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Bottom Sheet

Made by Surf 🏄‍♂️🏄‍♂️🏄‍♂️

Build Status Coverage Status Pub Version Pub Likes Pub popularity Flutter Platform

About

Custom bottom sheet widget that can be resized in response to drag gestures and then scrolled.

Overview

Main classes:

  1. FlexibleBottomSheet
  2. BottomSheetRoute and showing methods

Flexible and scrollable bottom sheet.

All you have to do is call showFlexibleBottomSheet() and you'll get a popup that looks like a modal bottom sheet and can be resized by dragging it up and down and scrolled when expanded.

There are 2 types of BottomSheets:

  1. BottomSheet
  2. StickyBottomSheet

Example

Simple BottomSheet

Demo

Demo

To show bottomSheet, use :

showFlexibleBottomSheet(
  minHeight: 0,
  initHeight: 0.5,
  maxHeight: 1,
  context: context,
  builder: _buildBottomSheet,
  anchors: [0, 0.5, 1],
  isSafeArea: true,
);

Widget _buildBottomSheet(
    BuildContext context,
    ScrollController scrollController,
    double bottomSheetOffset,
  ) {
    return Material(
        child: Container(
          child: ListView(
            controller: scrollController,
            ...
          ),
        ),
      );
  }
BottomSheet with height based on content

Demo

showFlexibleBottomSheet(
  minHeight: 0,
  initHeight: 0.8,
  maxHeight: 0.8,
  context: context,
  builder: _buildBottomSheet,
  isExpand: false,
);

Widget _buildBottomSheet(
    BuildContext context,
    ScrollController scrollController,
    double bottomSheetOffset,
  ) {
    return Material(
        child: Container(
          child: ListView(
              controller: scrollController,
              shrinkWrap: true,
              ...
          ),
        ),
      );
  }
Sticky BottomSheet

Demo

To show sticky BottomSheet, use:
You have to return SliverChildListDelegate from builder !!!

showStickyFlexibleBottomSheet(
  minHeight: 0,
  initHeight: 0.5,
  maxHeight: 1,
  headerHeight: 200,
  context: context,
  backgroundColor: Colors.white,
  headerBuilder: (BuildContext context, double offset) {
    return Container(
      ...
    );
  },
  builder: (BuildContext context, double offset) {
    return SliverChildListDelegate(
      <Widget>[...],
    );
  },
  anchors: [0, 0.5, 1],
);

Installation

Add bottom_sheet to your pubspec.yaml file:

dependencies:
  bottom_sheet: $currentVersion$

At this moment, the current version of bottom_sheet is bottom_sheet version.

Changelog

All notable changes to this project will be documented in this file.

Issues

To report your issues, submit them directly in the Issues section.

Contribute

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.

Your PRs are always welcome.

How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

Telegram

License

Apache License, Version 2.0

所属分类

依赖

依赖清单 1 项

  • bottom_inset_observer^3.1.0

源码仓库

使用此插件的项目