6

I have multiple screens. all the screens are showing debug tag. I am implementing debugshowcheckedmodebanner: false, into material app of my main file but debug tag shows on right top of each of the screen. I am not sure where I am making mistake.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:async';a
import 'home.dart';

void main() {
  runApp(MaterialApp(
    debugShowCheckedModeBanner: false,
    home: splash(),
  ));
}

class splash extends StatefulWidget {
  @override
  _splashState createState() => _splashState();
}

class _splashState extends State<splash> {

  void initState() {
    super.initState();
    Timer(
      Duration(seconds: 3),
          () => Navigator.pushReplacement(
        context,
        MaterialPageRoute(builder: (context) => MyApp(),
      ),
    ));
  }

  @override
  Widget build(BuildContext context) {
    SystemChrome.setEnabledSystemUIOverlays([]);
    Future<bool> _onBackPressed() {
      return showDialog(
          context: context,
          builder: (context) => AlertDialog(
            title: Text("Do you want to exit?"),
            actions: <Widget>[
              FlatButton(
                  onPressed: () {
                    Navigator.pop(context, false);
                  },
                  child: Text("No")),
              FlatButton(
                  onPressed: () {
                    Navigator.pop(context, true);
                  },
                  child: Text("yes"))
            ],
          ));
    }

    Orientatoin();
    return WillPopScope(
      child: Scaffold(
        body: Stack(
          fit: StackFit.expand,
          children: <Widget>[
            Container(
              decoration: BoxDecoration(
                color: Colors.transparent,
              ),
              child: Image.asset('imges/splash.png'),
            ),

          ],
        ),
      ),
      onWillPop: _onBackPressed,
    );
  }
}

void Orientatoin() {
  SystemChrome.setPreferredOrientations(
      [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
}

4 Answers 4

7

Ensure you have just a single MaterialApp widget in your project and all screens in your application must be a child of this widget.

Sign up to request clarification or add additional context in comments.

Comments

2

Make sure that you are not toggling the banner from dev tools or in the flutter inspector panel on the right hand side of the screen in android studio/Intellij.

In the code you have, their is an extra a in line 3. check that your code compiles, and not running an older version of your code base.

3 Comments

how can I check it from flutter inspector please? that 'a' mistakenly type while putting the question.
in android studio/Intellij top menu bar: View -> Tool Windows -> Flutter Inspector.in the inspector you can find "Hide debug mode banner" under "more Actions" dropdown.
Aligator I had another materialApp widget on other screen so I removed that materialApp (as whole application should have one materialApp widget) and now everything is perfect. many thanks for your response stay blessed
0

You must insert "debugshowcheckedmodebanner: false" in main.dart and all screen files then Ok

Comments

0

I faced this issues, and for me it was happening because I was doing a hot-reload / hot-restart. I restarted the App (Stop main.dart, then Run main.dart again) and issue got resolved. It seem hot-restart doesn't 'rebuild' the MaterialApp.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.