defaultControlButtons function

Widget defaultControlButtons(
  1. BuildContext context,
  2. Function? skip,
  3. Function? next,
  4. int index,
  5. int total,
  6. String finishWording,
  7. String nextWording,
  8. String skipWording,
  9. Color? textColor,
)

Implementation

Widget defaultControlButtons(
    BuildContext context,
    Function? skip,
    Function? next,
    int index,
    int total,
    String finishWording,
    String nextWording,
    String skipWording,
    Color? textColor) {
  return Wrap(
    spacing: 8.0,
    runSpacing: 8.0,
    children: [
      if (skip != null)
        (OutlinedButton(
          style: textColor != null
              ? OutlinedButton.styleFrom(
                  side: BorderSide(width: 1.0, color: textColor),
                )
              : null,
          child: Text(
            index + 1 == total ? finishWording : skipWording,
            style: Theme.of(context).textTheme.labelMedium,
          ),
          onPressed: () => skip(),
        )),
      if (next != null && index + 1 < total)
        (ElevatedButton(
          style: ButtonStyle(
              backgroundColor: MaterialStateProperty.all(
                  Theme.of(context).colorScheme.outline.withAlpha(150))),
          child: Text(
            "$nextWording (${index + 1}/$total)",
            style: Theme.of(context).textTheme.labelMedium,
          ),
          onPressed: () => next(),
        )),
    ],
  );
}