Flutter

uploaded files to Azure are corrupted when using dio

谁说我不能喝 提交于 2021-02-08 10:13:17
问题 I'm trying to upload a file from my phone to azure blob storage as a BlockBlob with a SAS. I can get the file to upload, but it can't be opened once downloaded. The file gets corrupted somehow. I thought this was a content-type problem, but I have tried several different approaches to changing to content-type. Nothing has worked so far. My code: FileInfo _fileInfo = await filePicker(); // get the file path and file name // my getUploadInfo fires a call to my backend to get a SAS. // I know

Flutter file upload with Dio empty in Laravel

 ̄綄美尐妖づ 提交于 2021-02-08 10:12:36
问题 I'm unable to upload files using the Dio plugin and I can not figure out where's the problem. In Laravel the request is always empty. What have I done so far: Double check if the file path really exists using existsSync() function Changed the Content-Type to application/x-www-form-urlencoded Validated if the file is actually being uploaded - seems yes (?) This is my flutter code: File myFile = new File('/storage/emulated/0/Download/demo.docx'); FormData form = new FormData.from({ 'title':

Flutter WebView blob pdf download

不打扰是莪最后的温柔 提交于 2021-02-08 09:06:49
问题 I am trying to download a file from a website using flutter, I first used evaluateJavaScript and changed some values before clicking a generate button wich is supposed to download an appropriate pdf file to the phone. Here is my code : InAppWebView( initialUrl: '...', initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( debuggingEnabled: true, useOnDownloadStart: true, javaScriptEnabled: true, ), ), //javascriptMode: JavascriptMode.unrestricted, onWebViewCreated:

How to save my current state by using json or something else in Flutter

陌路散爱 提交于 2021-02-08 08:52:08
问题 I want to know how to save my current state by modifying the existing JSON file. but I can't find a way to saving..... So I want to ask you about that. The size of the JSON file is not so big. So I considered total - loading and total - saving when the loading and saving state is called. but I think it is not efficient and unstable... So can I get some help? 回答1: please use this package https://pub.dev/packages/shared_preferences Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android

Flutter qrImage convert to Image

你。 提交于 2021-02-08 08:06:37
问题 I'm using qr_flutter to create QrImage. It's ok but I would like to convert QrImage into image in order to create a PDF file to print on the printer. Please kindly help! QrImage( data: qrString, size: 300.0, version: 10, backgroundColor: Colors.white, ), 回答1: Use a RepaintBoundary widget with a key to export the widget to a a b64 string which then you can export as an image. Example: Future<Uint8List> _getWidgetImage() async { try { RenderRepaintBoundary boundary = _renderObjectKey

Flutter qrImage convert to Image

拜拜、爱过 提交于 2021-02-08 08:04:46
问题 I'm using qr_flutter to create QrImage. It's ok but I would like to convert QrImage into image in order to create a PDF file to print on the printer. Please kindly help! QrImage( data: qrString, size: 300.0, version: 10, backgroundColor: Colors.white, ), 回答1: Use a RepaintBoundary widget with a key to export the widget to a a b64 string which then you can export as an image. Example: Future<Uint8List> _getWidgetImage() async { try { RenderRepaintBoundary boundary = _renderObjectKey

Flutter URL Launcher Google Maps

爷,独闯天下 提交于 2021-02-08 07:59:56
问题 List.dart import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class List extends StatefulWidget { @override ListState createState() { return new ListState(); } } class ListState extends State<List> { static const double lat = 2.813812, long = 101.503413; static const String map_api= "API_KEY"; @override Widget build(BuildContext context) { //method to launch maps void launchMap() async{ const url = "https://maps.google.com/maps/search/?api=$map_api&query=

Flutter : how to conditionally add a widget

喜欢而已 提交于 2021-02-08 07:48:57
问题 I want to add a text widget to the body if no data was return. Otherwise, I want to display the data. However, the following error is returned: flutter: type '_CompactLinkedHashSet<Widget>' is not a subtype of type 'Widget' My Code: body: SafeArea( child: (isLoading) ? Center( child: new CircularProgressIndicator(), ) : Stack( children: <Widget>[ (jobDetail == null && !isLoading) ? noDataFound() : { detailWidget(context, jobDetail), applyWidget(context, jobDetail) } ], ), ), This is my code

Flutter : how to conditionally add a widget

删除回忆录丶 提交于 2021-02-08 07:48:29
问题 I want to add a text widget to the body if no data was return. Otherwise, I want to display the data. However, the following error is returned: flutter: type '_CompactLinkedHashSet<Widget>' is not a subtype of type 'Widget' My Code: body: SafeArea( child: (isLoading) ? Center( child: new CircularProgressIndicator(), ) : Stack( children: <Widget>[ (jobDetail == null && !isLoading) ? noDataFound() : { detailWidget(context, jobDetail), applyWidget(context, jobDetail) } ], ), ), This is my code

Expand DataTable to fill height in Flutter

两盒软妹~` 提交于 2021-02-08 07:25:00
问题 I have a problem with flutter. I need to fill a DataTable in the height of screen. I tried to add the dataTable inside a Flex widget, but I don't get changes. When I set the heigh of the Container, that's work let me a white space at the button of the screen Thank you! and i'm sorry for mi poor english This my code: products.addAll(Product.getExampleList()); var table = Container( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child:SizedBox( child: Column( children: <Widget>