Update DraggableScrollableSheet docs to reflect API change (#136471)
### Description This PR intends to update `DraggableScrollableSheet` docs for Web and Desktop platforms. On these platforms, the vertical dragging gesture does not provide natural behavior similar to other desktop applications. By adding a note before the sample code so users are aware that the sample code will not work as expected on Desktop and Web. Also, refer to the instructions if they still want to implement it on these platforms. ### Related issue Fixes https://github.com/flutter/flutter/issues/111372
This commit is contained in:
@@ -260,7 +260,7 @@ class DraggableScrollableController extends ChangeNotifier {
|
||||
/// to position sheet based on the space it is taking, the [expand] property
|
||||
/// may be set to false.
|
||||
///
|
||||
/// {@tool snippet}
|
||||
/// {@tool dartpad}
|
||||
///
|
||||
/// This is a sample widget which shows a [ListView] that has 25 [ListTile]s.
|
||||
/// It starts out as taking up half the body of the [Scaffold], and can be
|
||||
@@ -269,36 +269,16 @@ class DraggableScrollableController extends ChangeNotifier {
|
||||
/// scrolled up or down, until they reach the top of the list again and the user
|
||||
/// drags the sheet back down.
|
||||
///
|
||||
/// ```dart
|
||||
/// class HomePage extends StatelessWidget {
|
||||
/// const HomePage({super.key});
|
||||
/// On desktop and web running on desktop platforms, dragging to scroll with a mouse is disabled by default
|
||||
/// to align with the natural behavior found in other desktop applications.
|
||||
///
|
||||
/// @override
|
||||
/// Widget build(BuildContext context) {
|
||||
/// return Scaffold(
|
||||
/// appBar: AppBar(
|
||||
/// title: const Text('DraggableScrollableSheet'),
|
||||
/// ),
|
||||
/// body: SizedBox.expand(
|
||||
/// child: DraggableScrollableSheet(
|
||||
/// builder: (BuildContext context, ScrollController scrollController) {
|
||||
/// return Container(
|
||||
/// color: Colors.blue[100],
|
||||
/// child: ListView.builder(
|
||||
/// controller: scrollController,
|
||||
/// itemCount: 25,
|
||||
/// itemBuilder: (BuildContext context, int index) {
|
||||
/// return ListTile(title: Text('Item $index'));
|
||||
/// },
|
||||
/// ),
|
||||
/// );
|
||||
/// },
|
||||
/// ),
|
||||
/// ),
|
||||
/// );
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
/// This behavior is dictated by the [ScrollBehavior], and can be changed by adding
|
||||
/// [PointerDeviceKind.mouse] to [ScrollBehavior.dragDevices].
|
||||
/// For more info on this, please refer to https://docs.flutter.dev/release/breaking-changes/default-scroll-behavior-drag
|
||||
///
|
||||
/// Alternatively, this example illustrates how to add a drag handle for desktop applications.
|
||||
///
|
||||
/// ** See code in examples/api/lib/widgets/draggable_scrollable_sheet/draggable_scrollable_sheet.0.dart **
|
||||
/// {@end-tool}
|
||||
class DraggableScrollableSheet extends StatefulWidget {
|
||||
/// Creates a widget that can be dragged and scrolled in a single gesture.
|
||||
|
||||
Reference in New Issue
Block a user