12- (
id)initWithEngineRunCompletion:(dispatch_block_t)engineRunCompletion {
15 withCompletion:engineRunCompletion];
21 self.view.backgroundColor = UIColor.grayColor;
23 UIButton* showFlutterButton = [UIButton buttonWithType:UIButtonTypeSystem];
24 showFlutterButton.translatesAutoresizingMaskIntoConstraints = NO;
25 showFlutterButton.backgroundColor = UIColor.blueColor;
26 [showFlutterButton setTitle:@"Show Flutter" forState:UIControlStateNormal];
27 showFlutterButton.tintColor = UIColor.whiteColor;
28 showFlutterButton.clipsToBounds = YES;
29 [showFlutterButton addTarget:self
30 action:@selector(showFlutter:)
31 forControlEvents:UIControlEventTouchUpInside];
33 [
self.view addSubview:showFlutterButton];
34 [[showFlutterButton.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor] setActive:YES];
35 [[showFlutterButton.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor] setActive:YES];
36 [[showFlutterButton.heightAnchor constraintEqualToConstant:50] setActive:YES];
37 [[showFlutterButton.widthAnchor constraintEqualToConstant:150] setActive:YES];
39 [_engine runWithEntrypoint:nil];
46 [
self presentViewController:flutterVC animated:NO completion:showCompletion];
fml::scoped_nsobject< FlutterEngine > _engine