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

房地产网页设计网站建设acg的wordpress主题

房地产网页设计网站建设,acg的wordpress主题,庆阳网约车,wordpress 网站地图带文字的TabBar指示器 1.绘制自定义TabBar的绿色带白色文字的指示器 2.将底部灰色文字与TabrBar层叠#xff0c;并调整高度位置与胶囊指示器重叠 自定义的带文字的TabBar指示器 import package:atui/jade/utils/JadeColors.dart; import package:flutter/material.dart; im…带文字的TabBar指示器 1.绘制自定义TabBar的绿色带白色文字的指示器 2.将底部灰色文字与TabrBar层叠并调整高度位置与胶囊指示器重叠 自定义的带文字的TabBar指示器 import package:atui/jade/utils/JadeColors.dart; import package:flutter/material.dart; import package:flutter_screenutil/flutter_screenutil.dart;class MyCustomTextIndicator extends Decoration {final String text;const MyCustomTextIndicator({required this.text});overrideBoxPainter createBoxPainter([VoidCallback onChanged]) {return _CustomTabIndicatorPainter(text: text);} }class _CustomTabIndicatorPainter extends BoxPainter {final String text;_CustomTabIndicatorPainter({required this.text});overridevoid paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {final rect Rect.fromLTWH(offset.dx - 40.w,configuration.size.height - 60.w,configuration.size.width 80.w,25,);final _gradientColors [JadeColors.green_16, JadeColors.green_12];final paint Paint()..shader LinearGradient(colors: _gradientColors).createShader(rect);canvas.drawRRect(RRect.fromRectAndRadius(rect, Radius.circular(15)), paint);final _textPainter TextPainter(text: TextSpan(text: text, style: TextStyle(color: Colors.white,fontSize: 22.sp,fontWeight: FontWeight.bold)),textDirection: TextDirection.ltr,);_textPainter.layout();_textPainter.paint(canvas, Offset(rect.left (rect.width - _textPainter.width) / 2, rect.top (rect.height - _textPainter.height) / 2));canvas.save();canvas.restore();} }引用 //tabBar标签tab数据 ListMapString, dynamic _tabs [{title: 严选, subTitle: 品质优选,range: 41},{title: 优惠, subTitle: 阿推优惠,range: 42},{title: 进口, subTitle: 阿推国际,range: 43},{title: 推享金, subTitle: 排行榜,range: 45},];_tabBar(){return Stack(alignment: Alignment.bottomCenter,children: [Padding(padding: EdgeInsets.only(bottom: 20.w),child: Wrap(alignment: WrapAlignment.start,spacing: 40.w,runSpacing: 0,children: List.generate(_tabs.length, (index) {return Container(alignment: Alignment.center,width: 124.w,child: Text(${_tabs[index][subTitle]},style: TextStyle(color: JadeColors.grey,fontSize: 22.sp,fontWeight: FontWeight.bold),),);}),)),Container(padding: EdgeInsets.symmetric(horizontal: 40.w),child: TabBar(controller: _tabController,isScrollable: false,labelPadding: EdgeInsets.only(left: 10,right: 10,bottom: 10.w),indicator: MyCustomTextIndicator(text: _tabs[_currentIndex][subTitle]),indicatorWeight: 60.w,labelColor: JadeColors.black,labelStyle: TextStyle(fontSize: 34.sp,fontWeight: FontWeight.bold,),unselectedLabelColor: JadeColors.black,unselectedLabelStyle: TextStyle(fontSize: 34.sp,fontWeight: FontWeight.bold,),indicatorSize: TabBarIndicatorSize.label,tabs: _tabs.map((e) Text(e[title])).toList(),onTap: (index) {setState(() {_currentIndex index;});print(_currentIndex $_currentIndex);},)),],);}_tabBarView(){return TabBarView(controller: _tabController,physics: const AlwaysScrollableScrollPhysics(),children: _tabs.map((e) {return MarketGoodsListPage(range: e[range]);}).toList());}上弦的弧形TabBar指示器 自定义指示器 import dart:math; import package:flutter/material.dart; import package:flutter_screenutil/flutter_screenutil.dart;/* * 自定义的上弦圆弧TabBar指示器 * */ class MyCustomArcIndicator extends Decoration {overrideBoxPainter createBoxPainter([VoidCallback onChanged]) {return _CustomBoxPainter(this, onChanged);} }class _CustomBoxPainter extends BoxPainter {final MyCustomArcIndicator decoration;_CustomBoxPainter(this.decoration, VoidCallback onChanged): super(onChanged);overridevoid paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {final size configuration.size;final newOffset Offset(offset.dx size.width / 2 - 10.w, size.height / 4);var paint Paint();double rowHeight 12;paint.strokeWidth rowHeight / 4;paint.style PaintingStyle.stroke;Path path Path();Rect rect Rect.fromLTWH(newOffset.dx, newOffset.dy rowHeight / 2, rowHeight, rowHeight);path.arcTo(rect, pi / 4,pi / 2, true);paint.color Color(0xFF56CEBA);paint.strokeCap StrokeCap.round;paint.style PaintingStyle.stroke;canvas.drawPath(path, paint);} }引用 _tabBar(){return TabBar(isScrollable: true,labelPadding: EdgeInsets.only(left: 10,right: 10,bottom: 10.w),indicator: MyCustomArcIndicator(),labelColor: JadeColors.black,labelStyle: TextStyle(fontSize: 36.sp,fontWeight: FontWeight.w600,),unselectedLabelColor: Color(0xff333333),unselectedLabelStyle: TextStyle(fontSize: 36.sp,),indicatorSize: TabBarIndicatorSize.label,controller: providerOfMainModel().tabController,tabs: MainModel.catList().map((e) Text(e[name])).toList(),onTap: (index) {providerOfMainModel().currentTabIndex index;if(index 7){Provider.ofRewardPoolModel(context, listen: false).searchMoneyData();}},);}普通的TabBar自定义指示器 图1 图2 自定义指示器 import package:flutter/material.dart;class MyCustomIndicator extends Decoration {final double indWidth;final double indHeight;final double radius;final ListColor indicatorColor;const MyCustomIndicator({this.indWidth 70.0, this.indHeight 12.0, this.radius 5, required this.indicatorColor});overrideBoxPainter createBoxPainter([VoidCallback onChanged]) {return _CustomBoxPainter(this, onChanged, indWidth, indHeight, radius, indicatorColor);} }class _CustomBoxPainter extends BoxPainter {final MyCustomIndicator decoration;final double indWidth;final double indHeight;final double radius;final ListColor indicatorColor;_CustomBoxPainter(this.decoration, VoidCallback onChanged, this.indWidth, this.indHeight, this.radius,this.indicatorColor): super(onChanged);overridevoid paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {final size configuration.size;final newOffset Offset(offset.dx (size.width - indWidth) / 2, size.height - indHeight);final Rect rect newOffset Size(indWidth, indHeight);final Paint paint Paint();if(indicatorColor null || indicatorColor.isEmpty){paint.color Colors.yellow;}else{if(indicatorColor.length 1){paint.color indicatorColor[0];}else if(indicatorColor.length 1){paint.shader LinearGradient(colors: indicatorColor, begin: Alignment.centerLeft, end: Alignment.centerRight).createShader(rect);}}paint.style PaintingStyle.fill;canvas.drawRRect(RRect.fromRectAndRadius(rect, Radius.circular(radius)), // 圆角半径paint,);canvas.save();canvas.restore();} }图1效果的引用 _tabBarView(){return Container(color: Colors.white,child: TabBar(isScrollable: false,labelPadding: EdgeInsets.symmetric(horizontal: 0),indicator: MyCustomIndicator(indicatorColor: [Colors.yellow]),labelColor: Color(0xff333333),labelStyle: TextStyle(fontSize: 30.sp,fontWeight: FontWeight.w600,),unselectedLabelColor: JadeColors.grey,unselectedLabelStyle: TextStyle(fontSize: 30.sp,fontWeight: FontWeight.w300),indicatorSize: TabBarIndicatorSize.label,controller: _tabController,tabs: _tabs.map((value) Container(padding: EdgeInsets.symmetric(horizontal: 20.w),child: Text(value))).toList(),onTap: (index) {},),);}图2效果的引用 TabBar(tabs: tabs,isScrollable: false,unselectedLabelColor: const Color(0xFF000000),labelStyle: TextStyle(fontWeight: FontWeight.bold),labelColor: const Color(0xFF000000),indicatorSize: TabBarIndicatorSize.label,indicator: MyCustomIndicator(indicatorColor: [JadeColors.red,JadeColors.yellow],indHeight: 8.w,indWidth: 92.w),controller: _tabController,)
http://www.dnsts.com.cn/news/101339.html

相关文章:

  • 网站开发方向c语言四川高速公路建设开发总公司网站
  • 建设工程考试官方网站中国平安人寿保险公司官网
  • 影楼网站源码个人备案的域名拿来做经营网站
  • 做企业展示型网站淘淘乐网站建设
  • 采集数据做网站手机网页 模板
  • 新建的网站打不开网站建设模块方案
  • 网站与网页 主页的概念及它们的区别wordpress主页美化
  • 建设部网站已经公布黑名单设计师网上接单被骗
  • 哪个网站可做密丸微信朋友圈推广软文
  • 洛阳做多屏合一网站godaddy wordpress主机
  • 开源php企业网站网站域名被重定向
  • 哈尔滨网站优化方式seo营销是什么意思
  • 做网站平台的工作李贤威 wordpress
  • 开网站做女装好还是童装好如何做seo搜索优化
  • 网站建设与营销小程序制作开发如意推
  • 专业苏州房产网站建设长沙市网站制作多少钱
  • 企业优化网站大连装修公司哪家口碑最好
  • 黄冈如何创建免费网站温州发生的重大新闻
  • 做网站学习中国石化工程建设有限公司首页
  • 正能量网站推荐wordpress自定义内容管理
  • 郴州网站seo公众号怎么绑定网站吗
  • 珠海移动网站定制南宁网站优化公司哪家好
  • 北京网站制作网站怎么样建立学校网站
  • 个人网站可以做论坛吗?网站建设的重要性 学校
  • 重庆建设行政主管部门网站注册一个公司需要花多少钱
  • 礼品公司网站源码智慧团建网站登录入口手机版
  • 建设论坛网站步骤去哪找网站建设公司好
  • 浙江网站建设营销网站开发市场人员的招聘
  • 高端网站建设 源码课程网站模板
  • 吉林市做网站公司教育网站建设情况报告