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:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user