Search packages, repositories and app categories

Package detailsv1.0.1

stopper

A bottom sheet that can be expanded to one of the pre-defined stop heights by dragging.

30-day downloads
18
Likes
21
Pub points
40

Install package

flutter pub add stopper

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Stopper is a Flutter package that provides a bottom sheet with predefined stop heights, allowing users to drag and expand the sheet to specific positions. It enhances user interaction by offering smooth, controlled expansion within set limits, ideal for modals or supplementary content panels. The package is lightweight and integrates seamlessly into existing Flutter apps. It supports custom stop points and animations, making it suitable for intuitive UI designs. The source code is publicly available on GitHub for transparency and contribution.

Use cases

  • Interactive bottom sheets with fixed expansion levels
  • Customizable modal panels
  • Enhanced user control over panel height
  • Dynamic content overlays
  • Smooth drag-to-expand interfaces

Key features

  • Predefined stop heights
  • Drag-based expansion
  • Customizable stop points
  • Smooth animations
  • Lightweight and easy integration

Suitable for

  • Developers building interactive bottom sheets
  • Apps needing controlled panel expansion
  • UIs requiring precise bottom sheet behavior
  • Flutter projects focused on user experience
  • Design systems with consistent panel interactions

Considerations

  • No platform-specific limitations mentioned
  • Requires manual configuration of stop heights
  • Limited to bottom sheet use cases
  • No built-in state management
  • Depends on external dependencies for advanced features

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Stopper

A bottom sheet that can be expanded to one of the pre-defined stop heights by dragging.

animated image

Introduction

Some iOS applications have a bottom sheet that has two states: half-expanded and fully expanded. The standard showBottomSheet method lacks such a capability. The complexity in implementing this behavior arises when the the bottom sheet needs to be scrollable, making scroll and drag event handling difficult as these gestures can be used for scrolling the list as well as for dragging the bottom sheet up/down, depending on the position of the bottom sheet and the current scroll position. The Stopper plugin addresses this problem by:

  • Letting the developer define discreet height values (stops) to which the bottom sheet can be expanded;
  • Using the builder pattern to build the bottom sheet depending on the current stop value;
  • Instantiating ScrollController and ScrollPhysics objects and passing them to the bottom sheet builder;
  • Using animations to make transitions of the bottom sheet between the stops look natural;
  • Providing a convenient showStopper function to be used instead of showBottomSheet in order to handle dismissal of the bottom sheet by the user.

This plugin utilizes bottom sheet functionality from the Scaffold widget and avoids copy/paste from the standard library, making the implementation clear and easy to maintain.

Example

import 'package:stopper/stopper.dart';
//...
final height = MediaQuery.of(context).size.height;
//...
MaterialButton(
  child: Text("Show Stopper"),
  onPressed: () {
    showStopper(
      context: context,
      stops: [0.5 * height, height],
      builder: (context, scrollController, scrollPhysics, stop) {
        return ListView(
          controller: scrollController,
          physics: scrollPhysics,
          children: [
            //...
          ]
        );
      }
    );
  },
  ...
)

Note: The build context passed to showStopper must have a Scaffold widget as an ancestor. Therefore it's recommended to use Builder to build the body of the Scaffold. See the complete example app provided in this package for details on this approach.

Categories

Source repository

Projects using this package

No data available yet.