使用 flutter 和这个插件(https://pub.dartlang.org/packages/firebase_admob),
如何检查奖励视频是否已加载?
我收到此异常:
PlatformException(ad_not_loaded, show failed for rewarded video, no ad was loaded, null)
Run Code Online (Sandbox Code Playgroud)
但我无法捕捉它。
谢谢你。
在flutter中我需要当我调用setstate时,它只重建一个小部件
我将两个孩子放在一堆中,我需要当按下按钮时,只重建第二个孩子。
bool popup = false;
Scaffold(
appBar: AppBar(
title: const Text('TEST'),
actions: <Widget>[
IconButton( // + BUTTON
icon: Icon(Icons.add),
onPressed: () {
setState(() {
popup = true;
});
},
),
IconButton( // - BUTTON
icon: Icon(Icons.remove),
onPressed: () {
setState(() {
popup = false;
});
),
],
),
body: SafeArea(
child: Stack(
children: <Widget>[
Container( // FIRST WIDGET
key: ValueKey(1),
child: Text("Random - "+new Random().nextInt(20).toString())
),
popup ? Center(child: Text("abc")) : Text("") , // SECOND WIDGET
],
),
), …Run Code Online (Sandbox Code Playgroud) 我有一个颤振聊天,当用户到达列表末尾时显示最新消息。
这是通过在 firestore 上设置一个侦听器来完成的,限制为 10 条消息(限制(10)),当我到达消息列表的末尾时,我将流的限制增加 10。
// LISTENER QUERY MESSAGES
limitdocuments = 10;
StreamBuilder(
stream: Firestore.instance
.collection('groups')
.document(groupId)
.collection("messages")
.orderBy('sentTime', descending: true)
.limit(limitdocuments)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(themeColor)));
} else {
return ListView.builder(
itemBuilder: (context, index) {
buildItem(index, snapshot.data.documents[index],true)
},
itemCount: snapshot.data.documents.length,
reverse: true,
controller: listScrollController,
);
}
},
),
Run Code Online (Sandbox Code Playgroud)
// END OF THE LIST, INCREASE THE LIMIT BY 10
if(listScrollController.position.atEdge){
if(listScrollController.position.pixels == 0){
setState(() {
limitdocuments= limitdocuments+ 10;
});
} …Run Code Online (Sandbox Code Playgroud)