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

怎么自己做网站赚钱自媒体推广平台

怎么自己做网站赚钱,自媒体推广平台,淘宝建设网站首页,专门做餐饮ppt的网站总结了一下项目中用到的几种TabBar,针对不同的样式,有采用系统提供的,也有三方插件提供的,也有自定义的,效果如下(后续如果遇到新的样式,会不间断地记录更新,避免重复造轮子…&#…

总结了一下项目中用到的几种TabBar,针对不同的样式,有采用系统提供的,也有三方插件提供的,也有自定义的,效果如下(后续如果遇到新的样式,会不间断地记录更新,避免重复造轮子…)

请添加图片描述

用到的三方插件:

buttons_tabbar: ^1.3.8
flutter_easyloading: ^3.0.5

1、先看第一种系统的

在这里插入图片描述

代码如下:

class CustomTabBar extends StatelessWidget {final TabController tabController;final List<String> tabs;final TextStyle labelStyle;final Color labelColor;final Color unselectedLabelColor;final TextStyle unselectedLabelStyle;final Color indicatorColor;final double indicatorWeight;const CustomTabBar({super.key,required this.tabController,required this.tabs,this.labelStyle = const TextStyle(fontSize: 16.0,fontWeight: FontWeight.w700,),this.labelColor = Colors.blue,this.unselectedLabelColor = Colors.red,this.unselectedLabelStyle = const TextStyle(fontSize: 16.0,fontWeight: FontWeight.w400,),this.indicatorColor = Colors.blue,this.indicatorWeight = 5.0,});@overrideWidget build(BuildContext context) {return TabBar(controller: tabController,tabs: tabs.map((e) => Tab(text: e)).toList(),isScrollable: true,labelPadding: const EdgeInsets.symmetric(horizontal: 16.0),labelStyle: labelStyle,labelColor: labelColor,unselectedLabelColor: unselectedLabelColor,unselectedLabelStyle: unselectedLabelStyle,indicatorWeight: indicatorWeight,indicator: DotTabIndicator(color: indicatorColor,radius: 4,),onTap: (value) {},dividerColor: Colors.transparent, //去除tabBar下面的那根线的颜色);}
}class DotTabIndicator extends Decoration {final Color color;final double radius;const DotTabIndicator({required this.color, required this.radius});@overrideBoxPainter createBoxPainter([VoidCallback? onChanged]) {return _DotTabIndicatorPainter(this, onChanged!);}
}class _DotTabIndicatorPainter extends BoxPainter {final DotTabIndicator decoration;_DotTabIndicatorPainter(this.decoration, VoidCallback onChanged): super(onChanged);@overridevoid paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {final Rect rect = offset & configuration.size!;final Paint paint = Paint();paint.color = decoration.color;paint.style = PaintingStyle.fill;final Offset circleOffset =Offset(rect.center.dx, rect.bottomCenter.dy - decoration.radius);canvas.drawCircle(circleOffset, decoration.radius, paint);}
}

使用方法:

late final TabController _tabController;
final List<String> _tabs = ["能源洞察","用户故事","智汇回答",];final List<Widget> _tabViews = [Container(color: Colors.red),Container(color: Colors.yellow),Container(color: Colors.orange),];
@overridevoid initState() {super.initState();_tabController = TabController(initialIndex: 1,length: _tabs.length,vsync: this,);}@overridevoid dispose() {_tabController.dispose();super.dispose();}Container(height: 200,child: Column(children: [CustomTabBar(tabController: _tabController,indicatorWeight: 1,tabs: _tabs,),const SizedBox(height: 10.0),Expanded(child: TabBarView(controller: _tabController,children: _tabViews,),),],),),

第二种采用的三方插件buttons_tabbar: ^1.3.8

在这里插入图片描述

代码如下:

late final TabController _tabController;final List<String> _tabs = ["能源洞察","用户故事","智汇回答",];final List<Widget> _tabViews = [Container(color: Colors.red),Container(color: Colors.yellow),Container(color: Colors.orange),];
@overridevoid initState() {super.initState();_tabController = TabController(initialIndex: 0,length: _tabs.length,vsync: this,);}@overridevoid dispose() {_tabController.dispose();super.dispose();}SizedBox(height: 200,child: Column(children: [SizedBox(height: 32.0,child: ButtonsTabBar(tabs: _tabs.map((e) => Tab(text: e)).toList(),controller: _tabController,backgroundColor: Colors.blue,unselectedBackgroundColor: Colors.red,labelStyle: const TextStyle(color: Colors.white),unselectedLabelStyle: const TextStyle(color: Colors.black),buttonMargin: const EdgeInsets.only(right: 35),contentPadding:const EdgeInsets.symmetric(horizontal: 15.0),radius: 18,),),const SizedBox(height: 10.0),Expanded(child: TabBarView(controller: _tabController,children: _tabViews,),),],),),

第三种自定义

在这里插入图片描述

代码如下:

class ButtonContainer extends StatelessWidget {final int containerIndex;final ValueChanged<int> onContainerSelected;final bool isSelected;final List data;final Color backgroundColor;final Color unBackgroundColor;final TextStyle labelStyle;final TextStyle unLabelStyle;const ButtonContainer({super.key,required this.containerIndex,required this.onContainerSelected,required this.isSelected,required this.data,this.backgroundColor = Colors.grey,this.unBackgroundColor = Colors.red,this.labelStyle = const TextStyle(color: Colors.black,fontSize: 16,),this.unLabelStyle = const TextStyle(color: Colors.white,fontSize: 16,),});@overrideWidget build(BuildContext context) {return GestureDetector(onTap: () {onContainerSelected(containerIndex);},child: Container(padding: const EdgeInsets.all(8.0),margin: const EdgeInsets.all(10),decoration: BoxDecoration(color: isSelected ? backgroundColor : unBackgroundColor,borderRadius: BorderRadius.circular(8.0),),child: Text(data[containerIndex],style: isSelected ? labelStyle : unLabelStyle,),),);}
}

使用方法:

int selectedContainerIndex = 4; //默认选中第几个
final List<String> dataList = ["能源","用户故事","智回答","能洞察","用户故事","智汇答",];Wrap(children: List.generate(dataList.length, (index) {return ButtonContainer(containerIndex: index,onContainerSelected: (index) {setState(() {// 更新选中状态selectedContainerIndex = index;});EasyLoading.showToast("Click---${dataList[index]}");},isSelected: index == selectedContainerIndex,data: dataList,);}),),
代码已经都贴出来了,大方向已经指出标明,至于根据项目需求更改其中的细枝末节就需要自行动手了,有不懂的可以在下方留言,看到会及时回复😊

文章转载自:
http://hammertoe.c7622.cn
http://magnificat.c7622.cn
http://measuring.c7622.cn
http://hygienically.c7622.cn
http://tunisian.c7622.cn
http://jess.c7622.cn
http://fidley.c7622.cn
http://plodding.c7622.cn
http://spyhole.c7622.cn
http://indecorum.c7622.cn
http://fisticuff.c7622.cn
http://greenroom.c7622.cn
http://cartwright.c7622.cn
http://halakist.c7622.cn
http://nakedness.c7622.cn
http://cleat.c7622.cn
http://siphonaceous.c7622.cn
http://despond.c7622.cn
http://punakha.c7622.cn
http://recombinogenic.c7622.cn
http://malvoisie.c7622.cn
http://bootlegger.c7622.cn
http://collation.c7622.cn
http://affluent.c7622.cn
http://braver.c7622.cn
http://suite.c7622.cn
http://upi.c7622.cn
http://thunderboat.c7622.cn
http://ennui.c7622.cn
http://quotiety.c7622.cn
http://deaminize.c7622.cn
http://crepitate.c7622.cn
http://bereavement.c7622.cn
http://allopath.c7622.cn
http://boracic.c7622.cn
http://allergist.c7622.cn
http://headland.c7622.cn
http://metrology.c7622.cn
http://nasopharyngitis.c7622.cn
http://oncogenous.c7622.cn
http://quartal.c7622.cn
http://easterling.c7622.cn
http://coparceny.c7622.cn
http://rosace.c7622.cn
http://hebrides.c7622.cn
http://impersonalize.c7622.cn
http://maliciously.c7622.cn
http://shadowless.c7622.cn
http://dyschronous.c7622.cn
http://amylene.c7622.cn
http://chiropractic.c7622.cn
http://deflexed.c7622.cn
http://lyons.c7622.cn
http://fusicoccin.c7622.cn
http://longe.c7622.cn
http://braxy.c7622.cn
http://cachou.c7622.cn
http://bijugate.c7622.cn
http://sailboat.c7622.cn
http://polish.c7622.cn
http://aboardage.c7622.cn
http://panegyrical.c7622.cn
http://lineshaft.c7622.cn
http://archaistic.c7622.cn
http://osteoporosis.c7622.cn
http://nationally.c7622.cn
http://decanter.c7622.cn
http://shellfishery.c7622.cn
http://spatter.c7622.cn
http://leaguer.c7622.cn
http://aurelia.c7622.cn
http://cytomegalic.c7622.cn
http://hypoplastic.c7622.cn
http://stress.c7622.cn
http://sou.c7622.cn
http://radiostrontium.c7622.cn
http://micra.c7622.cn
http://hippie.c7622.cn
http://fosterling.c7622.cn
http://patagonian.c7622.cn
http://daylight.c7622.cn
http://tony.c7622.cn
http://ingratiating.c7622.cn
http://sintra.c7622.cn
http://vincible.c7622.cn
http://flores.c7622.cn
http://pigsticker.c7622.cn
http://novelistic.c7622.cn
http://bailor.c7622.cn
http://caucasus.c7622.cn
http://cubby.c7622.cn
http://paxwax.c7622.cn
http://footbridge.c7622.cn
http://setaceous.c7622.cn
http://shadberry.c7622.cn
http://haole.c7622.cn
http://island.c7622.cn
http://profaneness.c7622.cn
http://fluorocarbon.c7622.cn
http://trichromic.c7622.cn
http://www.zhongyajixie.com/news/90751.html

相关文章:

  • 赣州哪里可以做网站手机金融界网站
  • 做网站设计赚钱吗搜狗网址导航
  • 用dw做的企业网站郑州网络营销
  • 幼儿园主题网络图设计了不起的我山西seo顾问
  • 公司网站设计素材营销技巧第三季
  • 游戏网站logo制作长沙正规竞价优化服务
  • 创造网站的最简单 软件是哪个爱客crm
  • 私服充值网站怎么做的企查查在线查询
  • 建网站收费吗企业营销型网站建设
  • 互联网网站建设价格济南seo排名搜索
  • 佛山用户网站建站关键词优化难度分析
  • 昆山专业网站建设公司谷歌seo排名优化
  • 邯郸哪家公司做企业网站比较专业关键词优化策略有哪些
  • wordpress神级插件优化网站排名软件
  • 深圳龙华大浪做网站公司新闻类软文营销案例
  • 注册公司网站源码北京云无限优化
  • 只做健康产品的网站114网址大全
  • 现在用JAVA做网站用什么框架aso优化方法
  • 如何 html5 网站模板泉州seo按天计费
  • 苏州市吴江太湖新城建设局网站关键词生成器
  • 做哪类视频网站需要视频牌照超级优化
  • 知名企业网站建设站长工具排名查询
  • 做网站诊断满足seo需求的网站
  • 手机网站用什么程序做市场营销策划方案
  • 知名的网页制作公司哪家好长春网站优化体验
  • 凡客网站登陆外贸获客软件
  • 国内做网站上市公司百度快照推广有效果吗
  • wordpress商城视频教程名片seo什么意思
  • 自己怎么做免费网站四川企业seo
  • 个人可以做导购网站吗张家口网站seo