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

Can't fling customBuilder sheet closed by dragging on header header. #33

Closed
dickermoshe opened this issue Dec 11, 2023 · 2 comments
Closed

Comments

@dickermoshe
Copy link

Bug

When using a customBuilder for the sheet, you can't fling the sheet closed by dragging on the header, It snaps back up.

Video

untitlssssssssssed.webm

Sample Code

import 'package:flutter/material.dart';
import 'package:wtf_sliding_sheet/wtf_sliding_sheet.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text('Hello World!'),
          ),
          body: SlidingSheet(
            snapSpec: const SnapSpec(
              snap: true,
              snappings: [0.2, 1.0],
              positioning: SnapPositioning.relativeToAvailableSpace,
            ),
            body: Center(
              child: Text('This widget is below the SlidingSheet'),
            ),
            headerBuilder: (context, state) {
              return Container(
                height: 100,
                color: Colors.black,
                child: Center(
                  child: Text("Header"),
                ),
              );
            },
            customBuilder: (context, controller, state) {
              return SingleChildScrollView(
                controller: controller,
                child: Column(
                  children: [
                    Container(
                      height: 100,
                      color: Colors.red,
                    ),
                    Container(
                      height: 100,
                      color: Colors.blue,
                    ),
                    Container(
                      height: 100,
                      color: Colors.yellow,
                    ),
                    Container(
                      height: 100,
                      color: Colors.red,
                    ),
                    Container(
                      height: 100,
                      color: Colors.blue,
                    ),
                    Container(
                      height: 100,
                      color: Colors.yellow,
                    ),
                  ],
                ),
              );
            },
          )),
    );
  }
}
@KirillSergeevich
Copy link
Collaborator

Hello @dickermoshe!
Did you try to use any of parameters: closeOnBackdropTap, closeOnBackButtonPressed, isBackdropInteractable?

Otherwise you can wrap the SlidingSheet in the Stack or sth similar to close it from the any place.

@dickermoshe
Copy link
Author

Did you try to use any of parameters: closeOnBackdropTap, closeOnBackButtonPressed, isBackdropInteractable?

Every variation of these 3 still results in the slider snapping back open

Otherwise you can wrap the SlidingSheet in the Stack or sth similar to close it from the any place.

If anyone comes here with this issue, they should use a CustomScrollView.
Use a SliverPersistentHeader with pinned: true and put the body in a SliverList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants