123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import 'package:cs_resources/generated/assets.dart';
- import 'package:flutter/material.dart';
- import 'package:widgets/my_load_image.dart';
- import 'package:widgets/my_text_view.dart';
- class BorderSelectWidget extends StatelessWidget {
- final String text;
- final Color color;
- final double borderRadius;
- final void Function(BuildContext targetContext)? onTap; // 点击事件
- const BorderSelectWidget({
- Key? key,
- required this.text,
- required this.color,
- this.borderRadius = 15,
- this.onTap,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- onTap?.call(context);
- },
- child: Container(
- padding: EdgeInsets.only(left: 8.5, right: 8.5, top: 4, bottom: 4),
- decoration: BoxDecoration(
- border: Border.all(color: color, width: 0.5), // 边框颜色
- borderRadius: BorderRadius.circular(borderRadius), // 圆角
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min, // 使 Row 根据内容大小而收缩
- children: [
- MyTextView(
- text,
- textColor: color,
- fontSize: 14,
- isFontRegular: true,
- marginRight: 7,
- ),
- MyAssetImage(
- Assets.baseServiceBorderWidgetDropDown,
- color: color,
- height: 7.5,
- width: 4.5,
- ),
- ],
- ),
- ),
- );
- }
- }
|