基础组件库
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

custom_bottom.dart 1.9 KiB

hace 4 años
hace 4 años
hace 4 años
hace 4 años
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import 'package:cached_network_image/cached_network_image.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_model.dart';
  4. import 'package:zhiying_comm/zhiying_comm.dart';
  5. class CustomButton extends StatelessWidget {
  6. final CustomButtonModel style;
  7. final VoidCallback onClick;
  8. const CustomButton(this.style, {Key key, this.onClick}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. var decoration = BoxDecoration(
  12. color: HexColor.fromHex(style.bgColor ?? ''),
  13. borderRadius: BorderRadius.circular(50));
  14. if (style.bgType == 'image') {
  15. decoration = BoxDecoration(
  16. image: DecorationImage(
  17. image: CachedNetworkImageProvider(style.bgImage ?? ''),
  18. fit: BoxFit.cover),
  19. borderRadius: BorderRadius.circular(50));
  20. }
  21. return GestureDetector(
  22. child: Container(
  23. width: double.infinity,
  24. height: double.infinity,
  25. decoration: decoration,
  26. child: Center(
  27. child: Row(
  28. crossAxisAlignment: CrossAxisAlignment.center,
  29. mainAxisAlignment: MainAxisAlignment.center,
  30. children: <Widget>[
  31. style.smallIcon == null || style.smallIcon == ''
  32. ? Container()
  33. : Container(
  34. width: 14,
  35. height: 14,
  36. margin: EdgeInsets.only(right: 4),
  37. child: CachedNetworkImage(
  38. imageUrl: style.smallIcon,
  39. fit: BoxFit.cover,
  40. ),
  41. ),
  42. Text(
  43. style.name,
  44. style: TextStyle(
  45. color: HexColor.fromHex(style.textColor ?? ''),
  46. fontSize: 14,
  47. ),
  48. )
  49. ],
  50. ),
  51. ),
  52. ),
  53. onTap: onClick,
  54. );
  55. }
  56. }