Files
smart_grid_iot_app_flutter/lib/shared/widgets/x_chip.dart
T
andyesfly 56830e94ec feat: 完成智能电网电工端 Flutter 应用初始化
创建完整的 Flutter 项目结构,包含 Android 和 iOS 平台配置、核心网络层、路由、状态管理及业务模块(订单、收益、认证),适配原 uni-app 项目功能逻辑
2026-10-06 11:54:10 +08:00

45 lines
1.2 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import '../../core/theme/app_colors.dart';
/// 订单类型标签。对应源里的 `.order-type` / `.job-type`:
/// - `urgent` 紧急:浅红底 + 深红字
/// - `standard` 标准 / `regular` 常规:浅灰底 + 深灰字
///
/// 列表页字号 10,详情页 13,用 [compact] 区分。
class XTypeChip extends StatelessWidget {
const XTypeChip({
super.key,
required this.type,
required this.text,
this.compact = true,
});
/// `urgent` | `standard` | `regular`
final String type;
final String text;
final bool compact;
@override
Widget build(BuildContext context) {
final urgent = type == 'urgent';
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: urgent ? AppColors.errorContainer : AppColors.surfaceContainerHigh,
borderRadius: BorderRadius.circular(8),
),
child: Text(
text,
style: TextStyle(
fontSize: compact ? 10 : 13,
fontWeight: FontWeight.w600,
color: urgent
? (compact ? AppColors.onErrorContainer : AppColors.error)
: AppColors.onSurfaceVariant,
),
),
);
}
}