flutter_native_admob icon indicating copy to clipboard operation
flutter_native_admob copied to clipboard

Set background color to white

Open M1Joe opened this issue 4 years ago • 10 comments

I have an app with a bunch of white cards in a listview. Unfortunately, I keep getting black banner ads and I can't figure out a way to set them to white.

It looks like Admob offers withMainBackgroundColor (https://developers.google.com/admob/android/native/templates?hl=en-US). Is that something that we could tie into to get white backgrounds?

M1Joe avatar May 10 '20 15:05 M1Joe

Have you figured out how to do this? The backgrounds of my ads are also showing as black. 2020_06_23_12 15 23 (1)

shahmilc avatar Jun 23 '20 16:06 shahmilc

@M1Joe @SCVec wrap into a Container, u can set paddings or background

duyduong avatar Jun 26 '20 13:06 duyduong

@M1Joe @SCVec wrap into a Container, u can set paddings or background

I tried that, but it doesn't change the color within the ad itself;

Container(
      color: Colors.red,
      height: displayWidth(context) * 0.9,
      width: displayWidth(context) * 0.9,
      padding: EdgeInsets.all(displayWidth(context) * 0.02),
      margin: EdgeInsets.only(bottom: displayHeight(context) * 0.02),
      child: NativeAdmob(
        adUnitID: _adUnitID1,
        controller: _controller1,
        type: NativeAdmobType.full,
      ),
);

20200626_115212985

shahmilc avatar Jun 26 '20 15:06 shahmilc

Same problem here, is there any solution for that? Thank you very much in advance.

wilssola avatar Aug 12 '20 01:08 wilssola

Any solution for this problem?

DFelten avatar Nov 27 '20 10:11 DFelten

I've created a pull request to fix this issue: https://github.com/duyduong/flutter_native_admob/pull/74

DFelten avatar Nov 27 '20 11:11 DFelten

Thanks a lot for the valuable contribution. @DFelten

There is a small issue still that a black color is shown for a second right after loading the add with out custom-set background color.

mhassanist avatar Jan 16 '21 09:01 mhassanist

@duyduong the version on the pub.dev still does not have this merge. isn't it ?

mhassanist avatar Jan 16 '21 09:01 mhassanist

@mhassanist It seems this version is not merged on pub.dev yet. I used the master version on pubspec.yaml like this:

flutter_native_admob:
    git:
      url: git://github.com/duyduong/flutter_native_admob.git
      ref: master
      commit: 30095d0

hyungtaecf avatar Jan 18 '21 14:01 hyungtaecf

@hyungtaecf That was very useful :) Thank you!

mhassanist avatar Jan 19 '21 06:01 mhassanist