onPlayClick method

dynamic onPlayClick({
  1. required BuildContext context,
  2. required PlayState playState,
  3. required Datum content,
  4. required Function onLoadCallback,
  5. required String loginPageUrl,
  6. required String plansPageUrl,
  7. bool isContinueWatchingItemClicked = false,
  8. String? pageName,
})

Implementation

onPlayClick(
    {required BuildContext context,
    required PlayState playState,
    required Datum content,
    required Function onLoadCallback,
    required String loginPageUrl,
    required String plansPageUrl,
    bool isContinueWatchingItemClicked = false,
    String? pageName}) async {
  if (playState.buttonState == PlayButtonState.login) {
    // redirect to login page url here
    // ScaffoldMessenger.of(context)
    //     .showSnackBar(const SnackBar(content: Text("Todo : LOGIN")));
    RouteGenerator().navigate(context, loginPageUrl);
  } else if (playState.buttonState == PlayButtonState.play ||
      playState.buttonState == PlayButtonState.clearLead) {
    if (isContinueWatchingItemClicked) {
    } else {
      //Sho
      // ScaffoldMessenger.of(context).showSnackBar(
      //     const SnackBar(content: Text("Sending callback : Play")));
      onLoadCallback(
          PlayState(buttonState: playState.buttonState, isLoading: true));
    }

    await _playVideo(content, playState,
        onLoadCallback: onLoadCallback, context: context);
  } else if (playState.buttonState == PlayButtonState.subscribe) {
    onLoadCallback(PlayState(
        buttonState: playState.buttonState,
        buttonText: PlayButtonState.subscribe,
        isLoading: false));
    // gotoPlansPage(context);
    // ScaffoldMessenger.of(context)
    //     .showSnackBar(const SnackBar(content: Text("Todo : Plans Page")));
    RouteGenerator().navigate(context, plansPageUrl);
    // Redirect to plans page here
  } else if (playState.buttonState == PlayButtonState.buy) {
    initBuyNow(
        context: context,
        playState: playState,
        content: content,
        onLoadCallback: onLoadCallback);
  }
}