layout method

  1. @override
PwBox layout(
  1. Context context,
  2. BoxConstraints constraints
)
override

layout API.

Implementation

@override
PwBox layout(Context context, BoxConstraints constraints) {
  final List<Widget> kids = <Widget>[
    if (hint.isNotEmpty)
      Text(
        hint,
        style:
            hintStyle ??
            const TextStyle(fontSize: 8, color: '90A4AE'),
      ),
    if (hint.isNotEmpty) const SizedBox(height: 18),
    if (hint.isEmpty) const SizedBox(height: 28),
    SizedBox(
      width: width,
      child: Divider(height: 1, thickness: 0.9, color: lineColor),
    ),
    const SizedBox(height: 4),
    Text(
      label,
      style:
          labelStyle ??
          const TextStyle(fontSize: 9, color: '455A64'),
    ),
  ];
  if (showDateLine) {
    kids.addAll(<Widget>[
      const SizedBox(height: 16),
      SizedBox(
        width: width * 0.55,
        child: Divider(height: 1, thickness: 0.9, color: lineColor),
      ),
      const SizedBox(height: 4),
      Text(
        dateLabel,
        style:
            labelStyle ??
            const TextStyle(fontSize: 9, color: '455A64'),
      ),
    ]);
  }
  return SizedBox(
    width: width,
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: kids,
    ),
  ).layout(context, constraints);
}