Created
March 2, 2020 10:12
-
-
Save pratheeshrussell/d163ef987af38276bed1a09ece29a0a9 to your computer and use it in GitHub Desktop.
native animated splash screen , the main activity class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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