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

Home and FAQ Scrollable sheet doesn't work on web #304

Open
JElgar opened this issue Aug 7, 2024 · 0 comments
Open

Home and FAQ Scrollable sheet doesn't work on web #304

JElgar opened this issue Aug 7, 2024 · 0 comments

Comments

@JElgar
Copy link
Member

JElgar commented Aug 7, 2024

There is an issue in flutter where the dragable scrollable sheet doesn't work on web. In an ideal world if someone scrolled within the sheet it would expand the draggable sheet as well.

Ive tested out the proposed custom scroll behavior (see below) but that only fixes dragging (dragging on the sheet exapnds) whilst scrolling in the list view still does not expand the sheet.

flutter/flutter#101903 (comment)

Fixes dragging but doesn't have desired scroll behavior

import 'package:auto_route/auto_route.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class MyCustomScrollBehavior extends MaterialScrollBehavior {
  // Override behavior methods and getters like dragDevices
  @override
  Set<PointerDeviceKind> get dragDevices => { 
    PointerDeviceKind.touch,
    PointerDeviceKind.mouse,
    // etc.
  };
}

@RoutePage()
class TestingView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Container(height: MediaQuery.sizeOf(context).height, color: Colors.red),
          ScrollConfiguration(
            behavior: MyCustomScrollBehavior(),
            child: DraggableScrollableSheet(
              maxChildSize: 0.8,
              initialChildSize: 0.4,
              minChildSize: 0.2,
              builder: (context, scrollController) {
                return SingleChildScrollView(
                  controller: scrollController,
                  child: Container(
                    height: 10000,
                    color: Colors.green,
                    child: Column(
                      children: [
                        Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: Container(
                            color: Colors.blue,
                            height: 200,
                          ),
                        ),
                        Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: Container(
                            color: Colors.blue,
                            height: 200,
                          ),
                        ),
                        Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: Container(
                            color: Colors.blue,
                            height: 200,
                          ),
                        ),
                      ],
                    ),
                  ),
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant