Skip to content

Banner size is not updated after screen size changes #43

Open
@raspberry-jenshen

Description

@raspberry-jenshen

Hello,

I've found an issue that the banner isn't updated after the screen size was changed.

Preconditions:
I try to use maximum space for the banner widget.
So, my banner size depends on the screen size.

Widget example:

AppodealBanner(
      adSize: AppodealBannerSize(
        width: banner.size.width.round(),
        height: banner.size.height.round(),
        name: 'BANNER',
      ),
    )

When you rotate the device we have to update the banner size but nothing changes.

How to resolve the issue:

@override
  void didUpdateWidget(AppodealBanner oldWidget) {
    super.initState(oldWidget);
    if (widget.adSize != oldWidget.adSize) {
      setState(() {
        adSize = Future.value(Size(
          widget.adSize.width.toDouble(),
          widget.adSize.height.toDouble(),
        ));
      });
    }

  }

photo_2023-07-18_14-08-35

Not updated size after rotation.
photo_2023-07-18_14-08-41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions