Turn Off Splash Screen When Using Flutterviewcontroller Within Existing Native App

Reset flutter views when leaving flutter module inside native app

After some experiments the solution was to natively react to the state and send a custom 'reset' through a methodchannel

How can I push a UIViewController from FlutterViewController

You need to embed FlutterViewController in container UINavigationController programmatically or in storyboard, then you will be able to push your next controller.

Here is example how to embed programmatically:

@interface AppDelegate()
@property (nonatomic, strong) UINavigationController *navigationController;
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];

UIViewController *flutterViewController = [[FlutterViewController alloc] init];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:flutterViewController];
[self.navigationController setNavigationBarHidden:YES];

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];

return true;
}

- (void)pushExample {
UIViewController *viewController = [[UIViewController alloc] init];
[self.navigationController pushViewController:viewController animated:true];
}

@end

When needed(e.g. button tapped) invoke pushExample.
Also you can check "storyboard" way in this video

Playing audio in the background

You can use flutter_sound package from the link.
https://pub.dev/packages/flutter_sound

On the class where you need to play the audio, import the flutter sound package. After that inside the initState method play the audio like below

@override
void initState() {
FlutterSound flutterSound = FlutterSound();
flutterSound.startPlayer(url); // here give the mp3 url like "audio1.mp3"
}

Flutter app opens, but is stuck on splash-screen

Solution for me:

1) updated my iOS toolchain with flutter doctor

2) flutter clean

3) flutter build ios --release in the terminal

4) Archive in Xcode



Related Topics



Leave a reply



Submit