Divider class

A filled rule that separates sections of a layout.

The rule is a solid band of thickness cells, not a run of : a band needs no width to be known up front, so the divider stays pure composition and inherits whatever cross-axis extent its parent offers.

It spans as much of its cross axis as the parent offers, so that axis has to be bounded. A horizontal rule in a Column is bounded by the terminal width and needs nothing extra:

Column(children: [header, const Divider(), body])

A vertical rule inside a Row is a different story: a Row hands its children an unbounded height whenever its own parent leaves the height loose, and an unbounded axis has no extent to span, so the rule renders zero cells tall. Give it a height:

Row(
  children: [
    left,
    const SizedBox(height: 3, child: Divider(axis: Axis.vertical)),
    right,
  ],
)
Inheritance

Constructors

Divider({Key? key, int thickness = 1, Color? color, Axis axis = Axis.horizontal})
Configures a rule thickness cells thick, running across axis.
const

Properties

axis Axis
Direction the rule runs. A horizontal rule separates stacked rows; a vertical one separates side-by-side columns.
final
color Color?
Fill of the rule. Falls back to ThemeData.border.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how this widget replaces another of the same type.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thickness int
Cells of extent the rule occupies along its short side.
final

Methods

build(BuildContext context) Widget
Describes the part of the UI represented by this widget.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited