Skip to content

Instantly share code, notes, and snippets.

@pulyaevskiy
Created March 26, 2018 23:24
Show Gist options
  • Save pulyaevskiy/e266e70cbf71c31aaa6a14ecd7cf0a2a to your computer and use it in GitHub Desktop.
Save pulyaevskiy/e266e70cbf71c31aaa6a14ecd7cf0a2a to your computer and use it in GitHub Desktop.
Scale bug
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