Merge branch 'master' of http://159.75.73.143:8080/laiiihz/akuCommunity
commit
7ee0ed656d
@ -1,3 +1,3 @@
|
||||
{
|
||||
"flutterSdkVersion": "2.0.0"
|
||||
"flutterSdkVersion": "stable"
|
||||
}
|
@ -0,0 +1 @@
|
||||
*.arb diff
|
@ -0,0 +1,4 @@
|
||||
arb-dir: lib/l10n
|
||||
template-arb-file: app_zh.arb
|
||||
output-localization-file: app_localizations.dart
|
||||
output-class: S
|
@ -1,3 +1,3 @@
|
||||
class AppValues {
|
||||
static const String plotName = '人才公寓智慧小区';
|
||||
}
|
||||
// class AppValues {
|
||||
// static const String plotName = '人才公寓智慧小区';
|
||||
// }
|
||||
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"appName": "智慧社区",
|
||||
"@appName":{
|
||||
"description": "应用名称"
|
||||
},
|
||||
"tempPlotName": "人才公寓智慧小区",
|
||||
"@tempPlotName":{
|
||||
"description": "临时使用的小区名称"
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import 'package:akuCommunity/constants/api.dart';
|
||||
|
||||
class BeeDownloadView extends StatefulWidget {
|
||||
final String file;
|
||||
BeeDownloadView({Key key, this.file}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BeeDownloadViewState createState() => _BeeDownloadViewState();
|
||||
}
|
||||
|
||||
class _BeeDownloadViewState extends State<BeeDownloadView> {
|
||||
Dio dio = Dio();
|
||||
double progress;
|
||||
Future download() async {
|
||||
Directory dir = await getApplicationDocumentsDirectory();
|
||||
Directory docPath = Directory('${dir.path}/docs');
|
||||
if (!await (docPath.exists())) {
|
||||
await docPath.create();
|
||||
}
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
await dio.download(
|
||||
API.file(widget.file),
|
||||
'${docPath.path}/${widget.file.split('/').last}',
|
||||
onReceiveProgress: (start, all) {
|
||||
setState(() {
|
||||
progress = start / all;
|
||||
});
|
||||
print('$start,$all');
|
||||
},
|
||||
);
|
||||
Get.back(result: '${docPath.path}/${widget.file.split('/').last}');
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
download();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
alignment: Alignment.center,
|
||||
child: CircularProgressIndicator(value: progress),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue