dimanche 27 décembre 2020

How can I show PDF data from MYSQL database as a JSON response in my Flutter app?

After post a ID, I get api response. This response provide me pdf data. I can show pdf data in my console successfully. It also come in my app. But when I going to open it, My app display color change first black and then white. And nothing to show. But it take space. And My app display is below. Nothing is show. But it take space...: enter image description here

Here is my API call code:

**getDataPDF() async {
    var url = "https://www.bdtender.com/api/tend_img_call.php";
    var response = await http.post(url, body: {"tendercode": widget.masrafi});
    var dir = await getApplicationDocumentsDirectory();
    File file = new File("${dir.path}/data.pdf");
    [enter image description here][2]
    file.writeAsBytesSync(response.bodyBytes, flush: true);
    print('From PDF View: ${file.path}');
    return file.path;
    
  }



 @override
  void initState() {
    getData();
    getDataPDF().then((value) {
      setState(() {
        _localFile = value;
      });
    });
  }

Column(
          children: [
            _localFile != null
                ? PDFView(
                    filePath: _localFile,
                  )
                : Center(child: CircularProgressIndicator()),
          ],
        )**

I also try it in ListView, SizeBoz, Flexible widget. But result is not change. Is there any way to show pdf json data in flutter??




Aucun commentaire:

Enregistrer un commentaire