headers.dart 2.8KB

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