Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 应用程序运行时的屏幕顶部,显示带有应用程序标题的标签_Android_Android Studio_Flutter_Dart - Fatal编程技术网

Android 应用程序运行时的屏幕顶部,显示带有应用程序标题的标签

Android 应用程序运行时的屏幕顶部,显示带有应用程序标题的标签,android,android-studio,flutter,dart,Android,Android Studio,Flutter,Dart,伙计们,我不知道该怎么办,突然顶部的标签上出现了文字,实际上是我申请的标题。 我尝试在互联网上搜索和堆栈溢出,但我发现除了另一个问题没有解决相同的问题。 这是我的主文件,但我认为manifest.xml文件中存在问题 import 'dart:async'; import 'package:dices_app/icons/d6_icons.dart'; import 'package:dices_app/icons/d8_icons.dart'; import 'package:dice

伙计们,我不知道该怎么办,突然顶部的标签上出现了文字,实际上是我申请的标题。 我尝试在互联网上搜索和堆栈溢出,但我发现除了另一个问题没有解决相同的问题。 这是我的主文件,但我认为manifest.xml文件中存在问题

    import 'dart:async';
import 'package:dices_app/icons/d6_icons.dart';
import 'package:dices_app/icons/d8_icons.dart';
import 'package:dices_app/icons/percent_icons.dart';
import 'package:firebase_admob/firebase_admob.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'icons/dices_icons.dart';
import 'functions.dart';
import 'icons/skulls_icons.dart';
import 'icons/nice_icons_icons.dart';
import 'history.dart';
import 'dice.dart';
import 'dart:io';
import 'package:firebase_admob/firebase_admob.dart';
import 'package:firebase_core/firebase_core.dart';

String AD_REWARDED_ID = 'ca-app-pub-3940256099942544/5224354917';
String AD_BANNER_ID = 'ca-app-pub-6798357699412375/6371632425';
String AD_INTERSTITIAL_ID = 'ca-app-pub-3940256099942544/1033173712';
String APP_ID = 'ca-app-pub-6798357699412375~3611228404';
RewardedVideoAd videoAd = RewardedVideoAd.instance;
InterstitialAd interstitialAd;
BannerAd myBanner = BannerAd(
    adUnitId: BannerAd.testAdUnitId,
    size: AdSize.smartBanner,
    listener: (event) => ('banner event is $event'),
    targetingInfo: targetingInfo
);
InterstitialAd myInterstitial() {
  return InterstitialAd(
    adUnitId: InterstitialAd.testAdUnitId,
    targetingInfo: targetingInfo,
    listener: (MobileAdEvent event) {
      if (event == MobileAdEvent.failedToLoad) {
        interstitialAd..load();
      } else if (event == MobileAdEvent.closed) {
        interstitialAd = myInterstitial()..load();
      }
    },
  );
}
Color bgColor = isDarkMode ? Color(0x2D050401) : Color(0xff03ed19);
Color appBarColor = isDarkMode ? Colors.grey[900] : Color(0xd66a994e);
Color iconColor = isDarkMode ? Color(0xE9F02D3A) : Colors.black;
Color textColor = isDarkMode ? Color(0xE9F02D3A) : Colors.black;
Color cardColor = isDarkMode ? Colors.white10 : Colors.white;
Color buttonColor = isDarkMode ? Colors.grey[900] : Colors.grey[350];

MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
  keywords: <String>['games', 'dices', 'random', 'boardgames'],
  childDirected: false,
);

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}
bool noAds = false;
bool switchValue = true;
bool isDarkMode = true;

class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
  TabController _tabController;
  List<Tab> tabs = <Tab>[
    Tab(
      child: Text(
        'Dices',
        style: TextStyle(fontSize: 30),
      ),
    ),
    Tab(
      child: Text(
        'History',
        style: TextStyle(fontSize: 30),
      ),
    ),
  ];

  @override
  void dispose() {
    interstitialAd?.dispose();
    if (noAds == true) {
      myBanner?.dispose();
      super.dispose();
    }
  }
  @override
  void initState() {
    super.initState();
    noAds = false;
    FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);
    _tabController = TabController(vsync: this, length: tabs.length);
    if (noAds != true) {
      myBanner
        ..load()
        ..show(
          // Positions the banner ad 60 pixels from the bottom of the screen
          anchorType: AnchorType.bottom,
        );
    }

    interstitialAd = myInterstitial()..load();

    videoAd.load(adUnitId: AD_REWARDED_ID);
    videoAd.listener =
        (RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
      print('rewarded video ad $event');
      if (event == RewardedVideoAdEvent.rewarded) {
        noAds = true;
        Timer(Duration(minutes: rewardAmount), () {
          noAds = false;
        });
      }
      if (event == RewardedVideoAdEvent.closed) {
        videoAd.load(adUnitId: RewardedVideoAd.testAdUnitId);
      }
    };
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: appBarColor,
          iconTheme: IconThemeData(color: iconColor),
          bottom: TabBar(
            controller: _tabController,
            tabs: tabs,
            labelColor: textColor,
            indicatorColor: iconColor,
          ),
        ),
        drawer: Drawer(
            child: Container(
                color: isDarkMode ? Colors.grey[900] : Color(0x35A6A6A8),
                child: ListView(children: <Widget>[
                  SizedBox(
                    height: 50,
                  ),
                  ListTile(
                    title: Text(
                      'DarkMode  /  Light Mode',
                      style: TextStyle(
                        color: textColor,
                        fontWeight: FontWeight.bold,
                        fontSize: 20,
                      ),
                      textAlign: TextAlign.center,
                    ),

                    subtitle: Stack(alignment: Alignment.center, children: [
                      Switch(
                        value: switchValue,
                        onChanged: (val) {
                          setState(() {
                            isDarkMode = val;
                            switchValue = val;
                            bgColor = isDarkMode
                                ? Color(0x2D050401)
                                : Color(0xff03ed19);
                            appBarColor = isDarkMode
                                ? Colors.grey[900]
                                : Color(0xd66a994e);
                            iconColor = isDarkMode
                                ? Color(0xE9F02D3A)
                                : Colors.black;
                            textColor =
                                isDarkMode ? Color(0xE9F02D3A) : Colors.black;
                            cardColor =
                                isDarkMode ? Colors.white10 : Colors.white;
                            buttonColor = isDarkMode
                                ? Colors.grey[900]
                                : Colors.grey[350];
                          });
                        },
                      ),
                    ]),
                  ),
                  SizedBox(
                    height: 20,
                  ),
                  Divider(color: Colors.black,),
                  SizedBox(
                    height: 20,
                  ),
                  Column(children: [
                    ListTile(
                      title: Text(
                        'Watch a video to get 30 minutes of no ads',
                        style: TextStyle(
                            fontSize: 20,
                            color: textColor,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.center,
                      ),
                      onTap: () {
                      },
                    ),

                    FlatButton.icon(
                      icon: Icon(
                          Icons.play_circle_filled,
                          size: 80,
                        ),
                      onPressed: () {
                        videoAd.show();
                      }, label: Text(''),
                    ),
                  ])
                ]))),
        backgroundColor: bgColor,
        body: Container(
          //height: MediaQuery.of(context).size.height - 60,
          margin: EdgeInsets.only(bottom: 50),
          child: TabBarView(controller: _tabController, children: [
            ListView(children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Column(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Dice(
                          icon: D6.dice_6,
                          func: roll6,
                          type: 'D6',
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('       6 faced dice',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                        Dice(
                          icon: NiceIcons.d4,
                          func: roll4,
                          type: 'D4',
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('       4 faced dice',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                        Dice(
                          icon: NiceIcons.d20,
                          func: roll20,
                          type: 'D20',
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('       20 faced dice',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                        Dice(
                          icon: NiceIcons.d10,
                          func: roll10,
                          type: 'D10',
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('          10 faced dice',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                        Dice(
                          type: 'D8',
                          func: roll8,
                          icon: D8.dice_eight_faces_eight,
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('          8 faced dice',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                        Dice(
                          func: cluedo,
                          icon: cluedoIcon,
                          type: 'Cluedo',
                        ),
                        SizedBox(
                          height: 20.0,
                        ),
                        Text('          Cluedo dices',
                            style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: isDarkMode ? Colors.white : Colors.black)),
                        SizedBox(
                          height: 20.0,
                        ),
                      ]),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    crossAxisAlignment: CrossAxisAlignment.end,
                    children: <Widget>[
                      Dice(
                        icon: Skulls.monetization_on,
                        func: flipACoin,
                        type: 'Coin Flip',
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('Flip a coin              ',
                          style: TextStyle(
                              fontWeight: FontWeight.bold,
                              color: isDarkMode ? Colors.white : Colors.black)),
                      SizedBox(
                        height: 20.0,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          FlatButton.icon(
                            onPressed: () {
                              Navigator.pushNamed(context, '/xfaced',
                                  arguments: {
                                    'isDarkMode': isDarkMode,
                                  });
                            },
                            icon: Icon(
                              NiceIcons.xfaced,
                              size: 120,
                              color: iconColor,
                            ),
                            label: Text(''),
                          ),
                        ],
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('X faced dice            ',
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                            color: isDarkMode ? Colors.white : Colors.black,
                          )),
                      SizedBox(
                        height: 20.0,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          FlatButton.icon(
                            onPressed: () {
                              Navigator.pushNamed(context, '/deathroll',
                                  arguments: {
                                    'isDarkMode': isDarkMode,
                                  });
                            },
                            icon: Icon(
                              Skulls.skull,
                              size: 120,
                              color: iconColor,
                            ),
                            label: Text(''),
                          ),
                        ],
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('Roll to death!            ',
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                            color: isDarkMode ? Colors.white : Colors.black,
                          )),
                      SizedBox(
                        height: 20.0,
                      ),
                      Dice(
                        type: 'D12',
                        func: roll12,
                        icon: NiceIcons.d12,
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('12 faced dice           ',
                          style: TextStyle(
                              fontWeight: FontWeight.bold,
                              color: isDarkMode ? Colors.white : Colors.black)),
                      SizedBox(
                        height: 20.0,
                      ),
                      Dice(
                        type: 'Monopoly Speedy',
                        image: Image.asset(
                          'images/pngbarn.png',
                          scale: 4,
                        ),
                        func: speedy,
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('Monopoly Dices + speedy',
                          style: TextStyle(
                              fontWeight: FontWeight.bold,
                              color: isDarkMode ? Colors.white : Colors.black)),
                      SizedBox(
                        height: 20.0,
                      ),
                      Dice(
                        type: 'D%',
                        icon: Percent.percent,
                        func: rollPercent,
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      Text('          Percent dice            ',
                          style: TextStyle(
                              fontWeight: FontWeight.bold,
                              color: isDarkMode ? Colors.white : Colors.black)),
                      SizedBox(
                        height: 20.0,
                      ),
                    ],
                  )
                ],
              ),
            ]),
            History()
          ]),
        ));
  }
导入'dart:async';
导入“package:dices_应用程序/图标/d6_图标.dart”;
导入“package:dices_应用程序/图标/d8_图标.dart”;
导入“包:骰子应用程序/图标/百分比图标.dart”;
导入“包:firebase_admob/firebase_admob.dart”;
进口“包装:颤振/cupertino.dart”;
进口“包装:颤振/材料.省道”;
导入“package:flatter/widgets.dart”;
导入“icons/dices_icons.dart”;
导入“functions.dart”;
导入“icons/skulls_icons.dart”;
导入“icons/nice_icons_icons.dart”;
导入“history.dart”;
输入“骰子飞镖”;
导入“dart:io”;
导入“包:firebase_admob/firebase_admob.dart”;
导入“包:firebase_core/firebase_core.dart”;
字符串AD__ID='ca-app-pub-3940256099942544/5224354917';
字符串AD_BANNER_ID='ca-app-pub-6798357699412375/6371632425';
字符串AD_interstitual_ID='ca-app-pub-3940256099942544/1033173712';
字符串APP_ID='ca-APP-pub-6798357699412375~3611228404';
RewardedVideoAd=RewardedVideoAd.instance;
间质体间质体;
BannerAd myBanner=BannerAd(
adUnitId:BannerAd.testAdUnitId,
大小:AdSize.smartBanner,
侦听器:(事件)=>('banner event是$event'),
targetingInfo:targetingInfo
);
间质性肌间质(){
返回间隙翼(
成人型:间质型,
targetingInfo:targetingInfo,
侦听器:(MobileAdEvent事件){
如果(事件==MobileAdEvent.failedToLoad){
填隙体..加载();
}else if(事件==MobileAdEvent.closed){
间质AD=我的间质()…负荷();
}
},
);
}
颜色bgColor=isDarkMode?颜色(0x2D050401):颜色(0xff03ed19);
Color appBarColor=isDarkMode?颜色.灰色[900]:颜色(0xd66a994e);
颜色iconColor=isDarkMode?颜色(0xE9F02D3A):Colors.black;
Color textColor=isDarkMode?颜色(0xE9F02D3A):Colors.black;
彩色卡片颜色=ISDARK模式?Colors.white10:Colors.white;
颜色按钮颜色=isDarkMode?颜色.灰色[900]:颜色.灰色[350];
MobileAdTargetingInfo targetingInfo=MobileAdTargetingInfo(
关键词:[“游戏”、“骰子”、“随机”、“棋盘游戏”],
孩子:错,
);
类Home扩展了StatefulWidget{
@凌驾
_HomeState createState()=>\u HomeState();
}
布尔诺兹=假;
bool switchValue=true;
bool-isDarkMode=true;
类_HomeState使用SingleTickerProviderStateMixin扩展状态{
TabController\u TabController;
列表选项卡=[
标签(
子:文本(
“骰子”,
样式:TextStyle(字体大小:30),
),
),
标签(
子:文本(
"历史",,
样式:TextStyle(字体大小:30),
),
),
];
@凌驾
无效处置(){
填隙物?.dispose();
如果(noAds==true){
myBanner?.dispose();
super.dispose();
}
}
@凌驾
void initState(){
super.initState();
noAds=假;
FirebaseAdMob.instance.initialize(appId:FirebaseAdMob.testAppId);
_tabController=tabController(vsync:this,length:tabs.length);
如果(noAds!=真){
我的旗帜
…加载()
…展示(
//将横幅广告放置在距屏幕底部60像素的位置
anchorType:anchorType.bottom,
);
}
间质AD=我的间质()…负荷();
视频广告加载(adUnitId:AD\u ID);
电视广告听众=
(RewardedVideoAdEvent事件,{String rewardType,int rewardAmount}){
打印(“奖励视频广告$event”);
如果(事件==RewardedVideoAdEvent.Pawarded){
noAds=正确;
计时器(持续时间(分钟:奖励金额),(){
noAds=假;
});
}
如果(事件==RewardedVideoAdEvent.closed){
videoAd.load(adUnitId:RewardedVideoAd.testAdUnitId);
}
};
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
背景颜色:appBarColor,
iconTheme:IconThemeData(颜色:iconColor),
底部:选项卡栏(
控制器:\ tab控制器,
标签:标签,
labelColor:textColor,
指示颜色:iconColor,
),
),
抽屉(
子:容器(
颜色:isDarkMode?颜色.灰色[900]:颜色(0x35A6A8),
子项:列表视图(子项:[
大小盒子(
身高:50,
),
列表砖(
标题:正文(
“暗模式/灯光模式”,
样式:TextStyle(
颜色:textColor,
fontWeight:fontWeight.bold,
尺寸:20,
),
textAlign:textAlign.center,
),
副标题:堆栈(对齐方式:alignment.center,子对象:[
开关(
值:开关值,
一旦更改:(val){
设置状态(){
isDarkMode=val;
开关值=val;
bgColor=isdark模式
?颜色(0x2D050401)
:颜色(0xff03ed19);
appBarColor=isDarkMode
?颜色。灰色[900]
:颜色(0xd66a994e);
iconColor=ISDARK模式
?颜色(0xE9F02D3A)
:颜色。黑色;
文本颜色=
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.ongar.dices_app">
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Dice Mania"
        android:icon="@mipmap/dice_fire">
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-6798357699412375~3611228404"/>

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->

            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>
<style name="YourStyleName" parent="parentStyle">
    <item name="android:windowActionBar">false</item>
    <item name="android:windowNoTitle">true</item>
</style>