I wanted to ask, because I get a lot of errors, if it is possible to place a Divider() widget like this:
AppBar(
bottom: Divider()
)
And if yes, could anyone show me how it's possible to do that
I wanted to ask, because I get a lot of errors, if it is possible to place a Divider() widget like this:
AppBar(
bottom: Divider()
)
And if yes, could anyone show me how it's possible to do that
try this...
bottom: PreferredSize(
child: Container(
color: Colors.orange,
height: 4.0,
),
preferredSize: Size.fromHeight(4.0)),
If you read the bottom documentation, it must implement PreferredSizeWidget and Divider does not implement it.
But you can create your own version and use it there.
class MyDivider extends Divider implements PreferredSizeWidget {
MyDivider({
Key key,
height = 16.0,
indent = 0.0,
color,
}) : assert(height >= 0.0),
super(
key: key,
height: height,
indent: indent,
color: color,
) {
preferredSize = Size(double.infinity, height);
}
@override
Size preferredSize;
}