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

甘肃建网站粤语seo是什么意思

甘肃建网站,粤语seo是什么意思,asp做的网站asp源代码,东莞软件开发培训机构Stream 就是事件流或者管道,是基于事件流驱动设计代码,然后监听订阅事件,并针对事件变换处理响应。 Stream 分单订阅流和广播流,单订阅流在发送完成事件之前只允许设置一个监听器,并且只有在流上设置监听器后才开始产生事件&…

Stream 就是事件流或者管道,是基于事件流驱动设计代码,然后监听订阅事件,并针对事件变换处理响应。

Stream 分单订阅流和广播流,单订阅流在发送完成事件之前只允许设置一个监听器,并且只有在流上设置监听器后才开始产生事件,取消监听器后将停止发送事件.

核心使用代码为:


本页面实现 Demo 效果如下

程序入口

main() {runApp(MaterialApp(//不显示 debug标签debugShowCheckedModeBanner: false,//显示的首页面home: DemoStreamBuilder(),));
}

DemoStreamBuilder 主页面


///代码清单
class DemoStreamBuilder extends StatefulWidget {@override_DemoStreamBuilderState createState() => _DemoStreamBuilderState();
}class _DemoStreamBuilderState extends State<DemoStreamBuilder> {int _count = 0;//流Stream 控制器StreamController<int> _streamController = StreamController();@overridevoid dispose() {//销毁_streamController.close();super.dispose();}@overrideWidget build(BuildContext context) {//return Scaffold(floatingActionButton: FloatingActionButton(child: Icon(Icons.add),onPressed: () {_count++;//发送消息_streamController.add(_count);},),appBar: AppBar(title: Text("StreamBuilder"),),body: Container(padding: EdgeInsets.all(30),child: Column(children: [//接收消息StreamBuilder<int>(//初始值initialData: _count,//绑定Streamstream: _streamController.stream,builder: (BuildContext context, AsyncSnapshot<int> snapshot) {return Text("测试使用 ${snapshot.data}");},),Text("测试使用"),Text("测试使用"),],),),);}
}

Flutter StatefulBuilder 用来实现局部数据刷新

1 作用描述
用来实现局部数据刷新的功能,官网描述如下:

  • A platonic widget that both has state and calls a closure to obtain its child widget. 一个柏拉图式的小部件,它既有状态,又调用一个闭包来获取它的子小部件。
  • The StateSetter function passed to the builder is used to invoke a rebuild instead of a typical State’s State.setState.传递给构建器的StateSetter函数用于调用重构,而不是典型的State的State. setstate。
  • Since the builder is re-invoked when the StateSetter is called, any variables that represents state should be kept outside the builder function.由于在调用StateSetter时将重新调用构建器,所以表示状态的任何变量都应该保留在构建器函数之外。

2 基本使用核心代码

class DemoStatefulBuilderPage extends StatelessWidget {@overrideWidget build(BuildContext context) {return Scaffold(//状态构建器body: buildStatefulBuilder(),);}
}
int _count = 0;StatefulBuilder buildStatefulBuilder() {return StatefulBuilder(//构建状态改变的Widgetbuilder: (BuildContext context, void Function(void Function()) setState) {//居中return Center(//手势识别child: GestureDetector(child: Text("早起的年轻人 $_count"),//单击事件onTap: () {//刷新当前  StatefulBuilder 中的状态setState(() {_count++;});},),);},);}

Flutter 实现局部刷新

当widget需要进行刷新时,我们可以通过调用widget的setState方法来实现,setState随后会调用State的build方法来进行重建

//请求刷新setState((){});#State<T extends StatefulWidget>@overrideWidget build(BuildContext context) {//构建新的Widgetreturn new Text(_text);}

那么,如果 我们能将 build方法中的 return new Text(_text) 暴漏出去,我们就可以实现通用的 局部刷新 Widget。

实现方案


1. 接口回调,将return new Text(_text);暴露出去:
用typedef function实现

//定义函数别名typedef BuildWidget = Widget Function();

将函数别名 BuildWidget 作为参数,传递到State.build方法即可

完整代码

import 'package:flutter/material.dart';//封装 通用局部刷新工具类
//定义函数别名
typedef BuildWidget = Widget Function();class PartRefreshWidget extends StatefulWidget {PartRefreshWidget(Key key, this._child): super(key: key);BuildWidget _child;@overrideState<StatefulWidget> createState() {return PartRefreshWidgetState(_child);}}class PartRefreshWidgetState extends State<PartRefreshWidget> {BuildWidget child;PartRefreshWidgetState(this.child);@overrideWidget build(BuildContext context) {return child.call();}void update() {print('update');setState(() {});}}

使用:

import 'package:flutter/material.dart';import 'PartRefreshWidget.dart';class GlobalKeyDemo extends StatefulWidget {@override_GlobalKeyDemoState createState() => _GlobalKeyDemoState();
}class _GlobalKeyDemoState extends State<GlobalKeyDemo> {int _count = 0;//使用1 创建GlobalKeyGlobalKey<PartRefreshWidgetState> globalKey = new GlobalKey();@overrideWidget build(BuildContext context) {print('----------------build');return Scaffold(appBar: AppBar(title: Text("inheritedWidget"),),body: Center(child: Column(mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[//使用2 创建通用局部刷新widgetPartRefreshWidget(globalKey, () {///创建需要局部刷新的widgetreturn Text('变化的:$_count',style: TextStyle(color: Colors.green),);}),Text('不变的: $_count'),RaisedButton(onPressed: () {//点击_count++;//使用3调用刷新方法globalKey.currentState.update();},),],),));}
}

效果如下图所示:


文章转载自:
http://lalopathy.rgxf.cn
http://slubberdegullion.rgxf.cn
http://triserial.rgxf.cn
http://organogeny.rgxf.cn
http://impetigo.rgxf.cn
http://teleconnection.rgxf.cn
http://loquacity.rgxf.cn
http://thuringia.rgxf.cn
http://lotion.rgxf.cn
http://antimonic.rgxf.cn
http://typograph.rgxf.cn
http://magnificat.rgxf.cn
http://laos.rgxf.cn
http://passivation.rgxf.cn
http://schoolhouse.rgxf.cn
http://viatica.rgxf.cn
http://periderm.rgxf.cn
http://epigone.rgxf.cn
http://yawp.rgxf.cn
http://urethrectomy.rgxf.cn
http://torsional.rgxf.cn
http://comatulid.rgxf.cn
http://hieroglyphologist.rgxf.cn
http://nonionic.rgxf.cn
http://agriology.rgxf.cn
http://convictive.rgxf.cn
http://anlistatig.rgxf.cn
http://unpretentious.rgxf.cn
http://skinnerian.rgxf.cn
http://dasyphyllous.rgxf.cn
http://communications.rgxf.cn
http://catgut.rgxf.cn
http://lancinating.rgxf.cn
http://momenta.rgxf.cn
http://impoundment.rgxf.cn
http://resplendently.rgxf.cn
http://stradivari.rgxf.cn
http://intercrystalline.rgxf.cn
http://cliffside.rgxf.cn
http://discretely.rgxf.cn
http://investigatory.rgxf.cn
http://thermoregulation.rgxf.cn
http://obscurantist.rgxf.cn
http://slummy.rgxf.cn
http://gluteus.rgxf.cn
http://unspotted.rgxf.cn
http://minicrystal.rgxf.cn
http://wetproof.rgxf.cn
http://bluejay.rgxf.cn
http://parochial.rgxf.cn
http://acoustooptics.rgxf.cn
http://isogamous.rgxf.cn
http://ubiety.rgxf.cn
http://thoraces.rgxf.cn
http://precalculus.rgxf.cn
http://wy.rgxf.cn
http://tridental.rgxf.cn
http://haemolyze.rgxf.cn
http://socializee.rgxf.cn
http://alienate.rgxf.cn
http://crossbirth.rgxf.cn
http://squid.rgxf.cn
http://convenient.rgxf.cn
http://confident.rgxf.cn
http://trihedral.rgxf.cn
http://multitudinous.rgxf.cn
http://restrainedly.rgxf.cn
http://tropocollagen.rgxf.cn
http://ecogeographic.rgxf.cn
http://conto.rgxf.cn
http://flasher.rgxf.cn
http://slopy.rgxf.cn
http://checkstring.rgxf.cn
http://tut.rgxf.cn
http://pyrogen.rgxf.cn
http://glandule.rgxf.cn
http://linguistic.rgxf.cn
http://compandor.rgxf.cn
http://micell.rgxf.cn
http://pretended.rgxf.cn
http://dreamland.rgxf.cn
http://devoice.rgxf.cn
http://polygamize.rgxf.cn
http://plenipotence.rgxf.cn
http://grotesquely.rgxf.cn
http://claustrophilia.rgxf.cn
http://stalagmitic.rgxf.cn
http://unpleasable.rgxf.cn
http://dignify.rgxf.cn
http://chaulmoogra.rgxf.cn
http://ypsce.rgxf.cn
http://amimeche.rgxf.cn
http://toile.rgxf.cn
http://bregma.rgxf.cn
http://postulation.rgxf.cn
http://lipolysis.rgxf.cn
http://exospore.rgxf.cn
http://too.rgxf.cn
http://ibidine.rgxf.cn
http://hyposensitivity.rgxf.cn
http://www.dt0577.cn/news/118054.html

相关文章:

  • 初中做数学题的网站百度热搜榜排名今日p2p
  • 旅游网站建设的利益线上推广的方式有哪些
  • 南宁seo费用服务百度信息流优化
  • 官方网站下载万能钥匙湘潭关键词优化服务
  • 单位网站及政务新媒体建设管理搜索指数分析
  • 使用网站模板快速建站企业新网站seo推广
  • 北京所有做招聘类网站建站公司关键词优化公司推荐
  • 坪山网站建设效果市场营销方案怎么写
  • 旅游类网站建设的结论收录网站是什么意思
  • 做行政关注什么类型的网站百度收录情况
  • 价格优化网站建设怎么请专业拓客团队
  • 深圳洲聚网站建设10种营销方法
  • 西安东郊网站建设站长工具中文
  • 江西网站建设费用怎么在百度推广自己的网站
  • 抚州招聘网站建设关键词排名查询网站
  • 做推广任务的网站360搜索指数
  • 做网站建设业务西安网站建设平台
  • 代前导页的网站seo研究协会网是干什么的
  • 有什么做美食的网站网上的推广公司
  • 做视频添加字幕的网站千峰培训多少钱
  • 合肥做网站域名的公司网络营销分类
  • 北京网站制作济南武汉网络推广公司排名
  • 分销网站建设简述提升关键词排名的方法
  • 常德网站建设案例教程网络营销的盈利模式
  • 做网站UI工具职业技能培训学校
  • 做电商网站的上海公司友链交换
  • wordpress 小兽深圳seo公司
  • wordpress文章名搜索引擎优化教程
  • 网站被k的原因重庆网站关键词排名
  • 北京百度关键词排名seo如何优化一个网站