Commit 37daf034 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Make the InputContainer underline's visibility configurable (#6976)

parent 4828b2c3
...@@ -177,6 +177,7 @@ class InputContainer extends StatefulWidget { ...@@ -177,6 +177,7 @@ class InputContainer extends StatefulWidget {
this.errorText, this.errorText,
this.style, this.style,
this.isDense: false, this.isDense: false,
this.hideDivider: false,
this.child, this.child,
}) : super(key: key); }) : super(key: key);
...@@ -213,6 +214,9 @@ class InputContainer extends StatefulWidget { ...@@ -213,6 +214,9 @@ class InputContainer extends StatefulWidget {
/// to the child. /// to the child.
final bool isEmpty; final bool isEmpty;
/// Hide the divider that appears below the child and above the error text.
final bool hideDivider;
final Widget child; final Widget child;
@override @override
...@@ -304,16 +308,26 @@ class _InputContainerState extends State<InputContainer> { ...@@ -304,16 +308,26 @@ class _InputContainerState extends State<InputContainer> {
); );
EdgeInsets margin = new EdgeInsets.only(bottom: bottomHeight - (bottomPadding + bottomBorder)); EdgeInsets margin = new EdgeInsets.only(bottom: bottomHeight - (bottomPadding + bottomBorder));
stackChildren.add(new AnimatedContainer( Widget divider;
margin: margin, if (config.hideDivider) {
padding: padding, divider = new Container(
duration: _kTransitionDuration, margin: margin + new EdgeInsets.only(bottom: bottomBorder),
curve: _kTransitionCurve, padding: padding,
decoration: new BoxDecoration( child: config.child,
border: border, );
), } else {
child: config.child, divider = new AnimatedContainer(
)); margin: margin,
padding: padding,
duration: _kTransitionDuration,
curve: _kTransitionCurve,
decoration: new BoxDecoration(
border: border,
),
child: config.child,
);
}
stackChildren.add(divider);
if (errorText != null && !config.isDense) { if (errorText != null && !config.isDense) {
TextStyle errorStyle = themeData.textTheme.caption.copyWith(color: themeData.errorColor); TextStyle errorStyle = themeData.textTheme.caption.copyWith(color: themeData.errorColor);
...@@ -385,6 +399,7 @@ class Input extends StatefulWidget { ...@@ -385,6 +399,7 @@ class Input extends StatefulWidget {
this.errorText, this.errorText,
this.style, this.style,
this.hideText: false, this.hideText: false,
this.hideDivider: false,
this.isDense: false, this.isDense: false,
this.autofocus: false, this.autofocus: false,
this.maxLines: 1, this.maxLines: 1,
...@@ -426,6 +441,9 @@ class Input extends StatefulWidget { ...@@ -426,6 +441,9 @@ class Input extends StatefulWidget {
/// U+2022 BULLET characters (•). /// U+2022 BULLET characters (•).
final bool hideText; final bool hideText;
/// Hide the divider that appears below the child and above the error text.
final bool hideDivider;
/// Whether the input field is part of a dense form (i.e., uses less vertical space). /// Whether the input field is part of a dense form (i.e., uses less vertical space).
final bool isDense; final bool isDense;
...@@ -478,6 +496,7 @@ class _InputState extends State<Input> { ...@@ -478,6 +496,7 @@ class _InputState extends State<Input> {
errorText: config.errorText, errorText: config.errorText,
style: config.style, style: config.style,
isDense: config.isDense, isDense: config.isDense,
hideDivider: config.hideDivider,
child: new InputField( child: new InputField(
key: _inputFieldKey, key: _inputFieldKey,
focusKey: focusKey, focusKey: focusKey,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment