Created
March 21, 2021 04:54
-
-
Save devjaime/abb1ca77256882b3616fd3e88753c705 to your computer and use it in GitHub Desktop.
Supongamos que tenemos una clase de widget personalizada que debería llamar a una onDragCompleteddevolución de llamada cuando se produce un evento determinado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CustomDraggable extends StatelessWidget { | |
| const CustomDraggable({Key key, this.onDragCompleted}) : super(key: key); | |
| final VoidCallback? onDragCompleted; | |
| void _dragComplete() { | |
| // TODO: Implement me | |
| } | |
| @override | |
| Widget build(BuildContext context) {/*...*/} | |
| } | |
| Para invocar la devolución de llamada, podríamos escribir este código: | |
| void _dragComplete() { | |
| if (onDragCompleted != null) { | |
| onDragCompleted(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment