duyduong / flutter_native_admob

Plugin to integrate native firebase admob to Flutter application
MIT License
62 stars 85 forks source link

NativeTextStyle's fontSize is not working #30

Open Errechydy opened 4 years ago

Errechydy commented 4 years ago

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),
          ],
        ),

        ),
    );
  }
} 
korchix commented 4 years ago

@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.

Errechydy commented 4 years ago

@korchix have you tried it in a real device?

korchix commented 4 years ago

@korchix have you tried it in a real device?

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

Errechydy commented 4 years ago

@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

korchix commented 4 years ago

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

Errechydy commented 4 years ago

@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

mingosnunes commented 4 years ago

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

zirho commented 4 years ago

+1 fontSize does not work on android devices.