From 04715d15ec1a679cf0bc4fcfada75155c9443388 Mon Sep 17 00:00:00 2001 From: Dmitry Komarov Date: Wed, 15 May 2024 16:38:04 +0300 Subject: [PATCH] fix to compatible with Flutter 3.22.0 version --- example/lib/basic_example.dart | 4 ++-- ...ion_drawer.dart => custom_navigation_drawer.dart} | 4 ++-- example/lib/drag_handle_example.dart | 4 ++-- example/lib/drag_into_list_example.dart | 4 ++-- example/lib/expansion_tile_example.dart | 4 ++-- example/lib/fixed_example.dart | 4 ++-- example/lib/horizontal_example.dart | 8 ++++---- example/lib/list_tile_example.dart | 6 +++--- example/lib/sliver_example.dart | 6 +++--- lib/drag_and_drop_item_target.dart | 12 ++++++------ lib/drag_and_drop_item_wrapper.dart | 12 ++++++------ lib/drag_and_drop_list_expansion.dart | 6 +++--- lib/drag_and_drop_list_target.dart | 12 ++++++------ lib/drag_and_drop_list_wrapper.dart | 12 ++++++------ lib/programmatic_expansion_tile.dart | 6 +++--- 15 files changed, 52 insertions(+), 52 deletions(-) rename example/lib/{navigation_drawer.dart => custom_navigation_drawer.dart} (95%) diff --git a/example/lib/basic_example.dart b/example/lib/basic_example.dart index ed48ed2..b98b50c 100644 --- a/example/lib/basic_example.dart +++ b/example/lib/basic_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class BasicExample extends StatefulWidget { @@ -55,7 +55,7 @@ class _BasicExample extends State { appBar: AppBar( title: const Text('Basic'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/example/lib/navigation_drawer.dart b/example/lib/custom_navigation_drawer.dart similarity index 95% rename from example/lib/navigation_drawer.dart rename to example/lib/custom_navigation_drawer.dart index 135a7f3..61e55d7 100644 --- a/example/lib/navigation_drawer.dart +++ b/example/lib/custom_navigation_drawer.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -class NavigationDrawer extends StatelessWidget { - const NavigationDrawer({Key? key}) : super(key: key); +class CustomNavigationDrawer extends StatelessWidget { + const CustomNavigationDrawer({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/example/lib/drag_handle_example.dart b/example/lib/drag_handle_example.dart index f666bcc..84442bb 100644 --- a/example/lib/drag_handle_example.dart +++ b/example/lib/drag_handle_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class DragHandleExample extends StatefulWidget { @@ -84,7 +84,7 @@ class _DragHandleExample extends State { appBar: AppBar( title: const Text('Drag Handle'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/example/lib/drag_into_list_example.dart b/example/lib/drag_into_list_example.dart index aec1e19..026c217 100644 --- a/example/lib/drag_into_list_example.dart +++ b/example/lib/drag_into_list_example.dart @@ -1,6 +1,6 @@ import 'package:drag_and_drop_lists/drag_and_drop_list_interface.dart'; import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class DragIntoListExample extends StatefulWidget { @@ -19,7 +19,7 @@ class _DragIntoListExample extends State { appBar: AppBar( title: const Text('Drag Into List'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: Column( children: [ Flexible( diff --git a/example/lib/expansion_tile_example.dart b/example/lib/expansion_tile_example.dart index 4590904..d170643 100644 --- a/example/lib/expansion_tile_example.dart +++ b/example/lib/expansion_tile_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class ExpansionTileExample extends StatefulWidget { @@ -36,7 +36,7 @@ class _ListTileExample extends State { appBar: AppBar( title: const Text('Expansion Tiles'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: List.generate(_lists.length, (index) => _buildList(index)), onItemReorder: _onItemReorder, diff --git a/example/lib/fixed_example.dart b/example/lib/fixed_example.dart index f9b6a91..7b23085 100644 --- a/example/lib/fixed_example.dart +++ b/example/lib/fixed_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class FixedExample extends StatefulWidget { @@ -59,7 +59,7 @@ class _FixedExample extends State { appBar: AppBar( title: const Text('Fixed Items'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, diff --git a/example/lib/horizontal_example.dart b/example/lib/horizontal_example.dart index 362802b..594b9c4 100644 --- a/example/lib/horizontal_example.dart +++ b/example/lib/horizontal_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class HorizontalExample extends StatefulWidget { @@ -36,7 +36,7 @@ class _HorizontalExample extends State { appBar: AppBar( title: const Text('Horizontal'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: List.generate(_lists.length, (index) => _buildList(index)), onItemReorder: _onItemReorder, @@ -75,7 +75,7 @@ class _HorizontalExample extends State { padding: const EdgeInsets.all(10), child: Text( 'Header ${innerList.name}', - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).primaryTextTheme.titleLarge, ), ), ), @@ -93,7 +93,7 @@ class _HorizontalExample extends State { padding: const EdgeInsets.all(10), child: Text( 'Footer ${innerList.name}', - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).primaryTextTheme.titleLarge, ), ), ), diff --git a/example/lib/list_tile_example.dart b/example/lib/list_tile_example.dart index 1a793e9..0b10478 100644 --- a/example/lib/list_tile_example.dart +++ b/example/lib/list_tile_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class ListTileExample extends StatefulWidget { @@ -76,7 +76,7 @@ class _ListTileExample extends State { appBar: AppBar( title: const Text('List Tiles'), ), - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: DragAndDropLists( children: _contents, onItemReorder: _onItemReorder, @@ -106,7 +106,7 @@ class _ListTileExample extends State { Text( 'Empty List', style: TextStyle( - color: Theme.of(context).textTheme.caption!.color, + color: Theme.of(context).textTheme.bodySmall!.color, fontStyle: FontStyle.italic), ), const Expanded( diff --git a/example/lib/sliver_example.dart b/example/lib/sliver_example.dart index 47e9d2a..ab2fb89 100644 --- a/example/lib/sliver_example.dart +++ b/example/lib/sliver_example.dart @@ -1,5 +1,5 @@ import 'package:drag_and_drop_lists/drag_and_drop_lists.dart'; -import 'package:example/navigation_drawer.dart'; +import 'package:example/custom_navigation_drawer.dart'; import 'package:flutter/material.dart'; class SliverExample extends StatefulWidget { @@ -61,7 +61,7 @@ class _SliverExample extends State { @override Widget build(BuildContext context) { return Scaffold( - drawer: const NavigationDrawer(), + drawer: const CustomNavigationDrawer(), body: CustomScrollView( controller: _scrollController, slivers: [ @@ -73,7 +73,7 @@ class _SliverExample extends State { alignment: Alignment.bottomCenter, child: Text( 'Slivers', - style: Theme.of(context).primaryTextTheme.headline1, + style: Theme.of(context).primaryTextTheme.displayLarge, ), ), ), diff --git a/lib/drag_and_drop_item_target.dart b/lib/drag_and_drop_item_target.dart index bdcbe02..96bf643 100644 --- a/lib/drag_and_drop_item_target.dart +++ b/lib/drag_and_drop_item_target.dart @@ -53,29 +53,29 @@ class _DragAndDropItemTarget extends State if (candidateData.isNotEmpty) {} return Container(); }, - onWillAccept: (incoming) { + onWillAcceptWithDetails: (details) { bool accept = true; if (widget.parameters.itemTargetOnWillAccept != null) accept = - widget.parameters.itemTargetOnWillAccept!(incoming, widget); + widget.parameters.itemTargetOnWillAccept!(details.data, widget); if (accept && mounted) { setState(() { - _hoveredDraggable = incoming; + _hoveredDraggable = details.data; }); } return accept; }, - onLeave: (incoming) { + onLeave: (data) { if (mounted) { setState(() { _hoveredDraggable = null; }); } }, - onAccept: (incoming) { + onAcceptWithDetails: (details) { if (mounted) { setState(() { - widget.onReorderOrAdd(incoming, widget.parent!, widget); + widget.onReorderOrAdd(details.data, widget.parent!, widget); _hoveredDraggable = null; }); } diff --git a/lib/drag_and_drop_item_wrapper.dart b/lib/drag_and_drop_item_wrapper.dart index 022ce21..06a80a7 100644 --- a/lib/drag_and_drop_item_wrapper.dart +++ b/lib/drag_and_drop_item_wrapper.dart @@ -213,30 +213,30 @@ class _DragAndDropItemWrapper extends State if (candidateData.isNotEmpty) {} return Container(); }, - onWillAccept: (incoming) { + onWillAcceptWithDetails: (details) { bool accept = true; if (widget.parameters!.itemOnWillAccept != null) accept = widget.parameters!.itemOnWillAccept!( - incoming, widget.child); + details.data, widget.child); if (accept && mounted) { setState(() { - _hoveredDraggable = incoming; + _hoveredDraggable = details.data; }); } return accept; }, - onLeave: (incoming) { + onLeave: (data) { if (mounted) { setState(() { _hoveredDraggable = null; }); } }, - onAccept: (incoming) { + onAcceptWithDetails: (details) { if (mounted) { setState(() { if (widget.parameters!.onItemReordered != null) - widget.parameters!.onItemReordered!(incoming, widget.child); + widget.parameters!.onItemReordered!(details.data, widget.child); _hoveredDraggable = null; }); } diff --git a/lib/drag_and_drop_list_expansion.dart b/lib/drag_and_drop_list_expansion.dart index 085c51d..6965a1b 100644 --- a/lib/drag_and_drop_list_expansion.dart +++ b/lib/drag_and_drop_list_expansion.dart @@ -104,14 +104,14 @@ class DragAndDropListExpansion implements DragAndDropListExpansionInterface { if (candidateData.isNotEmpty) {} return Container(); }, - onWillAccept: (incoming) { + onWillAcceptWithDetails: (details) { _startExpansionTimer(); return false; }, - onLeave: (incoming) { + onLeave: (data) { _stopExpansionTimer(); }, - onAccept: (incoming) {}, + onAcceptWithDetails: (details) {}, ), ) ]); diff --git a/lib/drag_and_drop_list_target.dart b/lib/drag_and_drop_list_target.dart index 175d0bc..7a53744 100644 --- a/lib/drag_and_drop_list_target.dart +++ b/lib/drag_and_drop_list_target.dart @@ -80,30 +80,30 @@ class _DragAndDropListTarget extends State if (candidateData.isNotEmpty) {} return Container(); }, - onWillAccept: (incoming) { + onWillAcceptWithDetails: (details) { bool accept = true; if (widget.parameters.listTargetOnWillAccept != null) { accept = - widget.parameters.listTargetOnWillAccept!(incoming, widget); + widget.parameters.listTargetOnWillAccept!(details.data, widget); } if (accept && mounted) { setState(() { - _hoveredDraggable = incoming; + _hoveredDraggable = details.data; }); } return accept; }, - onLeave: (incoming) { + onLeave: (data) { if (mounted) { setState(() { _hoveredDraggable = null; }); } }, - onAccept: (incoming) { + onAcceptWithDetails: (details) { if (mounted) { setState(() { - widget.onDropOnLastTarget(incoming, widget); + widget.onDropOnLastTarget(details.data, widget); _hoveredDraggable = null; }); } diff --git a/lib/drag_and_drop_list_wrapper.dart b/lib/drag_and_drop_list_wrapper.dart index f19ab41..fb1928c 100644 --- a/lib/drag_and_drop_list_wrapper.dart +++ b/lib/drag_and_drop_list_wrapper.dart @@ -165,20 +165,20 @@ class _DragAndDropListWrapper extends State if (candidateData.isNotEmpty) {} return Container(); }, - onWillAccept: (incoming) { + onWillAcceptWithDetails: (details) { bool accept = true; if (widget.parameters.listOnWillAccept != null) { accept = widget.parameters.listOnWillAccept!( - incoming, widget.dragAndDropList); + details.data, widget.dragAndDropList); } if (accept && mounted) { setState(() { - _hoveredDraggable = incoming; + _hoveredDraggable = details.data; }); } return accept; }, - onLeave: (incoming) { + onLeave: (data) { if (_hoveredDraggable != null) { if (mounted) { setState(() { @@ -187,11 +187,11 @@ class _DragAndDropListWrapper extends State } } }, - onAccept: (incoming) { + onAcceptWithDetails: (details) { if (mounted) { setState(() { widget.parameters.onListReordered!( - incoming, widget.dragAndDropList); + details.data, widget.dragAndDropList); _hoveredDraggable = null; }); } diff --git a/lib/programmatic_expansion_tile.dart b/lib/programmatic_expansion_tile.dart index a38bb23..cb30361 100644 --- a/lib/programmatic_expansion_tile.dart +++ b/lib/programmatic_expansion_tile.dart @@ -129,7 +129,7 @@ class ProgrammaticExpansionTileState extends State _controller.drive(_backgroundColorTween.chain(_easeOutTween)); _isExpanded = PageStorage.of(context) - ?.readState(context, identifier: widget.listKey) as bool? ?? + .readState(context, identifier: widget.listKey) as bool? ?? widget.initiallyExpanded; if (_isExpanded) _controller.value = 1.0; @@ -176,7 +176,7 @@ class ProgrammaticExpansionTileState extends State }); } PageStorage.of(context) - ?.writeState(context, _isExpanded, identifier: widget.listKey); + .writeState(context, _isExpanded, identifier: widget.listKey); }); if (widget.onExpansionChanged != null) { widget.onExpansionChanged!(_isExpanded); @@ -233,7 +233,7 @@ class ProgrammaticExpansionTileState extends State final ThemeData theme = Theme.of(context); _borderColorTween.end = theme.dividerColor; _headerColorTween - ..begin = theme.textTheme.subtitle1!.color + ..begin = theme.textTheme.titleMedium!.color ..end = theme.colorScheme.secondary; _iconColorTween ..begin = theme.unselectedWidgetColor