eventReplayComparisonResultString method

Future<Widget> eventReplayComparisonResultString(
  1. FlutsterTestEvent? playEvent
)

eventReplayComparisonResultString returns a Text widget with the result of the result of the event run.

Implementation

Future<Widget> eventReplayComparisonResultString(
    FlutsterTestEvent? playEvent) async {
  if (playEvent == null) {
    return (const Text("Event failed to play"));
  }
  if (playEvent.type != type) {
    return (const Text("Event is of wrong type"));
  }
  if (type == FlutsterTestEventType.screenShot) {
    if (playEvent.screenShot == null) {
      return (const Text("Replay has an empty screenshot"));
    }
    bool res = await screenShotComparison(playEvent.screenShotBytes!);
    playEvent.screenShotMatchResult = screenShotMatchResult;
    if (res) {
      return Wrap(
        children: [
          const Text("Screenshots match"),
          presentImage(playEvent.screenShot!),
        ],
      );
    }
    return Wrap(
      children: [
        const Text("Screenshots don't match"),
        presentImage(playEvent.screenShot!),
      ],
    );
  }
  return (const Text("eventReplayComparisonResultString not implemented"));
}