当我导出Excel时,某些列值完全为空白。 我检查发现,在前导属性中,我使用了多个字段值,该值显示为一列中的组合。如果我给一个字段值,那么数据就来了。
我曾经这样使用
FutureBuilder(
future: Firestore.instance.collection("latest").orderBy("date", descending: true)
.getDocuments(source: Source.serverAndCache ),
builder: (context, snapshot) {
if (!snapshot.hasData || snapshot.data.documents.length == null) {
return Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.white),
),
);
} else if(snapshot.data.documents.length == 0) {
return Center(
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Text(
"Sorry but there's no wallpapers for this character yet!",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w300,
),
textAlign: TextAlign.center,
),
)
);
} else {
return GridView.builder(
itemCount: snapshot.data.documents.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: screenHeight / screenWidth * 0.4,
mainAxisSpacing: 1.0,
crossAxisSpacing: 1.0,
),
itemBuilder: (context, index) {
return _buildGrid(snapshot.data.documents[index], index);
}
);
}
}
)
Widget _buildGrid(DocumentSnapshot document, int index) {
print(document.metadata.isFromCache ? "NOT FROM NETWORK" : "FROM NETWORK");
return GestureDetector(
child: Hero(
tag: index,
child: CachedNetworkImage(
imageUrl: document['url'],
errorWidget: (context, url, error) => Icon(Icons.error_outline),
fit: BoxFit.fill,
filterQuality: FilterQuality.low,
),
),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DetailScreen(document['url']))
);
},
);
}
表中的数据很好。但是当导出到excel时,此列值被空白。
有人可以建议我一些答案吗?