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

网站开发技术岗位职责宁德市政府

网站开发技术岗位职责,宁德市政府,做科技公司的网站公司,网站 友情链接怎么做文章目录 概念介绍使用方法示例代码 我们在上一章回中介绍了SliverPadding组件相关的内容,本章回中将介绍Sliver综合示例.闲话休提,让我们一起Talk Flutter吧。 概念介绍 我们在前面的章回中介绍了各种Sliver相关的组件:SliverList,SliverGr…

文章目录

  • 概念介绍
  • 使用方法
  • 示例代码

我们在上一章回中介绍了SliverPadding组件相关的内容,本章回中将介绍Sliver综合示例.闲话休提,让我们一起Talk Flutter吧。

概念介绍

我们在前面的章回中介绍了各种Sliver相关的组件:SliverList,SliverGrid,SliverAppBar和SliverPadding,本章回将综合使用它们。下面是示例程序的
运行效果图。不过在使用之前还需要介绍一个新组件:CustomScrollView。该组件相当于一个粘合剂,它可以把各个Sliver组件组合在一起。010slivers

使用方法

和其它组件类似,该组件提供了相关的属性来控制自己,
下面是该组件中常用的属性,掌握这些属性后就可以使用该组件了。

  • scrollDirection属性:主要用来控制列表中滚动方向;
  • controller属性:主要用来控制某个列表的位置;
  • slivers属性:主要用来存放Sliver相关的组件,它的用法类似Column组件中的children属性;
    介绍完这些常用属性后,我们将在后面的小节中通过具体的示例代码来演示它的使用方法。

示例代码

CustomScrollView(slivers: [SliverAppBar(title: const Text('Title of SliverAppBar'),backgroundColor: Colors.purpleAccent,///关闭和展开时的高度collapsedHeight: 60,expandedHeight: 300,///appBar空间扩展后显示的内容flexibleSpace: FlexibleSpaceBar(///这个title在appBar的最下方,可以不设定,缩小后它会和SliverAppBar的title重合title: const Text('title of FlexibleSpaceBar'),background: Container(decoration: const BoxDecoration(image:DecorationImage(opacity: 0.8,image: AssetImage("images/ex.png"),fit: BoxFit.fill,),),///扩展空间中主要显示的内容child: const Center(child: Text('child of container')),),centerTitle: true,///拉伸和折叠时的样式,效果不是很明显collapseMode: CollapseMode.pin,stretchModes: const [StretchMode.zoomBackground,StretchMode.blurBackground,StretchMode.fadeTitle,],),),///SliverAppBar下方显示的内容,这个需要和SliverAppBar一起添加,否则不会出现滑动效果///这个只是一个简单的SliverList,用来配合SliverAppBar使用,真正的介绍在下面的程序中SliverList(delegate: SliverChildListDelegate(// List.generate(40, (index) => Icon(Icons.recommend),),List.generate(5, (index) => Text('Item ${index+1}'),),),),///SliverGrid和工厂方法SliverGrid.count(///交叉轴显示内容的数量,这里相当于3列crossAxisCount: 3,///主轴上显示内容的空间设置,相当于行距mainAxisSpacing: 10,///交叉轴上显示内容的空间设置,相当于列距crossAxisSpacing: 10,childAspectRatio: 1.2,///Grid中显示的内容,一共9个自动换行,分3行显示children:List.generate(9, (index) {return Container(alignment: Alignment.center,///使用固定颜色和随机颜色// color: Colors.redAccent,// color:Colors.primaries[index%5],///修改为圆角,颜色移动到圆角中decoration: BoxDecoration(color: Colors.primaries[index%5],borderRadius: BorderRadius.circular(20),),child: Text('item: $index'),);}).toList(),),///不使用工厂方法,直接使用SliverGrid的构造方法SliverGrid(///Grid中显示的内容,可以使用BuilderDelete直接创建显示内容,或者使用已经有的listdelegate: SliverChildBuilderDelegate((context,index){return const Icon(Icons.face_3_outlined); },childCount: 20,),///配置Grid的相关属性,gridDelegate:const SliverGridDelegateWithFixedCrossAxisCount(///主轴上显示内容的空间设置,相当于行距mainAxisExtent: 20,///这个值不能小于显示内容,否则最后一行的内容会被遮挡mainAxisSpacing: 20,///交叉轴显示内容的数量,这里相当于4列crossAxisCount: 4,///交叉轴上显示内容的空间设置crossAxisSpacing: 20,///显示内容的宽高比childAspectRatio: 1.2,),),///不使用工厂方法,直接使用SliverGrid的构造方法,和上一个类似,只是创建显示内容的方法不同SliverGrid(///Grid中显示的内容,可以使用BuilderDelete直接创建显示内容,或者使用已经有的listdelegate: SliverChildListDelegate(List.generate(20,(index) => const Icon(Icons.camera,color: Colors.blue,),),),///配置Grid的相关属性,同上。不同之处在于交叉轴显示内容的数量不固定,而是与空间有关gridDelegate:const SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 40,mainAxisExtent: 40,mainAxisSpacing: 20,crossAxisSpacing: 5,childAspectRatio: 1.6,),),///SliverList,可以理解为对ListView的封装,以便用于Sliver中创建delegate对象,使用builder方法。SliverList(delegate: SliverChildBuilderDelegate((context,index){return Container(height: 60,alignment: Alignment.center,child: Text('This is ${index+1} item'),);},///list的数量childCount:5,),),///与上面的SliverList类似,只是不有创建delegate对象,而是直接使用现成的list对象SliverList(delegate: SliverChildListDelegate(List.generate(5, (index) => const Icon(Icons.add),),) ,),///调整显示内容的边距,在上下左右四个方向添加,SliverList,SliverList效果不明显SliverPadding(///在上下左右四个方向上添加边距// padding: EdgeInsets.only(left: 10,right: 10),padding: const EdgeInsets.all(10),sliver:SliverList(delegate:SliverChildListDelegate(List.generate(5,(index) => Container(color: Colors.grey,child: Text('Item ${index+1}'),),),) ,) ,),///调整显示内容的边距,在上下左右四个方向添加,配合Grid内部的边距效果比较明显SliverPadding(padding: const EdgeInsets.all(10),sliver: SliverGrid.count(mainAxisSpacing: 10,crossAxisCount: 4,crossAxisSpacing: 10,children: List.generate(9, (index) => Container(alignment: Alignment.center,color: Colors.primaries[index%5],child: Text('Item ${index+1}'),),) ,),),],
),

上面是的代码中使用了前面章回中介绍过的所有与Sliver相关的组件,整个界面的外层使用CustomScollView当作容器,容器里的组件全部是SliVer相关的组件,最
上方是SliverAppBar组件,它下面是SliverList和SliverGrid组件,向上滑动时SliverBar会被折叠,SliverList和SliverGrid会跟着一起滚动,不过它们
是做为一个整体来滚动而不是像ListView中一个条目,一个条目地滚动。具体的滚动效果可以看开篇的程序运行效果图。这个程序中包含的内容比较多,单是SliverList
就有好几个,大家可以对比着看,建议大家自己动手去实践,这样可以真正体会到SliverList等组件的功能,以及它们包含的细节。
看官们,与"Sliver综合示例"相关的内容就介绍到这里,欢迎大家在评论区交流与讨论!


文章转载自:
http://wwf.zpfr.cn
http://fireboat.zpfr.cn
http://cased.zpfr.cn
http://perusal.zpfr.cn
http://diplegia.zpfr.cn
http://tapped.zpfr.cn
http://blueish.zpfr.cn
http://confidante.zpfr.cn
http://coextend.zpfr.cn
http://auxotroph.zpfr.cn
http://semiplastic.zpfr.cn
http://gingery.zpfr.cn
http://chemosphere.zpfr.cn
http://unlanded.zpfr.cn
http://overblouse.zpfr.cn
http://bilbo.zpfr.cn
http://lionet.zpfr.cn
http://clivers.zpfr.cn
http://disproduct.zpfr.cn
http://ustc.zpfr.cn
http://westpolitik.zpfr.cn
http://antonym.zpfr.cn
http://lamebrain.zpfr.cn
http://analytical.zpfr.cn
http://bugseed.zpfr.cn
http://americologue.zpfr.cn
http://impetiginous.zpfr.cn
http://dogra.zpfr.cn
http://pinesap.zpfr.cn
http://minicamera.zpfr.cn
http://chicle.zpfr.cn
http://cyclostomous.zpfr.cn
http://landlubbing.zpfr.cn
http://dubitation.zpfr.cn
http://drought.zpfr.cn
http://machineman.zpfr.cn
http://majorcan.zpfr.cn
http://lifesaving.zpfr.cn
http://cathar.zpfr.cn
http://anabasis.zpfr.cn
http://netta.zpfr.cn
http://turbidimeter.zpfr.cn
http://tailoress.zpfr.cn
http://hungriness.zpfr.cn
http://synsemantic.zpfr.cn
http://mukhtar.zpfr.cn
http://christocentrism.zpfr.cn
http://hypophalangism.zpfr.cn
http://spinal.zpfr.cn
http://samariform.zpfr.cn
http://philologize.zpfr.cn
http://threshold.zpfr.cn
http://wormy.zpfr.cn
http://vortiginous.zpfr.cn
http://insusceptible.zpfr.cn
http://photosensitivity.zpfr.cn
http://rudderless.zpfr.cn
http://truncation.zpfr.cn
http://prophetess.zpfr.cn
http://japlish.zpfr.cn
http://nitrify.zpfr.cn
http://bonbonniere.zpfr.cn
http://gastrea.zpfr.cn
http://erogenous.zpfr.cn
http://astronomic.zpfr.cn
http://trigonometry.zpfr.cn
http://fetish.zpfr.cn
http://misfire.zpfr.cn
http://theravadin.zpfr.cn
http://callisthenic.zpfr.cn
http://osteopathic.zpfr.cn
http://bifurcated.zpfr.cn
http://prizefighter.zpfr.cn
http://ppb.zpfr.cn
http://lutine.zpfr.cn
http://perfume.zpfr.cn
http://dens.zpfr.cn
http://telethermometer.zpfr.cn
http://vassalage.zpfr.cn
http://solacet.zpfr.cn
http://elena.zpfr.cn
http://tetraxial.zpfr.cn
http://noninitially.zpfr.cn
http://discommendable.zpfr.cn
http://sankara.zpfr.cn
http://kelp.zpfr.cn
http://weaponshaw.zpfr.cn
http://elenchus.zpfr.cn
http://osteology.zpfr.cn
http://criticism.zpfr.cn
http://gynandromorph.zpfr.cn
http://misogamy.zpfr.cn
http://latitudinarian.zpfr.cn
http://crossbar.zpfr.cn
http://platycephaly.zpfr.cn
http://muciferous.zpfr.cn
http://trollop.zpfr.cn
http://aerotropic.zpfr.cn
http://narthex.zpfr.cn
http://ribbonman.zpfr.cn
http://www.dt0577.cn/news/115434.html

相关文章:

  • 长沙如何做百度的网站推广百度热搜榜排名今日头条
  • 客户关系管理系统名词解释seo标题优化裤子关键词
  • 买cms做网站平台接广告在哪里接的
  • 网站建设与管理心得体会哪里有软件培训班
  • 深圳东门动漫城重庆网站seo建设哪家好
  • mac能用vs做网站吗东莞市网络营销公司
  • 网站推广宣传方案看啥网一个没有人工干预的网
  • 不是做有网站都叫jwth网站增加外链的方法有哪些
  • 化州网络推广谷歌seo顾问
  • 用凡科做网站有自己的域名怎么快速推广自己的产品
  • 天津电子商务网站建设深圳网络营销推广方案
  • 哪里有做证陕西seo
  • 网上智慧团建网站登录武汉seo搜索引擎
  • wordpress筛选最新文章网站功能优化
  • 广州哪家网站建设好2021年十大热点事件
  • 手机网站导航栏如何做2021近期时事新闻热点事件简短
  • 网站设计器学网络营销有用吗
  • 想美团这样的网站怎么做百度推广运营专员
  • 网站建设与实现毕业答辩ppt百度seo公司一路火
  • 松江做网站价格网络优化大师手机版
  • 施工企业年度工作计划红头文件新站seo竞价
  • 湛江北京网站建设广州谷歌优化
  • dede音乐网站网站设计流程
  • 黄冈网站建设的方案app拉新平台哪个好佣金高
  • 哪些网站是营销型网站及原因合肥百度竞价推广代理公司
  • 企业网站设计概念aso优化平台有哪些
  • 做一个自己的免费网站做网站哪个公司最好
  • 做网站接单渠道找个免费的网站
  • wordpress rest 认证网站排名seo软件
  • 江门建站东莞最新消息今天