flutter_native_admob icon indicating copy to clipboard operation
flutter_native_admob copied to clipboard

NativeTextStyle's fontSize is not working

Open Errechydy opened this issue 4 years ago • 8 comments

NativeTextStyle's fontSize is not working, i tested it with many values but it's not changing from the default one

import 'package:flutter/material.dart';
import 'package:flutter_native_admob/flutter_native_admob.dart';
import 'package:flutter_native_admob/native_admob_controller.dart';
import 'package:flutter_native_admob/native_admob_options.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _adUnitID = "ca-app-pub-3940256099942544/8135179316";

  final _nativeAdController = NativeAdmobController();


  Widget showAds(double fontSize) => Container(
              height: 90,
              child: NativeAdmob(
                adUnitID: _adUnitID,
                controller: _nativeAdController,
                type: NativeAdmobType.banner,
                options: NativeAdmobOptions(
                  headlineTextStyle : NativeTextStyle(
                                      fontSize: fontSize,
                                  ),
                ),
              ),
            );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body:  ListView(
          children: <Widget>[
            showAds(5.0),
            showAds(10.0),
            showAds(20.0),
            showAds(30.0),
            showAds(40.0),
          ],
        ),
            
        ),
    );
  }
} 

Errechydy avatar Mar 31 '20 23:03 Errechydy

@Errechydy i tried the code you provided as it is. and it works for me. for every Ad i got a bigger fontsize, like the value given in the showAds() method.

korchix avatar Apr 01 '20 18:04 korchix

@korchix have you tried it in a real device?

Errechydy avatar Apr 01 '20 18:04 Errechydy

@korchix have you tried it in a real device?

i have run it in a real device (iphone x)

korchix avatar Apr 01 '20 19:04 korchix

@korchix Weird, i have run it on Android device (Nubia ZTE) the font didn't change, i don't know if that happens on all Android devices or it's related only to the device i have

Errechydy avatar Apr 01 '20 19:04 Errechydy

@Errechydy try to run it on an android emulator like the Pixel 2 XL or something like that.

korchix avatar Apr 01 '20 19:04 korchix

@korchix I will, but to be honest i don't trust emulators that much. in many cases things work on emulators well then when you test them on a real device they don't

Errechydy avatar Apr 01 '20 19:04 Errechydy

I can confirm that Text Size don't change on Android but works on IOS

mingosnunes avatar Jul 22 '20 18:07 mingosnunes

+1 fontSize does not work on android devices.

zirho avatar Oct 10 '20 03:10 zirho