【问题标题】:Loading PDF file from Firebase Storage in Flutter App在 Flutter App 中从 Firebase 存储加载 PDF 文件
【发布时间】:2021-01-16 04:37:34
【问题描述】:

我正在开发应用程序,我想将 pdf 从 firebase 存储加载到颤振应用程序我搜索了很多关于此的内容,但我找不到任何可以帮助我的东西 例如,当我单击 cour 或 TD 时,我想要的图像中 .. pdf 显示在屏幕上 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,
          ),
        ],
      ),
    );
  }
}

【问题讨论】:

    标签: firebase flutter firebase-authentication flutter-layout firebase-storage


    【解决方案1】:

    使用 flutter_pdf_viewer 插件从 URL 加载 pdf 文件

    PDFDocument doc = await PDFDocument.fromURL('YOUR PDF URL');
    

    see complete example here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-15
      • 1970-01-01
      • 2020-09-23
      • 2023-03-03
      • 2021-11-06
      • 2019-02-10
      • 2019-04-30
      • 2021-04-28
      相关资源
      最近更新 更多