childButtonStandardBack method

Widget childButtonStandardBack(
  1. AFStateProgrammingInterface<AFComponentState, AFBuildContext<AFFlexibleStateView, AFRouteParam>, AFFunctionalTheme> spi, {
  2. required AFScreenID screen,
  3. AFWidgetID wid = AFUIWidgetID.buttonBack,
  4. dynamic iconIdOrWidget = AFUIThemeID.iconBack,
  5. dynamic iconColor,
  6. dynamic iconSize,
  7. String tooltip = "Back",
  8. bool worksInSingleScreenTest = true,
  9. AFShouldContinueCheckDelegate? shouldContinueCheck,
})
inherited

Creates a standard back button, which navigates up the screen hierarchy.

The back button can optionally display a dialog which checks whether the user should continue, see standardShouldContinueAlertCheck for more.

Implementation

Widget childButtonStandardBack(AFStateProgrammingInterface spi, {
  required AFScreenID screen,
  AFWidgetID wid = AFUIWidgetID.buttonBack,
  dynamic iconIdOrWidget = AFUIThemeID.iconBack,
  dynamic iconColor,
  dynamic iconSize,
  String tooltip = "Back",
  bool worksInSingleScreenTest = true,
  AFShouldContinueCheckDelegate? shouldContinueCheck,
}) {
  var ico = icon(iconIdOrWidget, iconColor: iconColor, iconSize: iconSize);
  if(ico == null) throw AFException("Could not create icon");
  return IconButton(
      key: keyForWID(wid),
      icon: ico,
      tooltip: translate(text: tooltip),
      onPressed: () async {
        if(shouldContinueCheck == null || await shouldContinueCheck() == AFShouldContinue.yesContinue) {
          spi.context.navigatePop(worksInSingleScreenTest: worksInSingleScreenTest);
          spi.context.executeWireframeEvent(wid, null);
        }
      }
  );
}