Flutter 如何使用StreamBuilder从pdf中的Firebase存储打印图像
我正在尝试使用widgets库将Firebase存储中的图像打印到pdf中。 所以我有一个这样的代码Flutter 如何使用StreamBuilder从pdf中的Firebase存储打印图像,flutter,google-cloud-firestore,firebase-storage,flutter-widget,Flutter,Google Cloud Firestore,Firebase Storage,Flutter Widget,我正在尝试使用widgets库将Firebase存储中的图像打印到pdf中。 所以我有一个这样的代码 import 'package:pdf/pdf.dart'; import 'package:pdf/widgets.dart' as pw; pdf.addPage(pw.Page( pageFormat: PdfPageFormat.a4, build: (pw.Context context) {
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
pdf.addPage(pw.Page(
pageFormat: PdfPageFormat.a4,
build: (pw.Context context) {
return pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: <pw.Widget>[
pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.center,
children: <pw.Widget>[
pw.Text(
dettagliUtente[0],
style: pw.TextStyle(
fontSize: 13, fontWeight: pw.FontWeight.bold),
),
pw.Text(
dettagliUtente[1],
style: pw.TextStyle(
fontSize: 13,
),
),
pw.Divider(color: PdfColors.blueGrey),
pw.Padding(
padding: pw.EdgeInsets.all(10),
),
pw.Text(
"Referto: ",
style:
pw.TextStyle(fontWeight: pw.FontWeight.bold),
),
pw.Text(
_miosnap['referto'],
style: pw.TextStyle(),
),
pw.Container(
height: 1000.0,
child: pw.StreamBuilder<QuerySnapshot>(
stream: Firestore.instance
.collection('visite')
.where(
"paziente",
isEqualTo: idPaziente,
)
.where("visita",
isEqualTo: dataVisitadbFormat)
.snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot>
snapshot) {
if (snapshot.hasError)
return Text(
'Error: ${snapshot.error}');
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Center(
child:
CircularProgressIndicator());
default:
return GridView.builder(
physics: ScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
itemCount: snapshot
.data.documents.length,
itemBuilder: (context, index) {
DocumentSnapshot ds = snapshot
.data.documents[index];
return Card(
child:
ImageItem(ds['file']),
elevation: 10.0,
shape:
RoundedRectangleBorder(
side: BorderSide(
width: 2,
color: Colors
.blueGrey)),
);
});
}
}),
)
import'package:pdf/pdf.dart';
导入“package:pdf/widgets.dart”作为pw;
pdf.addPage(pw.Page(
页面格式:PdfPageFormat.a4,
构建:(pw.Context){
返回pw.列(
crossAxisAlignment:pw.crossAxisAlignment.start,
儿童:[
pw.柱(
crossAxisAlignment:pw.crossAxisAlignment.center,
儿童:[
文本(
dettagliUtente[0],
样式:pw.TextStyle(
fontSize:13,fontWeight:pw.fontWeight.bold),
),
文本(
dettagliUtente[1],
样式:pw.TextStyle(
尺寸:13,
),
),
分光器(颜色:PdfColors.蓝灰色),
填充物(
填充:所有(10)个边沿,
),
文本(
“参考:”,
风格:
pw.TextStyle(fontwweight:pw.fontwweight.bold),
),
文本(
_miosnap['refereto'],
样式:pw.TextStyle(),
),
容器(
高度:1000.0,
孩子:pw.StreamBuilder(
流:Firestore.instance
.collection('访问')
.在哪里(
“帕齐恩特”,
isEqualTo:idPaziente,
)
.where(“visita”,
isEqualTo:DataVisitabFormat)
.snapshots(),
生成器:(BuildContext上下文,
异步快照
快照){
if(snapshot.hasError)
返回文本(
'错误:${snapshot.Error}';
交换机(快照.连接状态){
案例连接状态。正在等待:
返回中心(
儿童:
循环推进指示器();
违约:
返回GridView.builder(
物理:物理(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
交叉轴计数:2,
),
itemCount:快照
.数据.文件.长度,
itemBuilder:(上下文,索引){
DocumentSnapshot ds=快照
.数据.文件[索引];
回程卡(
儿童:
ImageItem(ds['file']),
标高:10.0,
形状:
圆形三角形边框(
边线(
宽度:2,
颜色:颜色
.蓝灰色,
);
});
}
}),
)
但是在最后一个容器中,我有一个类似StreamBuilder的未定义函数的错误。
我无法在pdf中使用Streambuilder。
如何在从Firestore查询和Firebase存储加载的pdf中打印图像?
非常感谢