Created
June 25, 2022 15:44
-
-
Save daiki1003/e3bd8afdbaccff132da7ea0c065646f4 to your computer and use it in GitHub Desktop.
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 characters
class SomeBigWidgetState extends State<SomeBigWidget> { | |
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
children: [ | |
_buildSomeWidget1(), | |
_buildSomeWidget2(), | |
_buildSomeWidget3(), | |
_buildLikeButton(), | |
], | |
); | |
} | |
Widget _buildLikeButton() { | |
return Positioned( | |
right: 10, | |
bottom: 10, | |
child: IconButton( | |
icon: Icon(Icons.favorite), | |
onPressed: () { | |
// setStateが呼ばれると | |
// SomeBigWidgetState全体がリビルドされる! | |
setState(() { | |
...; | |
}; | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment