mirror of
https://github.com/flutter/flutter.git
synced 2026-02-15 23:33:36 +08:00
Stop fields moving when focus changes (#6316)
Previously, if you focused a field, fields below it would shift down by one pixel. This change tries to guarantee that that won't happen.
This commit is contained in:
parent
3b56f12219
commit
e8168401e5
@ -177,32 +177,34 @@ class _InputState extends State<Input> {
|
||||
));
|
||||
}
|
||||
|
||||
EdgeInsets margin = new EdgeInsets.only(bottom: config.isDense ? 4.0 : 8.0);
|
||||
EdgeInsets padding = new EdgeInsets.only(top: topPadding, bottom: 8.0);
|
||||
Color borderColor = activeColor;
|
||||
double borderWidth = focused ? 2.0 : 1.0;
|
||||
double bottomPadding = 8.0;
|
||||
double bottomBorder = focused ? 2.0 : 1.0;
|
||||
double bottomHeight = config.isDense ? 14.0 : 18.0;
|
||||
|
||||
if (errorText != null) {
|
||||
borderColor = themeData.errorColor;
|
||||
borderWidth = 2.0;
|
||||
if (!config.isDense) {
|
||||
margin = const EdgeInsets.only(bottom: 15.0);
|
||||
padding = new EdgeInsets.only(top: topPadding, bottom: 1.0);
|
||||
}
|
||||
bottomBorder = 2.0;
|
||||
if (!config.isDense)
|
||||
bottomPadding = 1.0;
|
||||
}
|
||||
|
||||
EdgeInsets padding = new EdgeInsets.only(top: topPadding, bottom: bottomPadding);
|
||||
Border border = new Border(
|
||||
bottom: new BorderSide(
|
||||
color: borderColor,
|
||||
width: bottomBorder,
|
||||
)
|
||||
);
|
||||
EdgeInsets margin = new EdgeInsets.only(bottom: bottomHeight - (bottomPadding + bottomBorder));
|
||||
|
||||
stackChildren.add(new AnimatedContainer(
|
||||
margin: margin,
|
||||
padding: padding,
|
||||
duration: _kTransitionDuration,
|
||||
curve: _kTransitionCurve,
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(
|
||||
bottom: new BorderSide(
|
||||
color: borderColor,
|
||||
width: borderWidth
|
||||
)
|
||||
)
|
||||
border: border,
|
||||
),
|
||||
child: new RawInputLine(
|
||||
key: _rawInputLineKey,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user