Last active
August 5, 2021 18:25
Revisions
-
esDotDev revised this gist
Jun 15, 2021 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,9 @@ class MyFoo extends StatefulWidget { @override MyFooState createState() => MyFooState(); static MyFooState of(BuildContext context) => (context.dependOnInheritedWidgetOfExactType<_MyInheritedFoo>() as _MyInheritedFoo).state; } class MyFooState extends State<MyFoo> { -
esDotDev revised this gist
Apr 12, 2021 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,17 @@ class MyFoo extends StatefulWidget { const MyFoo({Key? key, required this.child}) : super(key: key); final Widget child; @override MyFooState createState() => MyFooState(); } class MyFooState extends State<MyFoo> { @override Widget build(BuildContext context) { return _MyInheritedFoo(child: widget.child, state: this); } } class _MyInheritedFoo extends InheritedWidget { -
esDotDev created this gist
Apr 12, 2021 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ class MyFoo extends StatefulWidget { @override MyFooState createState() => MyFooState(); static MyFooState of(BuildContext context) => (context.dependOnInheritedWidgetOfExactType<_MyInheritedFoo>() as _MyInheritedFoo).state; } class MyFooState extends State<MyFoo> { @override Widget build(BuildContext context) => Container(); } class _MyInheritedFoo extends InheritedWidget { _MyInheritedFoo({Key? key, required Widget child, required this.state}) : super(key: key, child: child); final MyFooState state; @override bool updateShouldNotify(covariant InheritedWidget oldWidget) => true; }