首页
壁纸
关于
Search
1
IObit Uninstaller 注册码
2,328 阅读
2
与元素类型 "application" 相关联的属性 "tools:replace" 的前缀 "tools" 未绑定。
350 阅读
3
常用的开源API记录
194 阅读
4
flutter 隐藏中间省略号
188 阅读
5
诗集收藏•明:陈曦/高启
152 阅读
默认
开发
随记
工具
游戏
番剧
关于猫的随笔
登录
Search
路过的假面骑士
累计撰写
88
篇文章
累计收到
2
条评论
首页
栏目
默认
开发
随记
工具
游戏
番剧
关于猫的随笔
页面
壁纸
关于
搜索到
88
篇与
的结果
2023-02-28
Flutter 图片保存页面
class ImagesView extends StatefulWidget { final String pic; const ImagesView({Key? key, required this.pic}) : super(key: key); @override State<ImagesView> createState() => _ImagesViewState(); } class _ImagesViewState extends State<ImagesView> { int downproess = 0; @override Widget build(BuildContext context) { return GestureDetector( onTap: () { Get.back(); }, child: comBottonBar( child: Scaffold( appBar: AppBar( leading: comLeading(), actions: [ IconButton( onPressed: () { Get.bottomSheet(Container( height: 120, decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(12), topRight: Radius.circular(12)), color: appColor.main), child: SingleChildScrollView( padding: EdgeInsets.all(12), child: Column( children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ toolsWidget( iconData: CocoIconBold.Arrow_Bottom_3, msg: '保存图片', ontap: () async { Get.back(); try { var response = await dio.get( widget.pic, options: Options( responseType: ResponseType.bytes), onReceiveProgress: (count, total) { setState(() { downproess = ((count / total) * 100) .toInt(); }); }, ); final result = await ImageGallerySaver.saveImage( Uint8List.fromList( response.data), quality: 80, name: widget.pic.replaceAll( 'https://', '')); comToast(msg: '保存成功'); } on DioError catch (e) { comToast(msg: '保存失败'); Exception(e); } vibrate(); }), ], ), const SizedBox(height: 12), TextButton( onPressed: () { Get.back(); }, child: Text( '关闭', style: TextStyle(color: appColor.sub), )) ], ), ), )); }, icon: Icon( CocoIconBold.Menu_1, size: 20, )) ], ), body: Stack(alignment: Alignment.center, children: [ Padding( padding: const EdgeInsets.all(12.0), child: Center( child: PhotoView( loadingBuilder: (context, event) => Center( child: comLoading(), ), imageProvider: CachedNetworkImageProvider(widget.pic), backgroundDecoration: BoxDecoration(), )), ), Visibility( visible: downproess == 0 || downproess == 100 ? false : true, child: CircularProgressIndicator( value: downproess / 100, backgroundColor: appColor.black.withOpacity(0.02), valueColor: AlwaysStoppedAnimation<Color>( (appColor.sub), ), ), ) ]), ), ), ); } }
2023年02月28日
36 阅读
0 评论
0 点赞
2023-02-27
GetX框架的snackbar
if (dateTime == null || DateTime.now().difference(dateTime!) > Duration(seconds: 2)) { dateTime = DateTime.now(); Get.snackbar( '', '', titleText: Text( '再按一次退出', style: TextStyle( color: appColor.white, fontSize: 15, fontWeight: FontWeight.bold), ), messageText: Text( '消息', style: TextStyle( color: appColor.white, fontSize: 12, fontWeight: FontWeight.bold, ), ), snackPosition: SnackPosition.TOP, barBlur: 5, icon: Align( alignment: Alignment.center, child: SvgPicture.asset( myImages.LogoWhite, width: 20, height: 20, ), ), ); return false; } return true; },
2023年02月27日
13 阅读
0 评论
0 点赞
2023-02-20
正则匹配文中是否有加密货币
getTextTokenName({required String text}) { List cryptoNames = []; String str = "$text"; RegExp r = RegExp(r"$[a-zA-Z]*");Iterable matches = r.allMatches(text); for (Match m in matches) {cryptoNames.add(m.group(0)!.substring(1)); print(cryptoNames);} return cryptoNames;}
2023年02月20日
20 阅读
0 评论
0 点赞
2023-02-14
Flutter 使用辅助线
debugPaintSizeEnabled = true; //显示辅助线(开发使用)
2023年02月14日
33 阅读
0 评论
0 点赞
2023-02-10
FLutter 失去键盘输入焦点
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; getKeyboardLosesFocus(BuildContext context) { SystemChannels.textInput.invokeMapMethod('TextInput.hide'); FocusScope.of(context).unfocus(); }
2023年02月10日
25 阅读
0 评论
0 点赞
1
...
5
6
7
...
18