-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Reported by an internal developer in (Google internal link) b/285980589.
Tap FAB to open sheet. Open it towards the top. Tap a list item to programatically close. Actual: scrim is still shown.
One online answer suggested just calling Scaffold.of(context).showBodyScrim(false, 0.0); directly after popping or closing the sheet. Seems like that should be done automatically in this case, though.
Test case
Details
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
PersistentBottomSheetController? _bottomSheetController;
class MyApp extends StatelessWidget {
void _showSheet(BuildContext context) {
_bottomSheetController = Scaffold.of(context).showBottomSheet<void>(
(_) {
return DraggableScrollableSheet(
expand: false,
controller: DraggableScrollableController(),
builder: (_, scrollController) =>
_buildSheetContent(scrollController));
},
enableDrag: false,
);
}
Widget _buildSheetContent(ScrollController scrollController) =>
ListView.builder(
controller: scrollController,
itemCount: 25,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text('Item $index - tap to close'),
onTap: () => _bottomSheetController?.close()
// Same result: Navigator.of(context).pop()
);
},
);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: Colors.lightBlue,
),
home: Scaffold(
floatingActionButton: Builder(
builder: (context) =>
FloatingActionButton(onPressed: () => _showSheet(context))),
body: Center(
child: ElevatedButton(child: Text('foo'), onPressed: () {}),
),
),
);
}
}Metadata
Metadata
Assignees
Labels
f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Type
Projects
Status
Done (PR merged)