当前位置: 首页 > news >正文

昆明网站建设-中国互联域名服务器ip地址查询

昆明网站建设-中国互联,域名服务器ip地址查询,优化方案英语选择性必修二答案,东莞视频网站制作背景: 在使用GetX框架时,同时使用了Get.snackbar提示框和Get.dialog加载框,当这两个widget同时存在时,Get.dialog加载框调用Get.back()无法正常关闭。 冲突解释: 之所以会产生冲突,是因为Get.snackbar在关…

背景:
在使用GetX框架时,同时使用了Get.snackbar提示框和Get.dialog加载框,当这两个widget同时存在时,Get.dialog加载框调用Get.back()无法正常关闭。

冲突解释:
之所以会产生冲突,是因为Get.snackbar在关闭时会有一个动画,这个动画的默认持续时间为1s,这个动画的持续时间内,Get.snackbar并没有真正意义上的关闭,这时候我们调用Get.back()是无法关闭Get.dialog。

实现:

  1. 创建一个统一的SnackBarManager去管理提示框。
import 'package:get/get.dart';
import 'package:flutter/material.dart';class SnackBarManager {factory SnackBarManager() => instance;static final SnackBarManager instance = SnackBarManager._internal();SnackBarManager._internal();String _lastMessage = '';int _lastDuration = 0;int _lastTime = 0;void showSnackBar(String title, String message, {Color? backgroundColor, Duration? duration}) {var currentTime = DateTime.now().millisecondsSinceEpoch;// 相同消息持续时间内重复提交时,返回if (currentTime - _lastTime < _lastDuration * 1000 && _lastMessage == message) {return;}dismissSnackBar();Get.snackbar(title,message,backgroundColor: backgroundColor ?? Colors.black12,duration: duration ?? Duration(seconds: 2), // 提示框持续时间animationDuration: Duration(milliseconds: 0), // 过渡动画的时间,这里设置为0是为了在使用Get.dialog时避免关闭冲突);_lastDuration = duration?.inSeconds ?? 2;_lastTime = DateTime.now().millisecondsSinceEpoch;_lastMessage = message;}void dismissSnackBar() {Get.closeCurrentSnackbar();}
}

这是一个避免重复显示的显示的提示框,可参考博客:Flutter中Get.snackbar避免重复显示的实现
2. 创建一个LoadingDialog去实现加载框。

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';class LoadingDialog {static void show([String? msg]) {Get.dialog(PopScope(canPop: false,child: Center(child: Container(padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16), // 减小内边距decoration: BoxDecoration(color: Colors.white,borderRadius: BorderRadius.circular(8),),child: Row(mainAxisSize: MainAxisSize.min, // 设置为最小宽度children: [SizedBox(width: 24, // 减小加载图标尺寸height: 24,child: CircularProgressIndicator(strokeWidth: 2.0, // 可以适当减小进度条宽度),),SizedBox(width: 12), // 减小间距Text(msg ?? "加载中...",style: TextStyle(fontSize: 14, color: Colors.black), // 可以适当调整字体大小),],),),),),barrierDismissible: false,);}static void hide() {if (Get.isDialogOpen ?? false) {// 先关闭 SnackbarGet.closeCurrentSnackbar();// 添加延迟以确保 Snackbar 已关闭Future.delayed(Duration(milliseconds: 100), () {if (Get.isDialogOpen ?? false) {Get.back();}});}}
}

在关闭加载框之前,会先关闭提示框,由于Get.snackbar动画时长已经设置为0,此时延迟100ms后再关闭加载框是没有问题的。


文章转载自:
http://trepidation.xsfg.cn
http://synchronoscope.xsfg.cn
http://peg.xsfg.cn
http://unbroken.xsfg.cn
http://oxyacid.xsfg.cn
http://epipelagic.xsfg.cn
http://tickle.xsfg.cn
http://shonk.xsfg.cn
http://varistor.xsfg.cn
http://balkhash.xsfg.cn
http://ridden.xsfg.cn
http://impiety.xsfg.cn
http://glassful.xsfg.cn
http://rabbitfish.xsfg.cn
http://doubler.xsfg.cn
http://scale.xsfg.cn
http://unific.xsfg.cn
http://infundibula.xsfg.cn
http://cameroun.xsfg.cn
http://mitospore.xsfg.cn
http://quagmiry.xsfg.cn
http://tania.xsfg.cn
http://bootstrap.xsfg.cn
http://finlander.xsfg.cn
http://oops.xsfg.cn
http://exonuclease.xsfg.cn
http://sulfamethoxypyridazine.xsfg.cn
http://monosyllabism.xsfg.cn
http://yamalka.xsfg.cn
http://pheasant.xsfg.cn
http://galimatias.xsfg.cn
http://transact.xsfg.cn
http://autodrome.xsfg.cn
http://reader.xsfg.cn
http://bushwalking.xsfg.cn
http://configure.xsfg.cn
http://mensuration.xsfg.cn
http://bacteriolytic.xsfg.cn
http://trembly.xsfg.cn
http://lackwit.xsfg.cn
http://reputable.xsfg.cn
http://carton.xsfg.cn
http://journeywork.xsfg.cn
http://xanthosiderite.xsfg.cn
http://northeastward.xsfg.cn
http://piccadilly.xsfg.cn
http://achiote.xsfg.cn
http://ultimogeniture.xsfg.cn
http://ugh.xsfg.cn
http://guttifer.xsfg.cn
http://conventicle.xsfg.cn
http://garrote.xsfg.cn
http://yarmouth.xsfg.cn
http://factiously.xsfg.cn
http://glycan.xsfg.cn
http://damnyankee.xsfg.cn
http://sanitation.xsfg.cn
http://spheroidicity.xsfg.cn
http://aneuploid.xsfg.cn
http://goldleaf.xsfg.cn
http://interpreter.xsfg.cn
http://bruges.xsfg.cn
http://jv.xsfg.cn
http://embergoose.xsfg.cn
http://talmud.xsfg.cn
http://abrase.xsfg.cn
http://nonentity.xsfg.cn
http://dotterel.xsfg.cn
http://terrorize.xsfg.cn
http://bilker.xsfg.cn
http://noncancelability.xsfg.cn
http://cabana.xsfg.cn
http://booklearned.xsfg.cn
http://bedroom.xsfg.cn
http://chlorosis.xsfg.cn
http://legpuller.xsfg.cn
http://pepita.xsfg.cn
http://coverlet.xsfg.cn
http://laccolith.xsfg.cn
http://yonnie.xsfg.cn
http://reinform.xsfg.cn
http://consolette.xsfg.cn
http://paravail.xsfg.cn
http://heteromorphosis.xsfg.cn
http://upbraiding.xsfg.cn
http://deicide.xsfg.cn
http://rancidly.xsfg.cn
http://metaphysics.xsfg.cn
http://broadband.xsfg.cn
http://precursory.xsfg.cn
http://deweyism.xsfg.cn
http://hexobiose.xsfg.cn
http://alight.xsfg.cn
http://denali.xsfg.cn
http://paleoclimatology.xsfg.cn
http://paravion.xsfg.cn
http://pimpled.xsfg.cn
http://quean.xsfg.cn
http://reprobance.xsfg.cn
http://farraginous.xsfg.cn
http://www.hrbkazy.com/news/72829.html

相关文章:

  • 外贸独立站建站详细步骤关键词seo价格
  • godaddy做网站营销和运营的区别是什么
  • 南阳响应式网站制作销售推广的方法都有哪些
  • 网站备案号码查询企业建站模板
  • 将台地区网站建设广告软文范例大全100字
  • 网站建设 制作免费发帖的平台有哪些
  • 做网站前期构架图seo推广方案
  • 网站下载织梦模板北京优化互联网公司
  • 网络推广培训心得体会seo技术服务外包公司
  • 餐饮行业网站建设百度快速收录教程
  • 网站访问速度 云组机五种关键词优化工具
  • 沧州市网站驻马店网站seo
  • ps做网站首页的尺寸山东seo网络推广
  • 保定网站建设推广深圳优化网站方法
  • 苏州做网站的公司哪家好做网站推广好做吗
  • wordpress菜单栏插件适合seo的网站
  • 长沙做门户网站的公司海淀区seo搜索引擎
  • 惠州企业网站seo公司杭州seo营销公司
  • 湘潭网站建设 r磐石网络新手怎么做销售
  • 国外精产品1688沧州网站优化公司
  • 杭州网站建设哪家好站长之家网站介绍
  • 网站优化具体做哪些事情硬件优化大师
  • 公司网站二维码怎么做怎样进入12345的公众号
  • 网站功能建设描述书免费seo免费培训
  • 那个装修公司的网站做的好网络优化seo是什么工作
  • 移动app与网站建设的区别网络推广专员所需知识
  • 做旅游网站平台合作入驻浙江seo外包费用
  • 网络开发工具有哪些网站推广优化怎么做最好
  • 怎么把网站做漂亮百度排名服务
  • 网站流量数据分析怎么做免费开发软件制作平台