我正在开发应用程序,我想将Firebase存储中的pdf加载到Flutter应用程序中,我对此进行了大量搜索,但找不到任何可以帮助我的东西 例如,当我单击以选择cour或TD时,我想在图像中显示该图像。 image
class Electro extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Electronique Analogique'),
backgroundColor: Colors.red,
actions: <Widget>[
IconButton(icon: Icon(Icons.search), onPressed: () {}),
],
),
body: GridView.count(
primary: false,
padding: const EdgeInsets.all(4),
crossAxisSpacing: 4,
mainAxisSpacing: 4,
crossAxisCount: 2,
children: [
GestureDetector(
onTap: () {
print("clicked"); //we put the function of pdf
},
child: Container(
padding: const EdgeInsets.all(20),
child: Center(
child: const Text(
'Cour',
style: TextStyle(
color: Color(0xfff2f2f2),
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 20,
),
),
),
color: Colors.red,
),
),
Container(
padding: const EdgeInsets.all(20),
child: Center(
child: const Text(
'TD',
style: TextStyle(
color: Color(0xfff2f2f2),
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 20,
),
),
),
color: Colors.indigo,
),
Container(
padding: const EdgeInsets.all(20),
child: Center(
child: const Text(
'Correction TD',
style: TextStyle(
color: Color(0xfff2f2f2),
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 20,
),
),
),
color: Colors.teal,
),
Container(
padding: const EdgeInsets.all(20),
child: Center(
child: const Text(
'Exam',
style: TextStyle(
color: Color(0xfff2f2f2),
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 20,
),
),
),
color: Colors.teal,
),
],
),
);
}
}
答案 0 :(得分:0)
使用flutter_pdf_viewer插件从URL加载pdf文件
PDFDocument doc = await PDFDocument.fromURL('YOUR PDF URL');