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

A _ContentIdleScrollDrivenSheetActivity was used after being disposed. #103

Open
yfming93 opened this issue Apr 24, 2024 · 1 comment
Open
Labels
need more information Lack of information to reproduce or determine if it is a bug or not

Comments

@yfming93
Copy link

yfming93 commented Apr 24, 2024

0.4.1 version work well. But 0.4.2 version work error.

image

Code are present below:

import 'dart:ui';

import 'package:app/core/app_export.dart';
import 'package:app/location/map_self.dart';
import 'package:smooth_sheets/smooth_sheets.dart';

class ContentSheet extends StatelessWidget {
  const ContentSheet({super.key, required this.ct,});

  final Widget ct;


  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {


        final minH = constraints.maxHeight - mapH - 40;
        final minSheetExtent = Extent.pixels(minH);
        // final parentHeight = constraints.maxHeight;
        final sheetHeight = constraints.maxHeight - MediaQuery.of(context).padding.top ;

        final sheetPhysics = StretchingSheetPhysics(
          parent: SnappingSheetPhysics(
            // spring: SpringDescription.withDampingRatio(
            //   mass: 1,
            //   stiffness: 100.0,
            //   ratio: 1.1,
            // ),
            snappingBehavior: SnapToNearest(
              snapTo: [
                minSheetExtent,
                const Extent.proportional(1),
              ],
            ),
          ),
        );

        return ScrollableSheet(
          physics: sheetPhysics,
          minExtent: minSheetExtent,
          initialExtent: minSheetExtent,
          child: SizedBox(
            height: sheetHeight,
            // child: ListView(
            //   padding: EdgeInsets.zero,
            //   shrinkWrap: true,
            //   physics: NeverScrollableScrollPhysics(),
            //   children: [
            //     ct,
            //   ],
            // ),

            child: SingleChildScrollView(
              child: Container(
                height: 1000,
                color: C.red,
              ),
            ),
            // child: ct,
          ),
        );
      },
    );
  }
@fujidaiti
Copy link
Owner

Thank you for your reporting, but I couldn't reproduce the error even with v0.4.2. Here's the code that I've used.

Code
import 'package:flutter/material.dart';
import 'package:smooth_sheets/smooth_sheets.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Stack(
          children: [
            Placeholder(),
            ContentSheet(),
          ],
        ),
      ),
    );
  }
}

const mapH = 200.0;

class ContentSheet extends StatelessWidget {
  const ContentSheet({
    super.key,
    // required this.ct,
  });

  // final Widget ct;

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        final minH = constraints.maxHeight - mapH - 40;
        final minSheetExtent = Extent.pixels(minH);
        // final parentHeight = constraints.maxHeight;
        final sheetHeight =
            constraints.maxHeight - MediaQuery.of(context).padding.top;

        final sheetPhysics = StretchingSheetPhysics(
          parent: SnappingSheetPhysics(
            // spring: SpringDescription.withDampingRatio(
            //   mass: 1,
            //   stiffness: 100.0,
            //   ratio: 1.1,
            // ),
            snappingBehavior: SnapToNearest(
              snapTo: [
                minSheetExtent,
                const Extent.proportional(1),
              ],
            ),
          ),
        );

        return ScrollableSheet(
          physics: sheetPhysics,
          minExtent: minSheetExtent,
          initialExtent: minSheetExtent,
          child: SizedBox(
            height: sheetHeight,
            // child: ListView(
            //   padding: EdgeInsets.zero,
            //   shrinkWrap: true,
            //   physics: NeverScrollableScrollPhysics(),
            //   children: [
            //     ct,
            //   ],
            // ),

            child: SingleChildScrollView(
              child: Container(
                height: 1000,
                color: Colors.red,
              ),
            ),
            // child: ct,
          ),
        );
      },
    );
  }
}

Can you give me more information about the missing part of your code, such as the widget that surrounds the ContentSheet widget?

@fujidaiti fujidaiti added the need more information Lack of information to reproduce or determine if it is a bug or not label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more information Lack of information to reproduce or determine if it is a bug or not
Projects
None yet
Development

No branches or pull requests

2 participants