Skip to content

CupertinoSheetRoute blocks nested scrolling #161623

@MitchellGoodwin

Description

@MitchellGoodwin

Right now when a vertical scrolling list in in the body of the sheet view, the vertical gesture is blocked by the CupertinoSheetRoute. Priority should be given to the nested scroll rather than the sheet.

Code sample

Code sample
import 'package:flutter/cupertino.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return const CupertinoApp(
      title: 'Cupertino Sheet',
      home: HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      // navigationBar: const CupertinoNavigationBar(
      //   middle: Text('Sheet Example'),
      //   automaticBackgroundVisibility: false,
      // ),
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            CupertinoButton.filled(
              onPressed: () {
                showCupertinoSheet<void>(
                  context: context,
                  pageBuilder: (BuildContext context) => const SheetScaffold(),
                );
              },
              child: const Text('Open Bottom Sheet'),
            ),
          ],
        ),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const CupertinoPageScaffold(
        child: SheetBody(title: 'CupertinoSheetRoute'));
  }
}

class SheetBody extends StatelessWidget {
  const SheetBody({
    super.key,
    required this.title,
  });

  final String title;

  @override
  Widget build(BuildContext context) {
    return ListView(
      hitTestBehavior: HitTestBehavior.opaque,
      children: [
        Text(title),
        Container(
          color: CupertinoColors.activeBlue,
          width: double.infinity,
          height: 300,
        ),
        Container(
          color: CupertinoColors.activeGreen,
          width: double.infinity,
          height: 300,
        ),
        Container(
          color: CupertinoColors.activeOrange,
          width: double.infinity,
          height: 300,
        ),
      ],
    );
  }
}

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listf: cupertinoflutter/packages/flutter/cupertino repositoryteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions