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

59 rivejä
1.7 KiB

  1. import 'package:chat/generated/i18n.dart';
  2. import 'package:flutter/material.dart';
  3. class TempUserChips extends StatelessWidget {
  4. final String city; //城市
  5. final int age; //年龄
  6. final String constellation; //星座
  7. final String professional; //职业
  8. final Color bgColor;
  9. final TextStyle fontStyle;
  10. final bool isCenter;
  11. const TempUserChips(
  12. {Key key,
  13. this.city,
  14. this.age,
  15. this.constellation,
  16. this.professional,
  17. this.bgColor,
  18. this.fontStyle,
  19. this.isCenter: false})
  20. : super(key: key);
  21. Widget _buildChip(str,Color tempColor) {
  22. return Container(
  23. margin: EdgeInsets.only(bottom: 5, right: 5),
  24. padding: EdgeInsets.symmetric(horizontal: 10, vertical: 3),
  25. decoration: BoxDecoration(
  26. // color: bgColor == null ? Constants.LightBlueBackgroundColor : bgColor,
  27. border: Border.all(color: Color(0xFFEC4163), width: 1),
  28. borderRadius: BorderRadius.circular(15.0),
  29. ),
  30. child: Text(
  31. str,
  32. textScaleFactor: 1.0,
  33. style: fontStyle == null
  34. ? TextStyle(
  35. fontSize: 11,
  36. color: Color(0xFFEC4163),
  37. )
  38. : fontStyle,
  39. textAlign: TextAlign.center,
  40. ),
  41. );
  42. }
  43. @override
  44. Widget build(BuildContext context) {
  45. return Wrap(
  46. alignment: isCenter ? WrapAlignment.center : WrapAlignment.start,
  47. crossAxisAlignment: WrapCrossAlignment.center,
  48. children: <Widget>[
  49. _buildChip(city,Color(0xff96C7FF)),
  50. _buildChip(professional,Color(0xffAC51F3)),
  51. _buildChip('$age ${I18n.of(context).years_old}-$constellation',Color(0xffF5A623)),
  52. ],
  53. );
  54. }
  55. }