Skip to content

Commit

Permalink
Migrate to flutter 3.20.0.pre (#57)
Browse files Browse the repository at this point in the history
Migrate to `3.20.0-1.1.pre`. This is necessary because the current SDK used to analyze packages on pub.dev is `3.20.0-1.1.pre`, which has a breaking change in the `PageView` class that is not compatible with the current version of this package (described below). As a result, static analysis errors occur on pub.dev.

## What changes will be made in 3.20?

`PageView.controller` will be nullable.

## How to migrate?

Make `OverflowPageView` always receive a non-nullable `PageController` in the constructor.
  • Loading branch information
fujidaiti authored Feb 24, 2024
1 parent e2ec9ec commit 273bbe8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
4 changes: 4 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.1 Feb 25, 2024

- Small refactoring (no functional changes).

## 1.0.0 Feb 24, 2024

- Dart3 is now required.
Expand Down
4 changes: 1 addition & 3 deletions package/lib/src/addon/modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ class ModalExprollableScrollPhysics extends ScrollPhysics {
/// 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);
const ModalExprollableScrollPhysics({super.parent});

@override
ModalExprollableScrollPhysics applyTo(ScrollPhysics? ancestor) {
Expand Down
28 changes: 16 additions & 12 deletions package/lib/src/internal/paging.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// Copied and modified from:
/// - https://github.com/flutter/flutter/tree/master/packages/flutter/lib/src/widgets/page_view.dart
/// - https://github.com/flutter/flutter/tree/master/packages/flutter/lib/src/rendering/sliver_fill.dart
///
/// Changes done:
/// - Replace [SliverFillViewport] with [_SliverFillViewport] in [_PageViewState.build]
/// - In [_RenderSliverFillViewport.performLayout], force the children to always occupy the parent viewport,
/// regardless of [_RenderSliverFillViewport.itemExtent].
// Copied and modified from:
// - https://github.com/flutter/flutter/tree/master/packages/flutter/lib/src/widgets/page_view.dart
// - https://github.com/flutter/flutter/tree/master/packages/flutter/lib/src/rendering/sliver_fill.dart
//
// Changes done:
// - Replace [SliverFillViewport] with [_SliverFillViewport] in [_PageViewState.build]
// - In [_RenderSliverFillViewport.performLayout], force the children to always occupy the parent viewport,
// regardless of [_RenderSliverFillViewport.itemExtent].

// Copyright 2014 The Flutter Authors. All rights reserved.
//
Expand Down Expand Up @@ -376,7 +376,7 @@ class OverflowPageView extends PageView {
super.key,
super.scrollDirection,
super.reverse,
super.controller,
required PageController controller,
super.physics,
super.pageSnapping,
super.onPageChanged,
Expand All @@ -390,7 +390,7 @@ class OverflowPageView extends PageView {
super.scrollBehavior,
super.padEnds,
required this.childConstraints,
}) : super.builder();
}) : super.builder(controller: controller);

final BoxConstraints childConstraints;

Expand All @@ -408,7 +408,9 @@ class _PageViewState extends State<OverflowPageView> {
@override
void initState() {
super.initState();
_lastReportedPage = widget.controller.initialPage;
// FIXME: Workaround to pass the static analysis on pub.dev
// ignore: unnecessary_non_null_assertion
_lastReportedPage = widget.controller!.initialPage;
}

AxisDirection _getDirection(BuildContext context) {
Expand Down Expand Up @@ -469,7 +471,9 @@ class _PageViewState extends State<OverflowPageView> {
clipBehavior: widget.clipBehavior,
slivers: <Widget>[
_SliverFillViewport(
viewportFraction: widget.controller.viewportFraction,
// FIXME: Workaround to pass the static analysis on pub.dev
// ignore: unnecessary_non_null_assertion
viewportFraction: widget.controller!.viewportFraction,
delegate: widget.childrenDelegate,
padEnds: widget.padEnds,
childConstraints: widget.childConstraints,
Expand Down
2 changes: 1 addition & 1 deletion package/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: exprollable_page_view
description: Yet another PageView widget that expands its page while scrolling it. Exprollable is a coined word combining the words expandable and scrollable.
version: 1.0.0
version: 1.0.1
repository: https://github.com/fujidaiti/exprollable_page_view

environment:
Expand Down

0 comments on commit 273bbe8

Please sign in to comment.