基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

120 lines
4.3 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart';
  3. import 'package:cached_network_image/cached_network_image.dart';
  4. import 'package:zhiying_comm/zhiying_comm.dart';
  5. class TeamInputWidget extends StatefulWidget {
  6. TeamStyleModel styleModel;
  7. TeamInputWidget(this.styleModel);
  8. @override
  9. _TeamInputWidgetState createState() => _TeamInputWidgetState();
  10. }
  11. class _TeamInputWidgetState extends State<TeamInputWidget> {
  12. TextEditingController _controller;
  13. FocusNode _focusNode;
  14. /// 搜索方法
  15. void _onSearchClick(){}
  16. @override
  17. void initState() {
  18. _controller = TextEditingController();
  19. _focusNode = FocusNode();
  20. super.initState();
  21. }
  22. @override
  23. void didChangeDependencies() {
  24. super.didChangeDependencies();
  25. }
  26. @override
  27. void dispose() {
  28. _focusNode?.unfocus();
  29. _focusNode?.dispose();
  30. _controller?.dispose();
  31. super.dispose();
  32. }
  33. @override
  34. void deactivate() {
  35. super.deactivate();
  36. _focusNode?.unfocus();
  37. }
  38. @override
  39. Widget build(BuildContext context) {
  40. return Container(
  41. width: double.infinity,
  42. height: double.infinity,
  43. padding: const EdgeInsets.only(top: 10, left: 12.5, right: 12.5),
  44. color: Colors.white,
  45. child: Row(
  46. children: <Widget>[
  47. /// 输入框
  48. Expanded(
  49. child: Container(
  50. height: 24,
  51. decoration: BoxDecoration(
  52. borderRadius: BorderRadius.circular(30),
  53. color: HexColor.fromHex(widget?.styleModel?.headerNoReferrerInputBgColor ?? '#F7F7F7'),
  54. ),
  55. padding: const EdgeInsets.only(top: 5, bottom: 4.5, left: 7.5, right: 7.5),
  56. width: double.infinity,
  57. child: Row(
  58. children: <Widget>[
  59. // Container(width: 11.5, height: 11.5, color: Colors.red,),
  60. CachedNetworkImage(imageUrl: widget?.styleModel?.searchBarLeftIcon, width: 11.5,),
  61. Expanded(child: Container(
  62. color: Colors.transparent,
  63. child: TextField(
  64. controller: _controller,
  65. focusNode: _focusNode,
  66. style: TextStyle(fontSize: 11 , color: HexColor.fromHex(widget?.styleModel?.headerNoReferrerInputColor ?? '#000000'), textBaseline: TextBaseline.alphabetic),
  67. decoration: InputDecoration(
  68. focusedBorder: InputBorder.none,
  69. border: InputBorder.none,
  70. focusedErrorBorder: InputBorder.none,
  71. errorBorder: InputBorder.none,
  72. disabledBorder: InputBorder.none,
  73. enabledBorder: InputBorder.none,
  74. filled: true,
  75. isDense: true,
  76. contentPadding: const EdgeInsets.only(left: 6, bottom: 0, top: 0, right: 0),
  77. fillColor: Colors.transparent,
  78. hintStyle: TextStyle(fontSize: 11 , color: HexColor.fromHex(widget?.styleModel?.searchBarHideTextColor ?? '#999999'), textBaseline: TextBaseline.alphabetic),
  79. hintText: widget?.styleModel?.searchBarHideText ?? '输入需搜索的手机号/昵称',
  80. ),
  81. ),
  82. ),),
  83. // Container(width: 15, height: 15, color: Colors.red,)
  84. CachedNetworkImage(imageUrl: widget?.styleModel?.searchBarRightIcon, width: 11.5,),
  85. ],
  86. ),
  87. ),
  88. ),
  89. const SizedBox(width: 8),
  90. /// 确定按钮
  91. GestureDetector(
  92. behavior: HitTestBehavior.opaque,
  93. onTap: ()=> _onSearchClick(),
  94. child: Container(
  95. decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: HexColor.fromHex(widget?.styleModel?.searchBarBtnBgColor ?? '#FF4242')),
  96. padding: const EdgeInsets.only(left: 15, right: 15, bottom: 6.5, top: 6.5),
  97. child: Text(widget?.styleModel?.searchBarBtnText ?? '搜索', style: TextStyle(color: HexColor.fromHex(widget?.styleModel?.searchBarBtnTextColor ?? '#FFFFFF'), fontSize: 11),),
  98. ),
  99. )
  100. ],
  101. ),
  102. );
  103. }
  104. }