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

h5手机模板网站怎样在建设厅网站查询安全员证

h5手机模板网站,怎样在建设厅网站查询安全员证,网站推广策划的思路,wordpress好还是dz好flutter 自定义TabBar 【top 0 级别】 前言一、基础widget二、tab 标签三、barView总结 前言 在日常开发中#xff0c;tab 标签选项#xff0c;是一个我们特别常用的一个组件了#xff0c;往往我们在一个项目中#xff0c;有很多地方会使用到它#xff0c;每次单独去写tab 标签选项是一个我们特别常用的一个组件了往往我们在一个项目中有很多地方会使用到它每次单独去写真的是太繁琐这里我会定义一个通用的tab 选择器喜欢的朋友可以拿去试试 一、基础widget 直接先上代码 class YSTabbarWidget extends StatefulWidget {/// tabListfinal ListString tabs;/// 是否可滑动 (居左)final bool? isScrollable;/// 高亮文字大小final double? textSize;/// 非高亮文字大小final double? unTextSize;/// 小线颜色final Color? tabColors;/// 文字高亮颜色final Color? labelColor;/// 非高亮文字颜色final Color? unselectedLabelColor;/// controller 必传final TabController? controller;/// tab间距final double? horizontal;/// 下划线颜色根据文字大小 根据tab大小final double lineBottom;final TabBarIndicatorSize? indicatorSize;/// page Listfinal ListWidget tabbarViewList;final Function(int)? didSelectIndex;/// 是否显示分割线final bool? showLine;const YSTabbarWidget({Key? key,required this.tabs,required this.controller,this.tabbarViewList const [],this.unselectedLabelColor,this.isScrollable,this.textSize 16.0,this.unTextSize 16.0,this.tabColors,this.labelColor,this.horizontal,this.lineBottom 0,this.indicatorSize,this.didSelectIndex,this.showLine true}): super(key: key);overrideStateYSTabbarWidget createState() _YSTabbarWidgetState(); }class _YSTabbarWidgetState extends StateYSTabbarWidget {overridevoid initState() {// TODO: implement initStatesuper.initState();}overrideWidget build(BuildContext context) {return Column(// mainAxisAlignment: MainAxisAlignment.start,crossAxisAlignment: CrossAxisAlignment.start,mainAxisSize: MainAxisSize.min,children: [getTabbarWidget(),widget.showLine true? Container(height: 0.5,color: const Color(0xffe5e5e5),): Container(),getTabbarViewWidget(),],);} }通过上面的代码我们可以看到这里定义了很多属性当然每个属性都有注释进行解释这里就不赘述了。 二、tab 标签 上面的代码中我们可以看到这个getTabbarWidget() 自定义的组件它就是我们需要自定义的一个tab 按钮部分了 Widget getTabbarWidget() {return TabBar(isScrollable: widget.isScrollable ?? false,controller: widget.controller,indicatorColor: widget.tabColors ?? Colours.app_main,// indicatorWeight:10,indicatorSize: widget.indicatorSize ?? TabBarIndicatorSize.label,indicatorPadding: const EdgeInsets.only(left: 0),indicator: UnderlineTabIndicator(insets: EdgeInsets.only(bottom: widget.lineBottom),borderRadius: const BorderRadius.all(Radius.circular(1)),borderSide: BorderSide(color: widget.tabColors ?? Colours.app_main,width: 2, //高度),),labelColor: widget.labelColor ?? Colours.app_main,unselectedLabelColor: widget.unselectedLabelColor ?? Colours.textBlack3,labelPadding:EdgeInsets.symmetric(horizontal: widget.horizontal ?? 20.w),labelStyle: TextStyle(fontSize: widget.textSize,fontWeight: FontWeight.w600,),unselectedLabelStyle: TextStyle(fontSize: widget.unTextSize),onTap: (value) {if (widget.didSelectIndex ! null) {widget.didSelectIndex!(value);}},tabs: widget.tabs.mapTab((String tab) {return Tab(text: tab,);}).toList()); }结合篇头的代码及注释我们可以简单的理解上面的每一行代码。这里需要说明的是如果你想自定义tab 的样式或者是其他的一些功能需求都可以直接在上面的代码中进行修改调整。 有人可能会有疑问代码的中的showLine到底判断的是啥 widget.showLine true? Container(height: 0.5,color: const Color(0xffe5e5e5),): Container(),其实它就是一个分界线可以根据自己的需求进行调整样式也可以根据showLine 参数进行判断是否需要添加分界线。 三、barView 既然我们封装的使用通用的tabbar那么barview 肯定是必不可少的接来下我们看看getTabbarViewWidget() 这个自定义的组件。 Widget getTabbarViewWidget() {if(widget.tabbarViewList.isNotEmpty){return Expanded(child: TabBarView(controller: widget.controller,children: widget.tabbarViewList,),);}else{return Container();} }getTabbarViewWidget 的代码就比较少了简单的来说就是穿一个个上下文controller 再传入你的widget 就可以了。 看到这里你学废了没 总结 简简单单一个widget复制粘贴直接用废话不多说啥没有写怎么调用不知道怎么调用你还是去看看前面的文章吧。
http://www.sadfv.cn/news/223015/

相关文章:

  • 门户网站建设方案公司个体户 网站建设
  • 注册网站账号审核不通过无法登陆怎么办黄石网站设计公司
  • 网站开发通过什么途径接活杭州最好的电商培训学校
  • wordpress搜站点网络中断跨境电商运营模式有哪些
  • 哪些企业需要做网站建设银行的网站用户名是什么意思
  • 网站地图seo公司小程序建设哪家好
  • 网站后台管理模板下载嘉兴seo管理
  • 网站的后台一般用什么做的谷歌外贸网站建站
  • 常用知名购物网站网站建设的例子
  • 做一手房做那个网站好网站如何被百度快速收录
  • 做二手车有哪些网站有哪些手续费宿迁网站建设sq918
  • 用手机可以建设一个手机网站吗房屋设计3d图用什么软件
  • 格朗图手表网站新媒体营销的优势
  • 做网站听的纯音乐做任务免费领取东西的网站
  • 南京网站如何制作网站建设外包需要注意哪些
  • 公司网站打不开柚段子wordpress
  • 网站续费贵是重新做个好还是续费大型网站开发合同
  • 企业网站 合同做网站工资高吗
  • 专业刷粉网站wordpress 4 chm
  • 建设一个大型网站大概费用无锡滨湖住房与城乡建设局网站
  • 网站开发 验收移交官网浏览器
  • 新手学做网站要多久信息化建设
  • 46设计网站官网国外游戏商城网站欣赏
  • 做软件下载网站违法吗怎样自己做免费网站
  • 网站开发与设计实训报告心得太原网站制作小程序
  • 永嘉专业网站设计公司新公司名字注册查询
  • 网站备案自己备案和代理备案宁波模版建站公司
  • 建筑网站在哪里找网站建设员的薪水
  • 做网站推广的好处4399网站开发者
  • 网站alt标签百度沈阳分公司地址在哪里