follow_list_head.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: OutlineButton(
  34. padding: EdgeInsets.all(0),
  35. child: Text(
  36. '+关注',
  37. style: TextStyle(
  38. fontSize: 12,
  39. fontFamily: 'NotoSansHans-Regular',
  40. color: Color(0xff666666),
  41. ),
  42. ),
  43. borderSide: BorderSide(
  44. color: Color(0xff333333),
  45. width: 0.5,
  46. style: BorderStyle.solid,
  47. ),
  48. onPressed: () => null,
  49. ),
  50. );
  51. return ListTile(
  52. leading: ivAvatar,
  53. contentPadding: EdgeInsets.zero,
  54. title: tvTitle,
  55. subtitle: tvSubtitle,
  56. trailing: btnFollow,
  57. enabled: false,
  58. onTap: () {},
  59. );
  60. }
  61. }