import 'package:cs_resources/generated/assets.dart';
import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:flutter/material.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

//下拉选的默认样式
class PickerContainer extends StatelessWidget {
  final bool enable;
  final String? hint;
  final String? content;
  final Widget? rightWidget;
  final double height;
  final Color? bgColor;
  final EdgeInsetsGeometry? margin;
  final void Function(BuildContext targetContext) onClick;

  const PickerContainer({
    required this.onClick,
    this.enable = true,
    this.hint,
    this.content,
    this.margin,
    this.rightWidget,
    this.bgColor,
    this.height = 55,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
        height: height,
        margin: margin,
        padding: const EdgeInsets.symmetric(horizontal: 15),
        decoration: BoxDecoration(
          color: bgColor ?? context.appColors.authFiledBG,
          borderRadius: const BorderRadius.all(Radius.circular(5)),
        ),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            MyTextView(
              content ?? "",
              hint: hint,
              textColor: context.appColors.textBlack,
              isFontMedium: true,
              fontSize: 16,
            ).expanded(),
            rightWidget != null
                ? rightWidget!
                : const MyAssetImage(
                    Assets.baseServiceTriangleDropDownIcon,
                    width: 11.5,
                    height: 6.5,
                  ),
          ],
        )).onTap(() {
      if (enable) {
        onClick.call(context);
      }
    });
  }
}
