omnAPP/lib/app/modules/kr_home/widgets/kr_subscription_card.dart
2025-09-23 16:23:15 +08:00

109 lines
3.1 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';
import '../../../widgets/kr_app_text_style.dart';
/// 订阅卡片组件
class KRSubscriptionCard extends StatelessWidget {
const KRSubscriptionCard({
super.key,
});
@override
Widget build(BuildContext context) {
return _kr_buildSubscriptionCard(context);
}
// 构建订阅卡片
Widget _kr_buildSubscriptionCard(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12.w),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 44.w,
height: 44.w,
margin: EdgeInsets.only(top: 16.h),
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
Icons.language,
color: Colors.blue,
size: 26.w,
),
),
SizedBox(height: 12.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Text(
AppTranslations.kr_home.subscriptionDescription,
textAlign: TextAlign.center,
style: KrAppTextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
),
),
SizedBox(height: 16.h),
Padding(
padding: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
child: SizedBox(
width: double.infinity,
height: 42.h,
child: ElevatedButton(
onPressed: () => Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.r),
),
),
child: Text(
AppTranslations.kr_home.subscribe,
style: KrAppTextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
),
),
],
),
);
}
Widget _kr_buildListContainer(
BuildContext context, {
required Widget child,
EdgeInsetsGeometry? margin,
bool addBottomPadding = true,
}) {
return Container(
margin: margin ?? EdgeInsets.symmetric(horizontal: 16.w),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12.w),
),
child: IntrinsicWidth(
child: child,
),
);
}
}