Skip to content

Instantly share code, notes, and snippets.

@sh0seo
Created October 22, 2020 16:56
Show Gist options
  • Save sh0seo/a9859201c463a63c86cab0a2b82a0e03 to your computer and use it in GitHub Desktop.
Save sh0seo/a9859201c463a63c86cab0a2b82a0e03 to your computer and use it in GitHub Desktop.
class _MyHomePageState extends State<MyHomePage> {
bool _visibility = true;
void _show() {
setState(() {
_visibility = true;
});
}
void _hide() {
setState(() {
_visibility = false;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('widget.title'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('이 글자를 안보이게 하고 싶습니다.',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => {_visibility? _hide() : _show()},
tooltip: 'show/hide',
child: Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment