Skip to content

Scrimmage-co/scrimmage-rewards-flutter

Repository files navigation

Scrimmage Rewards

This README provides step-by-step instructions on how to integrate the Scrimmage Rewards program into your Flutter application.

Prerequisites

Before integrating the Scrimmage Rewards program into your Flutter application, ensure that you have the following prerequisites in place:

  • Android Studio (or any other compatible development environment) installed on your machine.
  • Access to the Scrimmage Rewards program and an active account.
  • A backend server that can return a valid token for the Scrimmage Rewards program.
  • Android minSdkVersion 19+
  • iOS 11.0+
  • More requirements you can find here https://pub.dev/packages/webview_flutter

Integration Steps

Follow the steps below to integrate the Scrimmage Rewards program into your Flutter application:

Check main.dart for example code.

  1. Install the WebView Support Library

    To enable the Scrimmage Rewards program to display its content within a WebView, you need to install the WebView support library. This library allows you to embed web content within your Flutter application.

$ flutter pub add webview_flutter
  1. Import the WebView Support Library

    Once you have installed the WebView support library, you can import it into your Flutter application. You can import the WebView support library using the following code:

import 'package:webview_flutter/webview_flutter.dart';
  1. Create a WebViewController to use a WebViewWidget

It is important to set JavaScript mode as unrestricted. JavaScriptMode.unrestricted

final webViewController = WebViewController()
   ..setJavaScriptMode(JavaScriptMode.unrestricted);
  1. Add token retrieval logic for user authentication

    The Scrimmage Rewards program requires a valid token to authenticate the user and display the program's content. To retrieve a valid token, you must implement the logic to retrieve the token from your backend server. Once you have retrieved the token, you can pass it to the Scrimmage Rewards program to authenticate the user and display the program's content.

$ flutter pub add http
import 'package:http/http.dart' as http;
  1. Ensure WebView Is Not Displayed Until Token Is Available

    It is essential to ensure that the WebView displaying the Scrimmage Rewards program's content is not visible until a valid token is available. Probably you will need to use FutureBuilder to get token from your backend server and install http lib.

About

Scrimmage Rewards integration example to a Flutter app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published