Created
July 1, 2020 02:59
-
-
Save blaugold/9029523bde797c0f8042f7bbfd72708f to your computer and use it in GitHub Desktop.
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
void withBuilder() { | |
return Builder( | |
builder: (context) { | |
return RaisedButton( | |
child: Text('Button'), | |
onPressed: () { | |
final renderObject = context.findRenderObject(); | |
} | |
); | |
} | |
); | |
} | |
final globalKey = GlobalKey(); | |
void withGlobalKey() { | |
return RaisedButton( | |
key: globalKey, | |
child: Text('Button'), | |
onPressed: () { | |
final renderObject = globalKey.currentContext.findRenderObject(); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment