@@ -57,7 +57,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "connectivity", | "name": "connectivity", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.9+3", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/connectivity-0.4.9+5", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -93,7 +93,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "device_info", | "name": "device_info", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/device_info-0.4.2+8", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/device_info-0.4.2+9", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -237,7 +237,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "image_picker", | "name": "image_picker", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.7+11", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.7+12", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -297,7 +297,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "path_provider", | "name": "path_provider", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.18", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.21", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -405,7 +405,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "shared_preferences", | "name": "shared_preferences", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.12", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.12+2", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -537,7 +537,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "url_launcher", | "name": "url_launcher", | ||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.7.2", | |||||
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.7.4", | |||||
"packageUri": "lib/", | "packageUri": "lib/", | ||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
}, | }, | ||||
@@ -620,7 +620,7 @@ | |||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-10-15T08:11:29.784634Z", | |||||
"generated": "2020-10-15T08:14:11.281280Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.8.2" | "generatorVersion": "2.8.2" | ||||
} | } |
@@ -0,0 +1,32 @@ | |||||
import 'package:flutter/material.dart'; | |||||
import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart'; | |||||
// loading弹窗 | |||||
class Loading { | |||||
static LoadingDialog _dialog; | |||||
static BuildContext _context; | |||||
static Future show( | |||||
BuildContext context, { | |||||
String msg, | |||||
}) async { | |||||
dismiss(); | |||||
_context = context; | |||||
_dialog = LoadingDialog( | |||||
message: msg, | |||||
); | |||||
var result = await showDialog(context: context, child: _dialog); | |||||
_context = null; | |||||
_dialog = null; | |||||
return result; | |||||
} | |||||
static dismiss() { | |||||
if (_dialog != null && _context != null) { | |||||
Navigator.pop(_context); | |||||
} | |||||
_context = null; | |||||
_dialog = null; | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
import 'package:flutter/material.dart'; | |||||
import 'package:loading_indicator/loading_indicator.dart'; | |||||
class LoadingDialog extends StatelessWidget { | |||||
final String message; | |||||
const LoadingDialog({Key key, this.message}) : super(key: key); | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return GestureDetector( | |||||
onTap: () { | |||||
Navigator.pop(context); | |||||
}, | |||||
child: Scaffold( | |||||
backgroundColor: Colors.transparent, | |||||
body: Center( | |||||
child: UnconstrainedBox( | |||||
child: Container( | |||||
padding: EdgeInsets.all(10), | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.center, | |||||
mainAxisAlignment: MainAxisAlignment.center, | |||||
children: <Widget>[ | |||||
Container( | |||||
width: 80, | |||||
height: 80, | |||||
child: LoadingIndicator( | |||||
indicatorType: Indicator.ballSpinFadeLoader, | |||||
color: Colors.redAccent, | |||||
), | |||||
), | |||||
message == null || message == '' | |||||
? Container() | |||||
: Container( | |||||
margin: EdgeInsets.only(top: 8), | |||||
child: Text( | |||||
message, | |||||
style: TextStyle(fontSize: 14), | |||||
), | |||||
), | |||||
], | |||||
), | |||||
), | |||||
), | |||||
), | |||||
), | |||||
); | |||||
} | |||||
} |
@@ -10,6 +10,7 @@ import 'package:flutter/services.dart'; | |||||
import 'package:fluttertoast/fluttertoast.dart'; | import 'package:fluttertoast/fluttertoast.dart'; | ||||
import 'package:permission_handler/permission_handler.dart'; | import 'package:permission_handler/permission_handler.dart'; | ||||
import 'package:save_image/save_image.dart'; | import 'package:save_image/save_image.dart'; | ||||
import 'package:zhiying_base_widget/dialog/loading/loading.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_editor.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_editor.dart'; | ||||
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goods_share_image_model.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_image/goods_share_image_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/goods_share_page/models/goods_share_poster_model.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/models/goods_share_poster_model.dart'; | ||||
@@ -250,6 +251,8 @@ class _GoodsShareImageState extends State<GoodsShareImage> | |||||
} | } | ||||
void _saveImages() async { | void _saveImages() async { | ||||
Loading.show(context, msg: '正在保存'); | |||||
await _updateModel(); | await _updateModel(); | ||||
List<String> images = List(); | List<String> images = List(); | ||||
@@ -267,6 +270,7 @@ class _GoodsShareImageState extends State<GoodsShareImage> | |||||
if ((_shareModel.image == null || _shareModel.image.length == 0) && | if ((_shareModel.image == null || _shareModel.image.length == 0) && | ||||
_shareModel.poster == null) { | _shareModel.poster == null) { | ||||
Fluttertoast.showToast(msg: '请选择要保存的图片'); | Fluttertoast.showToast(msg: '请选择要保存的图片'); | ||||
Loading.dismiss(); | |||||
return; | return; | ||||
} | } | ||||
@@ -277,6 +281,7 @@ class _GoodsShareImageState extends State<GoodsShareImage> | |||||
} | } | ||||
if (status == PermissionStatus.denied) { | if (status == PermissionStatus.denied) { | ||||
Fluttertoast.showToast(msg: '暂无权限,保存失败'); | Fluttertoast.showToast(msg: '暂无权限,保存失败'); | ||||
Loading.dismiss(); | |||||
return null; | return null; | ||||
} | } | ||||
@@ -287,6 +292,7 @@ class _GoodsShareImageState extends State<GoodsShareImage> | |||||
} | } | ||||
if (status == PermissionStatus.denied) { | if (status == PermissionStatus.denied) { | ||||
Fluttertoast.showToast(msg: '暂无权限,分享失败'); | Fluttertoast.showToast(msg: '暂无权限,分享失败'); | ||||
Loading.dismiss(); | |||||
return null; | return null; | ||||
} | } | ||||
@@ -304,6 +310,8 @@ class _GoodsShareImageState extends State<GoodsShareImage> | |||||
Fluttertoast.showToast(msg: '保存成功'); | Fluttertoast.showToast(msg: '保存成功'); | ||||
else | else | ||||
Fluttertoast.showToast(msg: '保存失败'); | Fluttertoast.showToast(msg: '保存失败'); | ||||
Loading.dismiss(); | |||||
} | } | ||||
Future<ShareDataModel> _updateModel() async { | Future<ShareDataModel> _updateModel() async { | ||||
@@ -7,6 +7,7 @@ import 'package:fluttertoast/fluttertoast.dart'; | |||||
import 'package:image_cropper/image_cropper.dart'; | import 'package:image_cropper/image_cropper.dart'; | ||||
import 'package:image_picker/image_picker.dart'; | import 'package:image_picker/image_picker.dart'; | ||||
import 'package:intl/intl.dart'; | import 'package:intl/intl.dart'; | ||||
import 'package:zhiying_base_widget/dialog/loading/loading.dart'; | |||||
import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_bloc.dart'; | import 'package:zhiying_base_widget/pages/mine_detail_page/mine_detail_bloc.dart'; | ||||
import 'package:zhiying_base_widget/pages/mine_detail_page/models/mine_detail_model.dart'; | import 'package:zhiying_base_widget/pages/mine_detail_page/models/mine_detail_model.dart'; | ||||
import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart'; | import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart'; | ||||
@@ -94,6 +95,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { | |||||
stream: _bloc.outData, | stream: _bloc.outData, | ||||
builder: (BuildContext context, AsyncSnapshot snapshot) { | builder: (BuildContext context, AsyncSnapshot snapshot) { | ||||
MineDetailModel user = snapshot.data; | MineDetailModel user = snapshot.data; | ||||
Loading.dismiss(); | |||||
if (user == null) { | if (user == null) { | ||||
return Container(); | return Container(); | ||||
} | } | ||||
@@ -308,7 +310,11 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { | |||||
lockAspectRatio: true), | lockAspectRatio: true), | ||||
iosUiSettings: IOSUiSettings( | iosUiSettings: IOSUiSettings( | ||||
minimumAspectRatio: 1.0, aspectRatioLockEnabled: true)); | minimumAspectRatio: 1.0, aspectRatioLockEnabled: true)); | ||||
if (cropperFile == null) { | |||||
return; | |||||
} | |||||
File resultFile = await EncodeUtil.compressImage(cropperFile, 800); | File resultFile = await EncodeUtil.compressImage(cropperFile, 800); | ||||
Loading.show(context); | |||||
_bloc.uploadAvatar(resultFile); | _bloc.uploadAvatar(resultFile); | ||||
} | } | ||||
} | } | ||||
@@ -4,6 +4,7 @@ import 'package:event_bus/event_bus.dart'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:provider/provider.dart'; | import 'package:provider/provider.dart'; | ||||
import 'package:zhiying_base_widget/dialog/loading/loading.dart'; | |||||
import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart'; | import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart'; | ||||
import 'package:zhiying_base_widget/widgets/home/home_goods/bloc/home_goods_bloc.dart'; | import 'package:zhiying_base_widget/widgets/home/home_goods/bloc/home_goods_bloc.dart'; | ||||
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; | import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; | ||||
@@ -64,6 +65,7 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { | |||||
widget.eventBus.on<HomeGoodsHeaderEvent>().listen((data) { | widget.eventBus.on<HomeGoodsHeaderEvent>().listen((data) { | ||||
_provider = data.provider; | _provider = data.provider; | ||||
_bloc.loadMore(_provider); | _bloc.loadMore(_provider); | ||||
Loading.show(context); | |||||
}); | }); | ||||
super.initState(); | super.initState(); | ||||
@@ -90,7 +92,7 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { | |||||
// child: HomeGoodsSkeleton(), | // child: HomeGoodsSkeleton(), | ||||
// ); | // ); | ||||
// } | // } | ||||
Loading.dismiss(); | |||||
List<HomeGoodsModel> goods = snapshot.data; | List<HomeGoodsModel> goods = snapshot.data; | ||||
int column = int.tryParse(_style.listColumn); | int column = int.tryParse(_style.listColumn); | ||||
column = column <= 0 ? 1 : column; | column = column <= 0 ? 1 : column; | ||||
@@ -9,6 +9,7 @@ import 'package:path_provider/path_provider.dart'; | |||||
import 'package:permission_handler/permission_handler.dart'; | import 'package:permission_handler/permission_handler.dart'; | ||||
import 'package:share_extend/share_extend.dart'; | import 'package:share_extend/share_extend.dart'; | ||||
import 'package:sharesdk_plugin/sharesdk_plugin.dart'; | import 'package:sharesdk_plugin/sharesdk_plugin.dart'; | ||||
import 'package:zhiying_base_widget/dialog/loading/loading.dart'; | |||||
import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.dart'; | import 'package:zhiying_base_widget/utils/image_download_util/image_download_util.dart'; | ||||
import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart'; | import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart'; | ||||
import 'package:zhiying_base_widget/widgets/share/models/share_icon_model.dart'; | import 'package:zhiying_base_widget/widgets/share/models/share_icon_model.dart'; | ||||
@@ -66,10 +67,10 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { | |||||
void initState() { | void initState() { | ||||
NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', | NetUtil.request('/api/v1/mod/${widget.skipIdentifier}', | ||||
method: NetMethod.GET, onCache: (data) { | method: NetMethod.GET, onCache: (data) { | ||||
_parseData(data); | |||||
}, onSuccess: (data) { | |||||
_parseData(data); | |||||
}, onError: (err) {}); | |||||
_parseData(data); | |||||
}, onSuccess: (data) { | |||||
_parseData(data); | |||||
}, onError: (err) {}); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@@ -121,7 +122,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { | |||||
), | ), | ||||
Container( | Container( | ||||
margin: | margin: | ||||
EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), | |||||
EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), | |||||
child: _createIcons(), | child: _createIcons(), | ||||
), | ), | ||||
GestureDetector( | GestureDetector( | ||||
@@ -228,6 +229,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { | |||||
return; | return; | ||||
} | } | ||||
Loading.show(context); | |||||
SSDKMap params; | SSDKMap params; | ||||
if (widget.model.poster != null) { | if (widget.model.poster != null) { | ||||
String path = await _savePoster(); | String path = await _savePoster(); | ||||
@@ -273,6 +275,7 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { | |||||
Fluttertoast.showToast(msg: '取消分享'); | Fluttertoast.showToast(msg: '取消分享'); | ||||
} | } | ||||
Logger.debug('${state}, ${error.rawData}'); | Logger.debug('${state}, ${error.rawData}'); | ||||
Loading.dismiss(); | |||||
}); | }); | ||||
} | } | ||||
@@ -337,9 +340,11 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { | |||||
paths.add(path); | paths.add(path); | ||||
} | } | ||||
Loading.show(context); | |||||
List<String> downPaths = | List<String> downPaths = | ||||
await ImageDownloadUtil.download(widget.model.image); | |||||
await ImageDownloadUtil.download(widget.model.image); | |||||
paths.addAll(downPaths); | paths.addAll(downPaths); | ||||
ShareExtend.shareMultiple(paths, "image", subject: ""); | ShareExtend.shareMultiple(paths, "image", subject: ""); | ||||
Loading.dismiss(); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,3 @@ | |||||
library zhiying_base_widget; | |||||
export 'dialog/loading/loading.dart'; |