基础组件库
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.

title_widget.dart 1.2 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import 'package:flutter/material.dart';
  2. import 'package:cached_network_image/cached_network_image.dart';
  3. import 'package:zhiying_comm/zhiying_comm.dart';
  4. class SearchTitleWidget extends StatelessWidget {
  5. final String titleText;
  6. final String titleTextColor;
  7. final String iconUrl;
  8. final VoidCallback callback;
  9. const SearchTitleWidget({
  10. this.titleText,
  11. this.titleTextColor,
  12. this.iconUrl,
  13. this.callback,
  14. });
  15. @override
  16. Widget build(BuildContext context) {
  17. return Container(
  18. width: double.infinity,
  19. child: Row(
  20. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  21. children: <Widget>[
  22. /// 标题
  23. _title(),
  24. /// icon
  25. Visibility(visible: !EmptyUtil.isEmpty(iconUrl), child: _icon()),
  26. ],
  27. ),
  28. );
  29. }
  30. Widget _title() {
  31. return Text(
  32. titleText,
  33. style: TextStyle(
  34. fontSize: 15,
  35. fontWeight: FontWeight.bold,
  36. color: HexColor.fromHex(titleTextColor),
  37. ),
  38. );
  39. }
  40. Widget _icon() {
  41. return GestureDetector(
  42. onTap: callback,
  43. child: CachedNetworkImage(
  44. imageUrl: iconUrl ?? '',
  45. width: 15,
  46. fit: BoxFit.fill,
  47. ),
  48. );
  49. }
  50. }