buildControls method
Builds the list of control widgets.
Returns a retry button when showRetry is true, or the standard refresh + primary-action Row when showControls is true. Returns an empty list when neither flag is set.
Implementation
List<Widget> buildControls(BuildContext context) {
final controls = <Widget>[];
if (showRetry) {
controls.add(
_wrapSemantics(
identifier: retrySemanticsIdentifier,
label: retrySemanticsLabel ?? retryText,
child: ButtonPrimary(
text: retryText,
onTap: onRetry,
),
),
);
} else if (showControls) {
final int secondaryFlex =
formFactor == CloudPosDisplaySize.xSmall ? 2 : 1;
final int primaryFlex =
formFactor == CloudPosDisplaySize.xSmall ? 3 : 6;
controls.add(
Row(
children: [
Expanded(
flex: secondaryFlex,
child: _wrapSemantics(
identifier: refreshSemanticsIdentifier,
label: refreshSemanticsLabel ?? 'Refresh',
child: ButtonSecondary(
text: '',
icon: refreshIcon,
onTap: onRefresh,
),
),
),
const SizedBox(width: 8),
Expanded(
flex: primaryFlex,
child: _wrapSemantics(
identifier: primaryActionSemanticsIdentifier,
label: primaryActionSemanticsLabel ?? primaryActionText,
child: ButtonPrimary(
text: primaryActionText,
disabled: primaryActionDisabled,
onTap: onPrimaryAction,
),
),
),
],
),
);
}
return controls;
}