Deprecates onWillAccept and onAccept callbacks in DragTarget. (#133691)

This PR deprecates `onWillAccept` and `onAccept` over `onWillAcceptWithDetails` and `onAcceptWithDetails`.

Fixes: #133347
This commit is contained in:
Chinmoy
2023-11-11 04:17:22 +05:30
committed by GitHub
parent d71fe92ec4
commit 0bde95dc06
10 changed files with 174 additions and 6 deletions

View File

@@ -16,16 +16,16 @@ class ExampleDragTarget extends StatefulWidget {
class ExampleDragTargetState extends State<ExampleDragTarget> {
Color _color = Colors.grey;
void _handleAccept(Color data) {
void _handleAccept(DragTargetDetails<Color> details) {
setState(() {
_color = data;
_color = details.data;
});
}
@override
Widget build(BuildContext context) {
return DragTarget<Color>(
onAccept: _handleAccept,
onAcceptWithDetails: _handleAccept,
builder: (BuildContext context, List<Color?> data, List<dynamic> rejectedData) {
return Container(
height: 100.0,
@@ -217,7 +217,7 @@ class MovableBall extends StatelessWidget {
);
} else {
return DragTarget<bool>(
onAccept: (bool data) { callback(position); },
onAcceptWithDetails: (DragTargetDetails<bool> data) { callback(position); },
builder: (BuildContext context, List<bool?> accepted, List<dynamic> rejected) {
return dashedBall;
},