Android 颤振调试ShowCheckedModeBanner:false不删除调试横幅
我正在尝试从应用程序中删除调试横幅,并在main.dart和每个活动中添加了Android 颤振调试ShowCheckedModeBanner:false不删除调试横幅,android,flutter,Android,Flutter,我正在尝试从应用程序中删除调试横幅,并在main.dart和每个活动中添加了debugShowCheckedModeBanner:false,但仍显示调试横幅 主飞镖 void main() async { runApp(MaterialApp(home:SplashScreen(), debugShowCheckedModeBanner: false,)); } class SplashScreen extends StatefulWidget { @override _Sp
debugShowCheckedModeBanner:false
,但仍显示调试横幅
主飞镖
void main() async {
runApp(MaterialApp(home:SplashScreen(), debugShowCheckedModeBanner: false,));
}
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => new _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
startTime() async {
var _duration = new Duration(seconds: 1);
return new Timer(_duration, navigationPage);
}
void navigationPage() {
Navigator.pushReplacement(
context,
new CupertinoPageRoute(
builder: (BuildContext context) => MyHomesApp()));
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Stack(
children: <Widget>[
Container(
decoration: new BoxDecoration(color: colorGreen),
),
Container(
padding: EdgeInsets.all(30.0),
child: Center(
child: new Image.asset('assets/green_h_logo.png',color: Colors.white,height: 150,width: 150,)
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 50,
child:new Image.asset('assets/h.gif')),
),
],
),
);
}
}
void main()异步{
runApp(MaterialApp(主页:SplashScreen(),debugShowCheckedModeBanner:false,);
}
类SplashScreen扩展StatefulWidget{
@凌驾
_SplashScreenState createState()=>new_SplashScreenState();
}
类的状态扩展了状态{
startTime()异步{
var_duration=新的持续时间(秒:1);
返回新计时器(_持续时间,导航页面);
}
无效导航页(){
导航器。更换(
上下文
新CupertinoPageRoute(
builder:(BuildContext)=>MyHomesApp());
}
@凌驾
小部件构建(构建上下文){
归还新脚手架(
正文:新堆栈(
儿童:[
容器(
装饰:新盒子装饰(颜色:绿色),
),
容器(
填充:所有边缘设置(30.0),
儿童:中心(
子项:新图像.asset('assets/green\u h\u logo.png',颜色:Colors.white,高度:150,宽度:150,)
),
),
对齐(
对齐:对齐.bottomCenter,
子:容器(
身高:50,
子级:new Image.asset('assets/h.gif'),
),
],
),
);
}
}
上面的代码是my main.dart,它加载一个启动屏幕,然后在一秒钟后导航到MyHomeApp,该应用程序具有如下底部导航栏:
霍姆·达特
class MyHomesApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'App Name',
theme: ThemeData(
primarySwatch: Colors.green,
fontFamily: "Montserrat", //my custom font
),
builder: (context, child) {
return ScrollConfiguration(
behavior: MyBehavior(),
child: child,
);
},
home: Homes(),
);
}
}
class Homes extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Homes> {
int _currentIndex;
List<Widget> _children;
@override
void initState() {
_currentIndex = 0;
_children = [
MyDealApp(),
MyRedemptionApp(),
MyProfileApp()
];
_loadCounter();
super.initState();
}
_loadCounter() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
myInt = prefs.getInt('id') ?? 0;
_email = (prefs.getString('email') ?? '');
_fullname = (prefs.getString('fullname') ?? '');
currentTabs = prefs.getInt('currentTab') ?? 0;
debugPrint("currentTabMain:$currentTabMain");
debugPrint("emailr:$_email");
});
}
@override
Widget build(BuildContext context) {
const assetHome = 'assets/home_off.svg';
const assetRedemptions = 'assets/redeemed_off.svg';
const assetCommunity = 'assets/community_off.svg';
const assetProfile = 'assets/profile_off.svg';
const assetHome1 = 'assets/home_on.svg';
const assetRedemptions1 = 'assets/redeemed_on.svg';
const assetCommunity1 = 'assets/community_on.svg';
const assetProfile1 = 'assets/profile_on.svg';
return Container(
height: 30,
child:CupertinoTabScaffold(
tabBar: CupertinoTabBar(
backgroundColor: colorGreen,
currentIndex: _currentIndex,
onTap: onTabTapped,
items: [
BottomNavigationBarItem(
icon: _currentIndex == 0 ?SvgPicture.asset(assetHome1,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Home'):SvgPicture.asset(assetHome,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Home'),
),
BottomNavigationBarItem(
icon: _currentIndex == 1 ?SvgPicture.asset(assetRedemptions1,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Redemptions'):SvgPicture.asset(assetRedemptions,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Redemptions'),
),
BottomNavigationBarItem( icon: _currentIndex == 2 ? SvgPicture.asset(assetProfile1,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Profile'):SvgPicture.asset(assetProfile,
color: Colors.white,
width: 20,
height: 20,
semanticsLabel: 'Profile'),
),
],
),
tabBuilder: (BuildContext context, int index) {
return CupertinoTabView(
builder: (BuildContext context) {
return SafeArea(
top: false,
bottom: false,
child: CupertinoApp(
home: CupertinoPageScaffold(
resizeToAvoidBottomInset: false,
child: _children[_currentIndex],
),
),
);
},
);
}
));
}
void onTabTapped(int index) {
setState(() {
_currentIndex = index;
debugPrint("tabbottom:$_currentIndex");
});
}
}
类MyHomeApp扩展了无状态小部件{
@凌驾
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
标题:“应用程序名称”,
主题:主题数据(
主样本:颜色。绿色,
fontFamily:“蒙特塞拉特”//我的自定义字体
),
生成器:(上下文,子对象){
返回滚动配置(
行为:MyBehavior(),
孩子:孩子,
);
},
home:Homes(),
);
}
}
类Homes扩展StatefulWidget{
@凌驾
_HomeState createState()=>\u HomeState();
}
类(HomeState扩展状态){
int currentIndex;
列出儿童;
@凌驾
void initState(){
_currentIndex=0;
_儿童=[
MyDealApp(),
MyRedemptionApp(),
MyProfileApp()
];
_装载计数器();
super.initState();
}
_loadCounter()异步{
SharedReferences prefs=等待SharedReferences.getInstance();
设置状态(){
myInt=prefs.getInt('id')??0;
_email=(prefs.getString('email')??'';
_全名=(prefs.getString('fullname')??“”;
currentTabs=prefs.getInt('currentTab')??0;
调试打印(“currentTabMain:$currentTabMain”);
debugPrint(“emailr:$_email”);
});
}
@凌驾
小部件构建(构建上下文){
const assetHome='assets/home_off.svg';
const assetRedemptions='assets/reducted_off.svg';
const assetCommunity='assets/community_off.svg';
const assetProfile='assets/profile_off.svg';
const assetHome1='assets/home_on.svg';
const AssetDemptions1='assets/reducted_on.svg';
const assetCommunity1='assets/community_on.svg';
const assetProfile1='assets/profile_on.svg';
返回容器(
身高:30,
孩子:库珀提诺巴塞弗德(
tabBar:CupertinoTabBar(
背景颜色:绿色,
currentIndex:_currentIndex,
onTap:onTabTapped,
项目:[
底部导航气压计(
图标:_currentIndex==0?SvgPicture.asset(assetHome1,
颜色:颜色,白色,
宽度:20,
身高:20,
semanticsLabel:“Home”):SvgPicture.asset(assetHome,
颜色:颜色,白色,
宽度:20,
身高:20,
语义标签:“Home”),
),
底部导航气压计(
图标:_currentIndex==1?SvgPicture.asset(资产需求1,
颜色:颜色,白色,
宽度:20,
身高:20,
semanticsLabel:“赎回”):SvgPicture.asset(资产赎回,
颜色:颜色,白色,
宽度:20,
身高:20,
semanticsLabel:“赎回”),
),
BottomNavigationBarItem(图标:_currentIndex==2?SvgPicture.asset(资产配置文件1,
颜色:颜色,白色,
宽度:20,
身高:20,
semanticsLabel:'Profile'):SvgPicture.asset(assetProfile,
颜色:颜色,白色,
宽度:20,
身高:20,
semanticsLabel:'Profile'),
),
],
),
tabBuilder:(BuildContext,int-index){
返回CupertinoTabView(
生成器:(BuildContext上下文){
返回安全区(
上图:错,
底部:错误,
孩子:CupertinoApp(
首页:CupertinoPageScaffold(
resizeToAvoidBottomInset:false,
子项:_children[_currentIndex],
),
),
);
},
);
}
));
}
void onTabTapped(整数索引){
设置状态(){
_currentIndex=索引;
debugPrint(“选项卡底部:$\u currentIndex”);
});
}
}
我分别对
MyRedemptionApp()
和MyProfileApp()
使用了相同的方法。主要问题是debugShowCheckedModeBanner:false
没有删除调试横幅,因为调试横幅显示在每个页面上。如何删除调试横幅?当您使用多个MaterialApp小部件时,通常会发生这种情况