基础组件库
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

57 wiersze
1.2 KiB

  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. }