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

Disabling and then enabling scrolling prevents the viewport from expanding #17

Closed
khoadng opened this issue Apr 18, 2023 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@khoadng
Copy link
Contributor

khoadng commented Apr 18, 2023

Video

Screen.Recording.2023-04-18.at.20.20.47.mov
import 'package:exprollable_page_view/exprollable_page_view.dart';
import 'package:flutter/material.dart';

class SimpleExample extends StatefulWidget {
  const SimpleExample({super.key});

  @override
  State<SimpleExample> createState() => _SimpleExampleState();
}

class _SimpleExampleState extends State<SimpleExample> {
  var enableScroll = true;
  var expanded = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: Text(enableScroll ? "Scrolling Enable" : "Scrolling Disable")),
      floatingActionButton: FloatingActionButton(
        onPressed: () => setState(() => enableScroll = !enableScroll),
        child: Icon(Icons.add),
      ),
      bottomSheet: BottomSheet(
        onClosing: () {},
        builder: (context) => Container(
          height: 80,
          child: AppBar(title: Text(expanded ? "Expanded" : "Shrunk")),
        ),
      ),
      body: ExprollablePageView(
        physics: enableScroll ? null : NeverScrollableScrollPhysics(),
        onViewportChanged: (metrics) =>
            setState(() => expanded = metrics.isExpanded),
        itemCount: 5,
        itemBuilder: (context, page) {
          return ListView.builder(
            physics: enableScroll ? null : NeverScrollableScrollPhysics(),
            itemCount: 100,
            controller: PageContentScrollController.of(context),
            itemBuilder: (context, index) =>
                ListTile(title: Text(index.toString())),
          );
        },
      ),
    );
  }
}
@fujidaiti fujidaiti self-assigned this Apr 18, 2023
@fujidaiti fujidaiti added the bug Something isn't working label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants