我尝试使用 flutter 下载器包从 firebase 存储下载 pdf 文件。但是下载总是显示失败,不知道是什么原因。
这是我试过的代码。请提出一些解决方案。提前致谢。
void _startDownload(String link) async
{
var dir = await getExternalStorageDirectory();
try{
final taskId = await FlutterDownloader.enqueue(
url: link,
savedDir: dir.path,
fileName:"sampe.docx",
showNotification: true, // show download progress in status bar(forAndroid)
openFileFromNotification: true, // click on notification to open downloaded file (for Android)
);
debugPrint(taskId);
// FlutterDownloader.retry(taskId: taskId);
}
catch(e){
print(e);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误。
W/System.err(18012): java.io.FileNotFoundException: /storage/emulated/0/sampe.docx (Permission denied)
W/System.err(18012): at java.io.FileOutputStream.open(Native Method)
W/System.err(18012): at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
W/System.err(18012): at java.io.FileOutputStream.<init>(FileOutputStream.java:140)
W/System.err(18012): at vn.hunghd.flutterdownloader.DownloadWorker.downloadFile(DownloadWorker.java:190)
W/System.err(18012): …Run Code Online (Sandbox Code Playgroud) 如何在颤动的底片内实现滑块。我试过了,但滑块没有移动。但是如果我把滑块放在一个新的脚手架上,它就起作用了。帮我。提前致谢。
这是我的代码。
new InkWell(
onTap: () {
// fire_ac_on_1();
},
onDoubleTap:(){
_showModalSheet_ac();
}
onLongPress: () {
selectTime(context);
},
child: new IconButton(
icon: new Image.asset('images/ac.png',
color: ac_on_state == true ? Colors
.green : Colors.redAccent),
onPressed: () {
fire_ac_on();
},
iconSize: 80.0,
),
),
Run Code Online (Sandbox Code Playgroud)
// ModalBottom Sheet void _showModalSheet_ac(){
double height = MediaQuery.of(context).size.height;
//print(height);
showModalBottomSheet(context: context, builder: (builder){
return new Container(
height: height - 200.0,
child: new Center(
child: new Column(
children: <Widget>[
new Container(
child: new Slider(
value: slider_value,
onChanged: onchanged), …Run Code Online (Sandbox Code Playgroud)