Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fix animations #95

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v2

- id: fvm_version
uses: zoexx/github-action-json-file-properties@release
uses: zoexx/github-action-json-file-properties@1.0.4
with:
file_path: ".fvm/fvm_config.json"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_pub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v2

- id: fvm_version
uses: zoexx/github-action-json-file-properties@release
uses: zoexx/github-action-json-file-properties@1.0.4
with:
file_path: ".fvm/fvm_config.json"

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog

## [Unreleased, estimated N.N.N]

## 4.0.1
### Fixed
* Sticking when closing at the end
### Changed
* Split the animation speed into opening and closing speeds. The closing speed has been reduced.
* FlexibleBottomSheetRoute has been made public

## 4.0.0
### Fixed
* BottomSheet pop twice
Expand Down
5 changes: 4 additions & 1 deletion lib/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ export 'package:bottom_sheet/src/flexible_bottom_sheet.dart'
export 'package:bottom_sheet/src/flexible_bottom_sheet_header_delegate.dart'
show FlexibleBottomSheetHeaderDelegate;
export 'package:bottom_sheet/src/flexible_bottom_sheet_route.dart'
show showFlexibleBottomSheet, showStickyFlexibleBottomSheet;
show
FlexibleBottomSheetRoute,
showFlexibleBottomSheet,
showStickyFlexibleBottomSheet;
2 changes: 1 addition & 1 deletion lib/src/flexible_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class _FlexibleBottomSheetState<T> extends State<FlexibleBottomSheet<T>> {
// Checking if the bottom sheet needs to be closed.
void _checkNeedCloseBottomSheet(double extent) {
if (widget.isCollapsible && !_isClosing) {
if (extent - widget.minHeight <= 0.005) {
if (extent - widget.minHeight <= 0.01) {
_isClosing = true;
_dismiss();
}
Expand Down
14 changes: 8 additions & 6 deletions lib/src/flexible_bottom_sheet_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import 'package:bottom_sheet/src/flexible_bottom_sheet.dart';
import 'package:flutter/material.dart';

const Duration _bottomSheetDuration = Duration(milliseconds: 500);
const Duration _bottomSheetEnterDuration = Duration(milliseconds: 250);
const Duration _bottomSheetExitDuration = Duration(milliseconds: 200);

/// Shows a flexible bottom sheet.
///
Expand Down Expand Up @@ -71,7 +72,7 @@ Future<T?> showFlexibleBottomSheet<T>({
assert(barrierColor == null || isModal);

return Navigator.of(context, rootNavigator: useRootNavigator).push(
_FlexibleBottomSheetRoute<T>(
FlexibleBottomSheetRoute<T>(
theme: Theme.of(context),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
draggableScrollableController: draggableScrollableController,
Expand Down Expand Up @@ -159,7 +160,7 @@ Future<T?> showStickyFlexibleBottomSheet<T>({
assert(barrierColor == null || isModal);

return Navigator.of(context, rootNavigator: useRootNavigator).push(
_FlexibleBottomSheetRoute<T>(
FlexibleBottomSheetRoute<T>(
theme: Theme.of(context),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
minHeight: minHeight ?? 0,
Expand Down Expand Up @@ -188,7 +189,7 @@ Future<T?> showStickyFlexibleBottomSheet<T>({
}

/// A modal route with flexible bottom sheet.
class _FlexibleBottomSheetRoute<T> extends PopupRoute<T> {
class FlexibleBottomSheetRoute<T> extends PopupRoute<T> {
final FlexibleDraggableScrollableWidgetBuilder? builder;
final FlexibleDraggableScrollableHeaderWidgetBuilder? headerBuilder;
final FlexibleDraggableScrollableWidgetBodyBuilder? bodyBuilder;
Expand Down Expand Up @@ -217,7 +218,7 @@ class _FlexibleBottomSheetRoute<T> extends PopupRoute<T> {
final String? barrierLabel;

@override
Duration get transitionDuration => duration ?? _bottomSheetDuration;
Duration get transitionDuration => duration ?? _bottomSheetEnterDuration;

@override
bool get barrierDismissible => isDismissible;
Expand All @@ -229,7 +230,7 @@ class _FlexibleBottomSheetRoute<T> extends PopupRoute<T> {

late AnimationController _animationController;

_FlexibleBottomSheetRoute({
FlexibleBottomSheetRoute({
required this.minHeight,
required this.initHeight,
required this.maxHeight,
Expand Down Expand Up @@ -261,6 +262,7 @@ class _FlexibleBottomSheetRoute<T> extends PopupRoute<T> {
AnimationController createAnimationController() {
_animationController = AnimationController(
duration: transitionDuration,
reverseDuration: _bottomSheetExitDuration,
debugLabel: 'FlexibleBottomSheet',
vsync: navigator!.overlay!,
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bottom_sheet
version: 4.0.0
version: 4.0.1
description: Flexible bottom sheet with the ability to scroll content even without a list.
repository: "https://github.com/surfstudio/flutter-bottom-sheet"
issue_tracker: "https://github.com/surfstudio/flutter-bottom-sheet/issues"
Expand Down
Loading