fujidaiti / exprollable_page_view

Yet another PageView widget that expands its viewport as it scrolls. Exprollable is a coined word combining the words expandable and scrollable.
https://pub.dev/packages/exprollable_page_view
MIT License
74 stars 5 forks source link

The viewport fraction exceeds the upper limit when the page is fully expanded #39

Closed fujidaiti closed 1 year ago

fujidaiti commented 1 year ago
The code to reproduce this issue: ```dart import 'package:exprollable_page_view/exprollable_page_view.dart'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp(home: Home()); } } class Home extends StatefulWidget { const Home({super.key}); @override State createState() => _HomeState(); } class _HomeState extends State { late ExprollablePageController controller; @override void initState() { super.initState(); controller = ExprollablePageController( viewportConfiguration: ViewportConfiguration( minFraction: 0.9, maxFraction: 1.0, ), ); } @override Widget build(BuildContext context) { return Scaffold( body: ExprollablePageView( controller: controller, itemBuilder: (context, page) { final viewport = ExprollablePageController.of(context)!.viewport; return ColoredBox( color: Colors.blueAccent, child: SingleChildScrollView( controller: PageContentScrollController.of(context), physics: const AlwaysScrollableScrollPhysics(), child: SizedBox( height: viewport.pageDimensions.maxHeight, child: Placeholder( child: Center( child: ValueListenableBuilder( valueListenable: viewport, builder: (_, metrics, __) => Text( "Fraction = ${metrics.fraction.toStringAsFixed(3)}\n" "BottomPadding = ${metrics.dimensions.padding.bottom}\n" "ViewportHeight = ${metrics.dimensions.height}\n" "MaxPageHeight = ${metrics.pageDimensions.maxHeight}\n" "ApparentPageHeight = ${(metrics.pageDimensions.maxHeight * metrics.fraction).toStringAsFixed(3)}", style: Theme.of(context).textTheme.titleLarge, ), ), ), ), ), ), ); }, ), ); } } ```

The result:

Simulator Screen Recording - iPhone 14 Pro - 2023-06-12 at 02 19 46

In the above GIF, the apparent page height exceeds the max height (818px) when the page is fully expanded (852px).