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

Fix to be compatible with Flutter 3.22.0 version #98

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/lib/basic_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -55,7 +55,7 @@ class _BasicExample extends State<BasicExample> {
appBar: AppBar(
title: const Text('Basic'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: DragAndDropLists(
children: _contents,
onItemReorder: _onItemReorder,
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions example/lib/drag_handle_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -84,7 +84,7 @@ class _DragHandleExample extends State<DragHandleExample> {
appBar: AppBar(
title: const Text('Drag Handle'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: DragAndDropLists(
children: _contents,
onItemReorder: _onItemReorder,
Expand Down
4 changes: 2 additions & 2 deletions example/lib/drag_into_list_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -19,7 +19,7 @@ class _DragIntoListExample extends State<DragIntoListExample> {
appBar: AppBar(
title: const Text('Drag Into List'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: Column(
children: <Widget>[
Flexible(
Expand Down
4 changes: 2 additions & 2 deletions example/lib/expansion_tile_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -36,7 +36,7 @@ class _ListTileExample extends State<ExpansionTileExample> {
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,
Expand Down
4 changes: 2 additions & 2 deletions example/lib/fixed_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -59,7 +59,7 @@ class _FixedExample extends State<FixedExample> {
appBar: AppBar(
title: const Text('Fixed Items'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: DragAndDropLists(
children: _contents,
onItemReorder: _onItemReorder,
Expand Down
8 changes: 4 additions & 4 deletions example/lib/horizontal_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -36,7 +36,7 @@ class _HorizontalExample extends State<HorizontalExample> {
appBar: AppBar(
title: const Text('Horizontal'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: DragAndDropLists(
children: List.generate(_lists.length, (index) => _buildList(index)),
onItemReorder: _onItemReorder,
Expand Down Expand Up @@ -75,7 +75,7 @@ class _HorizontalExample extends State<HorizontalExample> {
padding: const EdgeInsets.all(10),
child: Text(
'Header ${innerList.name}',
style: Theme.of(context).primaryTextTheme.headline6,
style: Theme.of(context).primaryTextTheme.titleLarge,
),
),
),
Expand All @@ -93,7 +93,7 @@ class _HorizontalExample extends State<HorizontalExample> {
padding: const EdgeInsets.all(10),
child: Text(
'Footer ${innerList.name}',
style: Theme.of(context).primaryTextTheme.headline6,
style: Theme.of(context).primaryTextTheme.titleLarge,
),
),
),
Expand Down
6 changes: 3 additions & 3 deletions example/lib/list_tile_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -76,7 +76,7 @@ class _ListTileExample extends State<ListTileExample> {
appBar: AppBar(
title: const Text('List Tiles'),
),
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: DragAndDropLists(
children: _contents,
onItemReorder: _onItemReorder,
Expand Down Expand Up @@ -106,7 +106,7 @@ class _ListTileExample extends State<ListTileExample> {
Text(
'Empty List',
style: TextStyle(
color: Theme.of(context).textTheme.caption!.color,
color: Theme.of(context).textTheme.bodySmall!.color,
fontStyle: FontStyle.italic),
),
const Expanded(
Expand Down
6 changes: 3 additions & 3 deletions example/lib/sliver_example.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -61,7 +61,7 @@ class _SliverExample extends State<SliverExample> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: const NavigationDrawer(),
drawer: const CustomNavigationDrawer(),
body: CustomScrollView(
controller: _scrollController,
slivers: <Widget>[
Expand All @@ -73,7 +73,7 @@ class _SliverExample extends State<SliverExample> {
alignment: Alignment.bottomCenter,
child: Text(
'Slivers',
style: Theme.of(context).primaryTextTheme.headline1,
style: Theme.of(context).primaryTextTheme.displayLarge,
),
),
),
Expand Down
12 changes: 6 additions & 6 deletions lib/drag_and_drop_item_target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,29 @@ class _DragAndDropItemTarget extends State<DragAndDropItemTarget>
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;
});
}
Expand Down
12 changes: 6 additions & 6 deletions lib/drag_and_drop_item_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,30 +213,30 @@ class _DragAndDropItemWrapper extends State<DragAndDropItemWrapper>
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;
});
}
Expand Down
6 changes: 3 additions & 3 deletions lib/drag_and_drop_list_expansion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {},
),
)
]);
Expand Down
12 changes: 6 additions & 6 deletions lib/drag_and_drop_list_target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,30 @@ class _DragAndDropListTarget extends State<DragAndDropListTarget>
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;
});
}
Expand Down
12 changes: 6 additions & 6 deletions lib/drag_and_drop_list_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ class _DragAndDropListWrapper extends State<DragAndDropListWrapper>
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(() {
Expand All @@ -187,11 +187,11 @@ class _DragAndDropListWrapper extends State<DragAndDropListWrapper>
}
}
},
onAccept: (incoming) {
onAcceptWithDetails: (details) {
if (mounted) {
setState(() {
widget.parameters.onListReordered!(
incoming, widget.dragAndDropList);
details.data, widget.dragAndDropList);
_hoveredDraggable = null;
});
}
Expand Down
6 changes: 3 additions & 3 deletions lib/programmatic_expansion_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ProgrammaticExpansionTileState extends State<ProgrammaticExpansionTile>
_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;

Expand Down Expand Up @@ -176,7 +176,7 @@ class ProgrammaticExpansionTileState extends State<ProgrammaticExpansionTile>
});
}
PageStorage.of(context)
?.writeState(context, _isExpanded, identifier: widget.listKey);
.writeState(context, _isExpanded, identifier: widget.listKey);
});
if (widget.onExpansionChanged != null) {
widget.onExpansionChanged!(_isExpanded);
Expand Down Expand Up @@ -233,7 +233,7 @@ class ProgrammaticExpansionTileState extends State<ProgrammaticExpansionTile>
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
Expand Down
Loading