public override Widget build(BuildContext context) { DividerThemeData dividerTheme = DividerTheme.of(context); float height = this.height ?? dividerTheme?.space ?? 16.0f; float thickness = this.thickness ?? dividerTheme?.thickness ?? 0.0f; float indent = this.indent ?? dividerTheme?.indent ?? 0.0f; float endIndent = this.endIndent ?? dividerTheme?.endIndent ?? 0.0f; return(new SizedBox( height: height, child: new Center( child: new Container( height: thickness, //TODO: update to EdgeInsetsGeometry margin: EdgeInsetsDirectional.only(start: indent, end: endIndent), decoration: new BoxDecoration( border: new Border( bottom: createBorderSide(context, color: color, width: thickness)) ) ) ) )); }
public static BorderSide createBorderSide(BuildContext context, Color color = null, float?width = null) { Color effectiveColor = color ?? (context != null ? (DividerTheme.of(context)?.color ?? Theme.of(context).dividerColor) : null); float effectiveWidth = width ?? (context != null ? DividerTheme.of(context)?.thickness : null) ?? 0.0f; // Prevent assertion since it is possible that context is null and no color // is specified. if (effectiveColor == null) { return(new BorderSide( width: effectiveWidth )); } return(new BorderSide( color: effectiveColor, width: effectiveWidth )); }
public override Widget build(BuildContext context) { DividerThemeData dividerTheme = DividerTheme.of(context); float width = this.width ?? dividerTheme.space ?? 16.0f; float thickness = this.thickness ?? dividerTheme.thickness ?? 0.0f; float indent = this.indent ?? dividerTheme.indent ?? 0.0f; float endIndent = this.endIndent ?? dividerTheme.endIndent ?? 0.0f; return(new SizedBox( width: width, child: new Center( child: new Container( width: thickness, margin: EdgeInsetsDirectional.only(top: indent, bottom: endIndent), decoration: new BoxDecoration( border: new Border( left: Divider.createBorderSide(context, color: color, width: thickness) ) ) ) ) )); }
public override Widget wrap(BuildContext context, Widget child) { DividerTheme ancestorTheme = context.findAncestorWidgetOfExactType <DividerTheme>(); return(ReferenceEquals(this, ancestorTheme) ? child : new DividerTheme(data: data, child: child)); }
public static DividerThemeData of(BuildContext context) { DividerTheme dividerTheme = context.dependOnInheritedWidgetOfExactType <DividerTheme>(); return(dividerTheme?.data ?? Theme.of(context).dividerTheme); }