Skip to content

Instantly share code, notes, and snippets.

@pratheeshrussell
Created March 2, 2020 10:12
Show Gist options
  • Save pratheeshrussell/d163ef987af38276bed1a09ece29a0a9 to your computer and use it in GitHub Desktop.
Save pratheeshrussell/d163ef987af38276bed1a09ece29a0a9 to your computer and use it in GitHub Desktop.
native animated splash screen , the main activity class
//android\app\src\main\java\com\example\native_splash\MainActivity.java
package com.example.native_splash;
import android.content.Context;
import android.util.Log;
import androidx.annotation.Nullable;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.android.SplashScreen;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.view.FlutterMain;
public class MainActivity extends FlutterActivity {
private static FlutterEngine flutterEngine;
@Override
public FlutterEngine provideFlutterEngine(Context context) {
if (flutterEngine == null) {
flutterEngine = new FlutterEngine(context);
flutterEngine.getDartExecutor().executeDartEntrypoint(new DartExecutor.DartEntrypoint(
FlutterMain.findAppBundlePath(context), "main"));
}
return flutterEngine;
}
@Override
public SplashScreen provideSplashScreen() {
return new CustomSplashScreen();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment