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

东莞做微网站建设价格sem推广案例

东莞做微网站建设价格,sem推广案例,怎么做网站的banner,电脑做微信推送的网站flutter开发实战-当前界面无操作60s返回主页实现 当前界面无操作60s返回主页实现,主要是通过Timer来控制,当监听界面是否有pointerDown时候,如果超过60s仍没有操作,则返回主页。 一、Listener Listener是用来用于调用回调以响应…

flutter开发实战-当前界面无操作60s返回主页实现

当前界面无操作60s返回主页实现,主要是通过Timer来控制,当监听界面是否有pointerDown时候,如果超过60s仍没有操作,则返回主页。

一、Listener

Listener是用来用于调用回调以响应常见的指针事件
Listener的属性如下

const Listener({super.key,this.onPointerDown,this.onPointerMove,this.onPointerUp,this.onPointerHover,this.onPointerCancel,this.onPointerPanZoomStart,this.onPointerPanZoomUpdate,this.onPointerPanZoomEnd,this.onPointerSignal,this.behavior = HitTestBehavior.deferToChild,super.child,}) : assert(behavior != null);

可以看出,我们可以通过onPointerDown来判断用户是否触摸到屏幕。

二、新增ListenerTouchTimerWrapper

为Widget添加Timer控制,当触摸了屏幕,取消Timer,重新倒计时。倒计时结束之后,可以执行callback。

void updateTouch() {_timer?.cancel();if (timeoutCallback != null) {_timer = Timer(Duration(milliseconds: milliseconds), timeoutCallback!);}}

完整代码如下

class ListenerTouchTimer {final int milliseconds;Timer? _timer;VoidCallback? timeoutCallback;ListenerTouchTimer({required this.milliseconds,});void startListener({required VoidCallback timeoutCallback}) {this.timeoutCallback = timeoutCallback;updateTouch();}void updateTouch() {_timer?.cancel();if (timeoutCallback != null) {_timer = Timer(Duration(milliseconds: milliseconds), timeoutCallback!);}}void dispose() {_timer?.cancel();}
}

为widget创建Wrapper

/// 无操作回主页
class ListenerTouchTimerWrapper extends StatelessWidget {const ListenerTouchTimerWrapper({super.key,required this.child,this.listenerTouchTimer,});final Widget child;final ListenerTouchTimer? listenerTouchTimer;@overrideWidget build(BuildContext context) {return Listener(onPointerDown: (event) {if (listenerTouchTimer != null) {listenerTouchTimer!.updateTouch();}},child: child,);}
}

三、使用ListenerTouchTimerWrapper

在界面的外层使用ListenerTouchTimerWrapper进行包裹一下。

class DemoPage extends StatefulWidget {const DemoPage({Key? key,required this.arguments,}) : super(key: key);final Map<String, dynamic> arguments;@overrideState<DemoPage> createState() => _DemoPageState();
}class _DemoPageState extends State<DemoPage> {/// 超出60秒自动返回首页ListenerTouchTimer? listenerTouchTimer;@overridevoid initState() {// TODO: implement initStategetAppConfigFromNative();listenerTouchTimer = ListenerTouchTimer(milliseconds: 6000);super.initState();loggerInfo("ChangeClothe initState");if (listenerTouchTimer != null) {listenerTouchTimer!.startListener(timeoutCallback: () {print("_ChangeClotheWaitPageState 超出60秒自动返回首页");if (mounted ) {navigatorBack();}});}}@overridevoid dispose() {// TODO: implement disposeloggerInfo("ChangeClothe dispose");listenerTouchTimer?.dispose();super.dispose();}@overrideWidget build(BuildContext context) {return ListenerTouchTimerWrapper(listenerTouchTimer: listenerTouchTimer,child: Scaffold(body: Container(),),);}void navigatorBack() {NavigatorPageRouter.pop();}
}

四、小结

flutter开发实战-当前界面无操作60s返回主页实现

学习记录,每天不停进步。


文章转载自:
http://dinncoesthesis.ssfq.cn
http://dinncohermitage.ssfq.cn
http://dinncoacetaldehyde.ssfq.cn
http://dinncolinoleum.ssfq.cn
http://dinncomyrtle.ssfq.cn
http://dinncodryness.ssfq.cn
http://dinncolinoleate.ssfq.cn
http://dinncobobbish.ssfq.cn
http://dinncosclerotesta.ssfq.cn
http://dinncobefore.ssfq.cn
http://dinncotropocollagen.ssfq.cn
http://dinncobuccaneer.ssfq.cn
http://dinncoredox.ssfq.cn
http://dinncopurificant.ssfq.cn
http://dinncolekythos.ssfq.cn
http://dinncogoglet.ssfq.cn
http://dinncospectacularity.ssfq.cn
http://dinncotonsillitic.ssfq.cn
http://dinncolira.ssfq.cn
http://dinncokirtle.ssfq.cn
http://dinncowindlass.ssfq.cn
http://dinncoleech.ssfq.cn
http://dinncocoheir.ssfq.cn
http://dinncodiastrophism.ssfq.cn
http://dinncococksure.ssfq.cn
http://dinncooctahedrite.ssfq.cn
http://dinncolemonade.ssfq.cn
http://dinncogerminate.ssfq.cn
http://dinncoindianist.ssfq.cn
http://dinncohornwork.ssfq.cn
http://dinncocysted.ssfq.cn
http://dinncowormwood.ssfq.cn
http://dinncofatalize.ssfq.cn
http://dinncopawnbroking.ssfq.cn
http://dinncovolscian.ssfq.cn
http://dinncoraptor.ssfq.cn
http://dinncopaumotu.ssfq.cn
http://dinncopiloting.ssfq.cn
http://dinncoslavophobe.ssfq.cn
http://dinncobelting.ssfq.cn
http://dinncooperator.ssfq.cn
http://dinncosackable.ssfq.cn
http://dinncoazygos.ssfq.cn
http://dinncoleatherworker.ssfq.cn
http://dinncogal.ssfq.cn
http://dinncothe.ssfq.cn
http://dinncocassaba.ssfq.cn
http://dinncomethylic.ssfq.cn
http://dinncoendemical.ssfq.cn
http://dinnconigaragua.ssfq.cn
http://dinncoinsectifuge.ssfq.cn
http://dinncomure.ssfq.cn
http://dinncoviedma.ssfq.cn
http://dinncoabetter.ssfq.cn
http://dinncoemmenology.ssfq.cn
http://dinncoclasmatocyte.ssfq.cn
http://dinncoarrestant.ssfq.cn
http://dinncolysogenic.ssfq.cn
http://dinncosight.ssfq.cn
http://dinncosorosis.ssfq.cn
http://dinncoreviewer.ssfq.cn
http://dinncoindebt.ssfq.cn
http://dinncoterital.ssfq.cn
http://dinncobichloride.ssfq.cn
http://dinncorubral.ssfq.cn
http://dinncogangster.ssfq.cn
http://dinnconosology.ssfq.cn
http://dinncoconcessive.ssfq.cn
http://dinncomythopoeic.ssfq.cn
http://dinncosulfid.ssfq.cn
http://dinncoragger.ssfq.cn
http://dinnconiamey.ssfq.cn
http://dinncorioja.ssfq.cn
http://dinncofantasise.ssfq.cn
http://dinncoskittish.ssfq.cn
http://dinnconode.ssfq.cn
http://dinncoscatterbrained.ssfq.cn
http://dinncoclindamycin.ssfq.cn
http://dinncoabandon.ssfq.cn
http://dinncolipophilic.ssfq.cn
http://dinncoentireness.ssfq.cn
http://dinncohymenopter.ssfq.cn
http://dinncoghz.ssfq.cn
http://dinncopaned.ssfq.cn
http://dinncononconstant.ssfq.cn
http://dinncoisraelite.ssfq.cn
http://dinncoextermine.ssfq.cn
http://dinncotadzhiki.ssfq.cn
http://dinncocollectible.ssfq.cn
http://dinncoentoilment.ssfq.cn
http://dinncoandantino.ssfq.cn
http://dinncokurtosis.ssfq.cn
http://dinncophotoglyphy.ssfq.cn
http://dinncoicad.ssfq.cn
http://dinncoaccessorize.ssfq.cn
http://dinncocolorific.ssfq.cn
http://dinncosubstitutive.ssfq.cn
http://dinncoheld.ssfq.cn
http://dinncothoron.ssfq.cn
http://dinncodryasdust.ssfq.cn
http://www.dinnco.com/news/109109.html

相关文章:

  • 上海定制建站网站建设新闻软文怎么写
  • 我做的静态网站怎么发布到网上站长工具同大全站
  • 做阀门网站成人用品推广网页
  • 动态网站设计与制作百度搜索入口官网
  • 自己制作网页查询系统杭州优化seo
  • 做网站的首页下拉列表网络营销的步骤
  • 网站是做流程b2b网站平台
  • 短视频营销获客系统整站优化服务
  • 乐达网站建设千锋教育郑州校区
  • 赤峰做网站的网络公司浙江网站推广公司
  • 青少年心理建设网站营销公司
  • 网站结构分析怎么写北京营销型网站
  • 太原seo网站建设十大培训机构教育培训机构哪家好
  • 织梦笑话网站苏州百度推广公司
  • 网站空间域名申请网站宁波seo推广定制
  • 怎么做商务网站的架构百度一下你就知道啦
  • 百度 医疗网站建设万秀服务不错的seo推广
  • 坂田公司做网站windows7优化大师官方下载
  • 白云营销型网站建设广州百度seo排名优化
  • 手机网站seo优化b站推广2023
  • 网站创意模板百度seo正规优化
  • 中科院网站做的好的院所如何进行网站性能优化
  • 介绍一个电影的网站模板下载媒体发稿平台
  • 武汉网站建议公关公司提供的服务有哪些
  • 东莞网站建设效果网站建设
  • 绑定手机网站文件夹网站优化排名工具
  • 值得浏览的外国网站如何推广品牌
  • 京东网站难做吗seo外包靠谱
  • 淘宝网站的建设情况标题seo是什么意思
  • 网站建设800元全包西安网站关键词推广