follow_list_head.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import 'package:flutter/material.dart';
  2. class FollowListHead extends StatelessWidget {
  3. final String title;
  4. final String avatarUrl;
  5. final String description;
  6. const FollowListHead({Key key, this.title, this.avatarUrl, this.description})
  7. : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. var ivAvatar = CircleAvatar(
  11. backgroundImage: NetworkImage(avatarUrl),
  12. );
  13. var tvTitle = Text(
  14. title,
  15. style: TextStyle(
  16. fontSize: 14,
  17. color: Color(0xff333333),
  18. fontFamily: 'NotoSansHans-Medium',
  19. ),
  20. );
  21. var tvSubtitle = Text(
  22. description,
  23. maxLines: 1,
  24. overflow: TextOverflow.ellipsis,
  25. style: TextStyle(
  26. fontSize: 12,
  27. color: Color(0xff666666),
  28. ),
  29. );
  30. var btnFollow = Container(
  31. width: 40,
  32. height: 20,
  33. child: TextButton(
  34. child: Text(
  35. '+关注',
  36. style: TextStyle(
  37. fontSize: 12,
  38. fontFamily: 'NotoSansHans-Regular',
  39. color: Color(0xff666666),
  40. ),
  41. ),
  42. // borderSide: BorderSide(
  43. // color: Color(0xff333333),
  44. // width: 0.5,
  45. // style: BorderStyle.solid,
  46. // ),
  47. style: ButtonStyle(
  48. padding: MaterialStateProperty.all(EdgeInsets.all(0)),
  49. ),
  50. onPressed: () => null,
  51. ),
  52. );
  53. return ListTile(
  54. leading: ivAvatar,
  55. contentPadding: EdgeInsets.zero,
  56. title: tvTitle,
  57. subtitle: tvSubtitle,
  58. trailing: btnFollow,
  59. enabled: false,
  60. onTap: () {},
  61. );
  62. }
  63. }