Skip to content

Commit

Permalink
Merge pull request #28 from fujidaiti/dev
Browse files Browse the repository at this point in the history
Minor updates
  • Loading branch information
fujidaiti authored May 5, 2023
2 parents 0c3de83 + c2ea0b4 commit c232e12
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
14 changes: 7 additions & 7 deletions package/lib/src/addon/modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ class _ModalExprollableState extends State<ModalExprollable> {
}
}

/// Scroll physics commonly used for descendant scrollables of [ModalExprollable].
/// Scroll physics normally used for descendant scrollables of [ModalExprollable].
///
/// This physics always lets the user overscroll making *dra down to dismiss* action
/// is available on every platform. [ModalExprollable] provides this as the default physics
/// This physics always lets the user overscroll making *drag down to dismiss* action
/// available on every platform. [ModalExprollable] provides this as the default physics
/// for its descendants via [ScrollConfiguration].
/// If you explicitly specify a physics for a descendant scrollable,
/// consider to wrap that physics with this.
Expand All @@ -196,11 +196,11 @@ class _ModalExprollableState extends State<ModalExprollable> {
/// );
/// ```
class ModalExprollableScrollPhysics extends ScrollPhysics {
/// Creates a scrolling physics that always lets the user overscroll.
/// Creates a scroll physics that always lets the user overscroll.
///
/// This will delegate its logic to [BouncingScrollPhysics] if the user overscrolls,
/// so that the *drag down to dismiss* action is available on every platform.
/// Otherwise, it delegates to the given [parent].
/// This physics will delegate its logic to a [BouncingScrollPhysics]
/// while the user is overscrolling, so that the *drag down to dismiss* action is available
/// on every platform. Otherwise, it delegates to the given [parent].
const ModalExprollableScrollPhysics({
ScrollPhysics? parent,
}) : super(parent: parent);
Expand Down
15 changes: 10 additions & 5 deletions package/lib/src/core/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:exprollable_page_view/src/core/view.dart';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';

Expand Down Expand Up @@ -125,10 +126,10 @@ class ExprollablePageController extends PageController {

/// Crate a page controller with additional snap viewport offsets.
///
/// [additionalSnapOffsets] must not be empty. The viewport will snap to
/// the offsets given by [additionalSnapOffsets] in addition to
/// [additionalSnapOffsets] must not be empty. The viewport will snap to
/// the offsets given by [additionalSnapOffsets] in addition to
/// [ViewportOffset.expanded] and [ViewportOffset.shrunk].
///
///
/// If [initialViewportOffset] or [maxViewportOffset] is not specified,
/// the max offset in [additionalSnapOffsets] is used.
factory ExprollablePageController.withAdditionalSnapOffsets(
Expand Down Expand Up @@ -370,10 +371,14 @@ mixin PageViewportMetrics on ViewportMetrics {
double get expandedOffset;

/// Indicates if the viewport is fully shrunk.
bool get isShrunk => offset >= shrunkOffset;
bool get isShrunk =>
nearEqual(offset, shrunkOffset, Tolerance.defaultTolerance.distance) ||
offset > shrunkOffset;

// Indicates if the viewport is fully expanded.
bool get isExpanded => offset <= expandedOffset;
bool get isExpanded =>
nearEqual(offset, expandedOffset, Tolerance.defaultTolerance.distance) ||
offset < expandedOffset;
}

/// A snapshot of the state of the conceptual viewport.
Expand Down
9 changes: 1 addition & 8 deletions package/lib/src/internal/scroll.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ class AbsorbScrollPosition extends ScrollPositionWithSingleContext {
@override
void absorb(ScrollPosition other) {
super.absorb(other);
// if (other is AbsorbScrollPosition && other.absorber.pixels != null) {
// absorber.absorb(other.absorber.pixels!);
// } else if (hasPixels && hasContentDimensions) {
// // `super.absorb(other)` may set `super._pixels` to an invalid value,
// // which needs to be corrected.
// correctPixels(pixels);
// }
if (other.hasPixels && other is AbsorbScrollPosition) {
// `super.absorb(other)` may set `super._pixels` to an invalid value,
// which needs to be corrected.
Expand Down Expand Up @@ -354,7 +347,7 @@ class AbsorbScrollPosition extends ScrollPositionWithSingleContext {
@override
void jumpTo(double value) {
goIdle();
if (impliedPixels.almostEqualTo(value)) {
if (!impliedPixels.almostEqualTo(value)) {
final double oldPixels = pixels;
forcePixels(value);
didStartScroll();
Expand Down

0 comments on commit c232e12

Please sign in to comment.