FloatColumn constructor

FloatColumn({
  1. Key? key,
  2. CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
  3. TextDirection? textDirection,
  4. Clip clipBehavior = Clip.none,
  5. SelectionRegistrar? selectionRegistrar,
  6. Color? selectionColor,
  7. List<Object> children = const <Object>[],
})

Creates a FloatColumn — a vertical column of widgets and text with the ability to "float" child widgets to the left or right, allowing the text to wrap around them — similar to the functionality of the CSS float property.

The children argument can contain TextSpan, Text, RichText, WrappableText, and Widget children.

For child widgets that should "float", wrap them in a Floatable widget, indicating, via the float parameter, which side they should float on.

The textDirection argument defaults to the ambient Directionality, if any. If there is no ambient directionality, textDirection must not be null.

Implementation

FloatColumn({
  super.key,
  this.crossAxisAlignment = CrossAxisAlignment.start,
  this.textDirection,
  this.clipBehavior = Clip.none,
  this.selectionRegistrar,
  this.selectionColor,
  List<Object> children = const <Object>[],
})  :
      // ignore: unnecessary_null_comparison
      assert(crossAxisAlignment != CrossAxisAlignment.baseline),
      // ignore: unnecessary_null_comparison
      assert(clipBehavior != null),
      // ignore: unnecessary_null_comparison
      assert(children != null),
      super(children: _extractWidgets(children)) {
  _textAndWidgets = children.map((e) {
    if (e is WrappableText) return e;
    if (e is TextSpan) return WrappableText(text: e);
    if (e is Text) return WrappableText.fromText(e);
    if (e is RichText) return WrappableText.fromRichText(e);
    if (e is Widget) return e;
    throw ArgumentError(_errorMsgWithUnsupportedObject(e));
  }).toList();
}