picker_container.dart 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:widgets/ext/ex_widget.dart';
  5. import 'package:widgets/my_load_image.dart';
  6. import 'package:widgets/my_text_view.dart';
  7. //下拉选的默认样式
  8. class PickerContainer extends StatelessWidget {
  9. final bool enable;
  10. final String? hint;
  11. final String? content;
  12. final Widget? rightWidget;
  13. final double height;
  14. final Color? bgColor;
  15. final EdgeInsetsGeometry? margin;
  16. final VoidCallback onClick;
  17. const PickerContainer({
  18. required this.onClick,
  19. this.enable = true,
  20. this.hint,
  21. this.content,
  22. this.margin,
  23. this.rightWidget,
  24. this.bgColor,
  25. this.height = 55,
  26. });
  27. @override
  28. Widget build(BuildContext context) {
  29. return Container(
  30. height: height,
  31. margin: margin,
  32. padding: const EdgeInsets.symmetric(horizontal: 15),
  33. decoration: BoxDecoration(
  34. color: context.appColors.authFiledBG,
  35. borderRadius: const BorderRadius.all(Radius.circular(5)),
  36. ),
  37. child: Row(
  38. crossAxisAlignment: CrossAxisAlignment.center,
  39. children: [
  40. MyTextView(
  41. content ?? "",
  42. hint: hint,
  43. textColor: context.appColors.textBlack,
  44. isFontMedium: true,
  45. fontSize: 16,
  46. ).expanded(),
  47. rightWidget != null
  48. ? rightWidget!
  49. : const MyAssetImage(
  50. Assets.baseServiceTriangleDropDownIcon,
  51. width: 11.5,
  52. height: 6.5,
  53. ),
  54. ],
  55. )).onTap(() {
  56. if (enable) {
  57. onClick.call();
  58. }
  59. });
  60. }
  61. }