Skip to content

Multiple flutter views seems to interfere with each others graphics context. #17688

@sigurdm

Description

@sigurdm

I have only tried this on iOS.

I created an iOS project creating two distinct FlutterViewControllers, each showing the same image (using new Image.asset("assets/a.jpeg")).
The image is garbled in the second view.

Attaching a screen recording showing the problem (the two views should show the same image).

The code instantiating the FlutterViewController is as follows:

- (void)pushFlutter1 {
    NSLog(@"Pushed");
    if (!_flutterViewController1) {
    _flutterViewController1 = [[FlutterViewController alloc] initWithProject:nil nibName:nil bundle:nil];
        messageChannel = [FlutterBasicMessageChannel messageChannelWithName:@"channel"
                                                            binaryMessenger:_flutterViewController1
                                                                      codec:[FlutterStandardMessageCodec sharedInstance]];
        [_flutterViewController1 setInitialRoute:@"1"];
        UINavigationController*  __weak weakSelf = self;
        _flutterViewController1.edgesForExtendedLayout = UIRectEdgeNone;
        [messageChannel setMessageHandler:^(id message, FlutterReply reply) {
            [weakSelf popViewControllerAnimated:YES];
            NSLog(@"Popping");
            reply(@"");
        }];
    }

    NSAssert([self navigationController], @"Must have a NaviationController");
    [[self navigationController] pushViewController:_flutterViewController1 animated:YES];
}

(and similarly for the second view).

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions