创建完整的 Flutter 项目结构,包含 Android 和 iOS 平台配置、核心网络层、路由、状态管理及业务模块(订单、收益、认证),适配原 uni-app 项目功能逻辑
60 lines
1.5 KiB
Dart
60 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
import '../../core/theme/app_colors.dart';
|
||
import '../../core/theme/app_dimens.dart';
|
||
|
||
/// 各页面 `.ios-card` 的等价实现:白底 + 浅描边 + 圆角 + 极淡阴影。
|
||
class XCard extends StatelessWidget {
|
||
const XCard({
|
||
super.key,
|
||
required this.child,
|
||
this.padding,
|
||
this.margin,
|
||
this.radius = AppRadius.xl,
|
||
this.background = AppColors.surfaceContainerLowest,
|
||
this.borderColor = AppColors.borderSoft,
|
||
this.shadows = AppShadows.card,
|
||
this.onTap,
|
||
});
|
||
|
||
final Widget child;
|
||
final EdgeInsetsGeometry? padding;
|
||
final EdgeInsetsGeometry? margin;
|
||
final double radius;
|
||
final Color background;
|
||
final Color borderColor;
|
||
|
||
/// 订单卡片用 [AppShadows.orderCard](0 2px 8px),其余用 [AppShadows.card]。
|
||
final List<BoxShadow> shadows;
|
||
final VoidCallback? onTap;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final r = BorderRadius.circular(radius);
|
||
final content = Container(
|
||
padding: padding,
|
||
decoration: BoxDecoration(
|
||
color: background,
|
||
border: Border.all(color: borderColor),
|
||
borderRadius: r,
|
||
boxShadow: shadows,
|
||
),
|
||
child: child,
|
||
);
|
||
|
||
return Padding(
|
||
padding: margin ?? EdgeInsets.zero,
|
||
child: onTap == null
|
||
? content
|
||
: Material(
|
||
color: Colors.transparent,
|
||
child: InkWell(
|
||
onTap: onTap,
|
||
borderRadius: r,
|
||
child: content,
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|