Created
March 26, 2018 23:24
-
-
Save pulyaevskiy/e266e70cbf71c31aaa6a14ecd7cf0a2a to your computer and use it in GitHub Desktop.
Scale bug
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 _MyHomePageState extends State<MyHomePage> { | |
int _counter = 0; | |
bool _hide = false; | |
FocusNode _focusNode; | |
@override | |
void initState() { | |
super.initState(); | |
_focusNode = new FocusNode(); | |
_focusNode.addListener(_handleFocusChange); | |
} | |
void _handleFocusChange() { | |
setState(() { | |
_hide = true; | |
}); | |
} | |
void _incrementCounter() { | |
setState(() { | |
_counter++; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
resizeToAvoidBottomPadding: false, | |
appBar: new AppBar(title: new Text(widget.title)), | |
body: new Center( | |
child: new Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
new TextField(focusNode: _focusNode), | |
new Text( | |
'$_counter', | |
style: Theme.of(context).textTheme.display1, | |
), | |
], | |
), | |
), | |
floatingActionButton: _hide | |
? null | |
: new FloatingActionButton( | |
onPressed: _incrementCounter, | |
tooltip: 'Increment', | |
child: new Icon(Icons.add), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment