请问,我不知道该怎么办,突然间,顶部的这个标签上出现了实际上是我的应用程序标题的文字。 我尝试在Internet上搜索并出现堆栈溢出,但是除了其他问题外,我什么都没找到,但没有解决。 这是我的主文件,但我实际上认为这是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()
]),
));
}
AndroidManifest.xml:
<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>
答案 0 :(得分:2)
您应该在XML样式文件中定义以下内容:
<style name="YourStyleName" parent="parentStyle">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
然后重新启动,它应该可以工作。