
flutter
Steven_More
这个作者很懒,什么都没留下…
展开
-
flutter 时间显示(刚刚、x分钟前),时间戳转时间封装
// 时间显示,刚刚,x分钟前String messageTime(timeStamp){ // 当前时间 int time = (new DateTime.now().millisecondsSinceEpoch / 1000).round(); // 对比 int _distance = time - timeStamp; if(_distance <= 60){ return '刚刚'; }else if(_distance <= 3600){ .原创 2021-08-02 15:10:22 · 1928 阅读 · 2 评论 -
flutter版本号对比
// 版本号对比Future<bool> compareVersion(curV, reqV) async{ if (curV != null && reqV != null) { //将两个版本号拆成数字 var arr1 = curV.split('.'), arr2 = reqV.split('.'); int arr1_len = arr1.length; int arr2_len = arr2.length; .原创 2021-08-02 14:54:12 · 1197 阅读 · 0 评论 -
Flutter 本地文件操作
// 缓存接口数据Future<dynamic> writeCache(type, data) async { // 获取路径 var _filePath = await getFilePath(type); File _file = new File('$path/appointment'); await _file.writeAsStringSync(data.toString()); return;}// 从文件中读取数据Future<String&..原创 2021-07-13 19:02:30 · 1677 阅读 · 2 评论 -
Flutter 捕获异常
FlutterBugly.postCatchedException((){ false; runZonedGuarded(() { runApp(MyApp()); }, reportError);});void reportError(Object, StackTrace) async { // print('收集到错误: $Object, $StackTrace'); var path = await getFilePath('error'); var name.原创 2021-07-13 18:52:19 · 372 阅读 · 0 评论 -
flutter overflow属性省略号、零宽空格解决长字母、数字串整体显示省略号问题
overflow: TextOverflow.ellipsis,缺陷:会将长字母、数字串整体显示省略现象:分组用户1234567890123456789,可能会显示成:分组用户...解决办法:将每个字符串之间插入零宽空格String breakWord(String word){ if(word == null || word.isEmpty){ return word; } String breakWord = ' '; word.runes.forEach((.转载 2021-01-25 11:31:59 · 820 阅读 · 0 评论 -
flutterApp 初始化前执行函数
void main() async { WidgetsFlutterBinding.ensureInitialized(); // doSomething... runApp(MyApp());}class MyApp extends StatefulWidget { @override _MyAppState createState() => new _MyAppState();}class _MyAppState extends State<MyApp&..原创 2020-11-26 12:00:09 · 1152 阅读 · 0 评论 -
flutterApp隐藏/显示状态栏和底部栏
import 'package:flutter/services.dart'; SystemChrome.setEnabledSystemUIOverlays([]);//隐藏状态栏,底部按钮栏SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);//隐藏状态栏,保留底部按钮栏SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);//显示状态栏、底.原创 2020-11-25 17:30:11 · 2695 阅读 · 3 评论