question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AppBar hides automatically when banner ads loads. With this simple code it hides the appbar when the appbar loaded

See original GitHub issue
class CheckEligibility extends StatefulWidget {
  CheckEligibility({Key? key}) : super(key: key);

  @override
  _CheckEligibilityState createState() => _CheckEligibilityState();
}

class _CheckEligibilityState extends State<CheckEligibility> {
  // final double height = 45;

  final _formKey = GlobalKey<FormState>();
  final salary = TextEditingController();
  final existingEMI = TextEditingController();
  final interest = TextEditingController();
  final year = TextEditingController();
  final month = TextEditingController();
  final property = TextEditingController();
  final agreement = TextEditingController();
  final _scrollController = ScrollController();
  var data;
  late bool salaryError, interestError, yearError, propertyError, agreementError;
  late String choosenPercentageOfSalary, choosenPercentageOfProperty, choosenPercentageOfAgreement;
  late double netEmi;
  late double minLoanAmount = data == null ? double.infinity : data.totalAmount;
  late bool isLoading;
  late BannerAd _ad2;
  void initState() {
    super.initState();
    netEmi = 0;
    minLoanAmount = 0;
    choosenPercentageOfSalary = '35';
    choosenPercentageOfProperty = choosenPercentageOfAgreement = '60';
    isLoading = false;
    salaryError = interestError = yearError = propertyError = agreementError = false;
    loadBannerAds();
  }

  void loadBannerAds() {
    _ad2 = BannerAd(
        size: AdSize.banner,
        adUnitId: AdHelper.bannerAdUnitID,
        listener: BannerAdListener(
            onAdLoaded: (_) {
              setState(() {
                isLoading = true;
              });
            },
            onAdFailedToLoad: (_, error) {}),
        request: AdRequest());
    _ad2.load();
  }

  Widget checkForAd2() {
    if (isLoading) {
      return Container(
          width: _ad2.size.width.toDouble(),
          height: _ad2.size.height.toDouble(),
          child: AdWidget(
            ad: _ad2,
          ));
    } else
      return Container();
  }

  final List<FocusNode> focus = List.generate(7, (index) => FocusNode());
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   elevation: 0,
      //   title: "Check Eligibility".text.make(),
      //   backgroundColor: primaryColor,
      //   // leading: IconButton(
      //   //   splashRadius: 20,
      //   //   icon: Icon(Icons.arrow_back),
      //   //   onPressed: () {
      //   //     Navigator.pop(context);

      //   //     Provider.of<AnimateTransition>(context, listen: false).updateHome();
      //   //   },
      //   // ),
      //   actions: [
      //     Tooltip(
      //       margin: EdgeInsets.only(top: 25),
      //       height: 60,
      //       message: 'history',
      //       child: IconButton(
      //           padding: EdgeInsets.only(right: 10),
      //           splashRadius: 20,
      //           onPressed: () {
      //             Navigator.push(context,
      //                 EnterExitRoute(enterPage: EmiCalculatorHistory(), exitPage: this.widget, context: context));
      //             // log('clicked');
      //             // setState(() {});
      //           },
      //           icon: Icon(
      //             Icons.history,
      //             size: 39,
      //           )),
      //     ),
      //   ],
      // ),
      body: Stack(
        alignment: Alignment.topCenter,
        children: [
          Center(child: checkForAd2()),
        ],
      ),
    );
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Janglecommented, Oct 18, 2021

Same problem. I still have a part of the user interface disappearing when the ad loads.

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
    ru-RU)
    • Flutter version 2.5.3 at /Users/*****/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 days ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/*****/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 11.6 20G165 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 94.0.4606.81

• No issues found!
1reaction
imamhossain94commented, Nov 19, 2021

Hello @imamhossain94. How to apply this fix?

I don’t know the actual fix but I will suggest you to do a manual downgrade of all packages one by one and check whether the AppBar is disappeared or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Place a floating app bar above a list - Flutter documentation
Interactive example. To make it easier for users to view a list of items, you might want to hide the app bar as...
Read more >
Flutter - How can I dynamically show or hide App Bars on pages
Now i want to hide app bar when intent from navigation drawer, so please guide me, below is my code. Navigation Screen code....
Read more >
Set up the app bar - Android Developers
In its most basic form, the action bar displays the title for the activity on one side and an overflow menu on the...
Read more >
Use a keyboard to customize the Quick Access Toolbar
Show or hide the Quick Access Toolbar. In any Microsoft 365 app, press the Alt key. Press Z and then R to expand...
Read more >
The Tableau Workspace
In Tableau Desktop, you can hide or display the Tableau toolbar by selecting Window > Show Toolbar. The table below explains the functions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found