flutter debugShowCheckedModeBanner不删除debugShowCheckedModeBanner:false

wyyhbhjk  于 2023-04-13  发布在  Flutter
关注(0)|答案(2)|浏览(111)

我试图从我的应用程序中删除调试横幅,我在我的主.dart和每个活动中添加了debugShowCheckedModeBanner: false,但仍然显示调试横幅。
Main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:intrackapp/login/splash_screen.dart';
import 'package:khalti_flutter/khalti_flutter.dart';
import 'login/firebase_options.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );

  runApp( MyApp());
}

class MyApp extends StatelessWidget {
  final usernameController = TextEditingController();
  final passwordController = TextEditingController();
  MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
     return KhaltiScope(
       publicKey: "test_public_key_6ddec90a98d44awe4d84e2c58fc172490a",
       builder: (context, navKey) {
         return MaterialApp(
          // debugShowCheckedModeBanner: false,
           navigatorKey: navKey,
           localizationsDelegates: const[KhaltiLocalizations.delegate],
           theme: ThemeData(
             primaryColor: Colors.grey, // Set default color to blue
           ),

               debugShowCheckedModeBanner: false,
               home: SplashScreen(),
         );
       }
     );
  }
}

主要问题是debugShowCheckedModeBanner: false没有删除调试横幅,因为调试横幅显示在每个页面上。如何删除调试横幅?

mepcadol

mepcadol1#

注解了debugShowCheckedModeBanner行,请删除注解斜杠。(//)

tjjdgumg

tjjdgumg2#

如果您在所有应用程序屏幕中使用MaterialApp小部件,请确保在所有屏幕小部件中debugShowCheckedModeBanner为true或false。
如果为true,请将debugShowCheckedModeBanner设置为false。

相关问题