index.dart 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import 'package:farmer_client/pages/home/widgets/home/widgets/headers.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:get/get.dart';
  5. import '../../widgets/CarsCard.dart';
  6. import '../../widgets/Search.dart';
  7. class MoreCars extends StatefulWidget {
  8. const MoreCars({Key? key}) : super(key: key);
  9. @override
  10. State<MoreCars> createState() => _MoreCarsState();
  11. }
  12. class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
  13. late TabController _controller =
  14. TabController(length: tabText.length, vsync: this);
  15. List<String> tabText = [
  16. '全部',
  17. '播种机',
  18. '收割机',
  19. '挺长名字的农机选项分类',
  20. ];
  21. @override
  22. void initState() {
  23. // TODO: implement initState
  24. super.initState();
  25. }
  26. @override
  27. Widget build(BuildContext context) {
  28. // _controller=TabController(length: tabText.length, vsync: this);
  29. return Scaffold(
  30. resizeToAvoidBottomInset: false,
  31. appBar: AppBar(
  32. elevation: 0,
  33. centerTitle: true,
  34. backgroundColor: Colors.white,
  35. title: Text(
  36. '更多',
  37. style: TextStyle(
  38. color: Colors.black,
  39. fontSize: 17.sp,
  40. letterSpacing: 2,
  41. fontWeight: FontWeight.bold),
  42. ),
  43. ),
  44. body: Container(
  45. decoration: BoxDecoration(
  46. color: Colors.white
  47. ),
  48. child: ListView(
  49. children: [Column(
  50. children: [
  51. Container(
  52. padding: EdgeInsets.fromLTRB(0, 15, 0, 15),
  53. width: 350.w,
  54. child: TypeHeader(type: false,),
  55. ),
  56. TabBar(
  57. labelStyle: TextStyle(fontSize: ScreenUtil().setSp(19),fontWeight: FontWeight.bold), //选中的样式
  58. unselectedLabelStyle: TextStyle(fontSize:ScreenUtil().setSp(16)), //未选中的样式
  59. controller: _controller,
  60. isScrollable: true, //可滚动
  61. indicatorColor: Colors.black, //指示器的颜色
  62. labelColor: Colors.black, //选中文字颜色
  63. unselectedLabelColor: Color(0xffadadad),
  64. // indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽
  65. tabs: tabText.map((e) => Tab(text: e)).toList(),
  66. onTap: (int i) {
  67. print('当前+${i}');
  68. },
  69. ),
  70. Container(
  71. child: Column(
  72. children: [
  73. ],
  74. )
  75. ,
  76. )
  77. ],
  78. )]
  79. ),
  80. )
  81. );
  82. }
  83. }