StacPositioned.directional constructor
StacPositioned.directional({
- required StacTextDirection textDirection,
- double? start,
- double? top,
- double? end,
- double? bottom,
- double? width,
- double? height,
- required StacWidget child,
Creates a widget that controls where a child of a Stack is positioned.
Only two of the three horizontal values (start, end, and width) may
be set; at least one must be null. Only two of the three vertical values
(top, bottom, and height) may be set; at least one must be null.
If textDirection is StacTextDirection.rtl, then start is used for
right and end for left. If textDirection is StacTextDirection.ltr,
then start is used for left and end for right.
Implementation
factory StacPositioned.directional({
required StacTextDirection textDirection,
double? start,
double? top,
double? end,
double? bottom,
double? width,
double? height,
required StacWidget child,
}) {
final (double? left, double? right) = switch (textDirection) {
StacTextDirection.rtl => (end, start),
StacTextDirection.ltr => (start, end),
};
return StacPositioned(
left: left,
top: top,
right: right,
bottom: bottom,
width: width,
height: height,
child: child,
);
}