Last active
February 5, 2026 19:55
-
-
Save loic-sharma/56a218031b9e5d757654abd5d09d6462 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
| class _MyWidget extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Column( | |
| children: [ | |
| ExpensiveWidget(focusNode: _node), | |
| StateBuilder<double>( | |
| create: (BuildContext context) => 1.0, | |
| builder: (BuildContext context, double opacity, SetStateCallback<double> setOpacity) { | |
| return GestureDetector( | |
| onTap: () => setOpacity(opacity == 1.0 ? 0.5 : 1.0), | |
| child: Opacity(opacity: opacity, child: widget.child), | |
| ); | |
| }, | |
| ), | |
| ], | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment