headers.dart 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:get/get.dart';
  4. class TypeHeader extends StatefulWidget {
  5. TypeHeader({Key? key, required this.type}) : super(key: key);
  6. final bool type;
  7. @override
  8. State<TypeHeader> createState() => _TypeHeaderState();
  9. }
  10. class _TypeHeaderState extends State<TypeHeader> {
  11. @override
  12. Widget build(BuildContext context) {
  13. if (widget.type) {
  14. return GestureDetector(
  15. onTap: () {
  16. Get.toNamed("/citySelect");
  17. },
  18. child: Container(
  19. height: 32.w,
  20. decoration: BoxDecoration(color: Colors.white),
  21. child: Row(
  22. children: [
  23. Image(
  24. image: AssetImage('images/gpsImgae.png'),
  25. fit: BoxFit.cover,
  26. width: 14.w,
  27. height: 17.h,
  28. ),
  29. Padding(
  30. padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
  31. child: Text(
  32. '邓州市',
  33. style: TextStyle(
  34. color: Color(0xff202020),
  35. fontSize: 16.sp,
  36. fontWeight: FontWeight.bold,
  37. ),
  38. ),
  39. ),
  40. Container(
  41. padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
  42. child: Icon(Icons.arrow_drop_down),
  43. ),
  44. Expanded(
  45. flex: 1,
  46. child:_initWidget(),
  47. ),
  48. ],
  49. ),
  50. )
  51. );
  52. } else {
  53. return _initWidget();
  54. }
  55. }
  56. }
  57. //
  58. class _initWidget extends StatelessWidget {
  59. const _initWidget({Key? key}) : super(key: key);
  60. @override
  61. Widget build(BuildContext context) {
  62. return Container(
  63. height: 32.w,
  64. decoration: const BoxDecoration(color: Colors.white),
  65. child: GestureDetector(
  66. onTap: () {
  67. print('点击了搜索');
  68. Get.toNamed('/searchPage');
  69. },
  70. child: Container(
  71. decoration: const BoxDecoration(
  72. // color: Colors.red,
  73. color: Color(0x30cccccc),
  74. borderRadius: BorderRadius.all(Radius.circular(25)),
  75. ),
  76. child: Row(
  77. children: [
  78. Padding(
  79. padding: EdgeInsets.fromLTRB(10.w, 0, 5, 0),
  80. child: Icon(
  81. Icons.search,
  82. size: 19,
  83. color: Color(0xff666666),
  84. ),
  85. ),
  86. Text(
  87. '请输入关键字查询',
  88. style: TextStyle(color: Color(0xff666666), fontSize: 14),
  89. )
  90. ],
  91. ),
  92. )
  93. // Search(),
  94. ));
  95. }
  96. }