196 lines
6.3 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_logic.dart';
2024-08-02 13:52:37 +08:00
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_state.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/titleAppBar.dart';
class ValueAddedServicesBuyPage extends StatefulWidget {
const ValueAddedServicesBuyPage({Key? key}) : super(key: key);
@override
State<ValueAddedServicesBuyPage> createState() =>
_ValueAddedServicesBuyPageState();
}
class _ValueAddedServicesBuyPageState extends State<ValueAddedServicesBuyPage> {
2024-08-02 13:52:37 +08:00
@override
Widget build(BuildContext context) {
2024-08-02 13:52:37 +08:00
final int type = ModalRoute.of(context)!.settings.arguments! as int;
2024-08-02 13:52:37 +08:00
final ValueAddedServicesBuyLogic logic = Get.put(ValueAddedServicesBuyLogic());
final ValueAddedServicesBuyState state = Get.find<ValueAddedServicesBuyLogic>().state;
return Scaffold(
2023-07-28 17:14:11 +08:00
backgroundColor: AppColors.greyBackgroundColor,
appBar: TitleAppBar(
barTitle: _getNavTitle(type),
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
2024-08-02 13:52:37 +08:00
children: <Widget>[
Container(
width: 1.sw,
// height: 400.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 25.h, right: 25.h, top: 25.h, bottom: 10.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
2024-08-02 13:52:37 +08:00
children: <Widget>[
Text(
2024-08-02 13:52:37 +08:00
'选择套餐'.tr,
style: TextStyle(fontSize: 24.sp),
),
],
)),
Expanded(
2023-07-28 17:14:11 +08:00
child: Container(
color: Colors.white,
child: GridView.count(
padding: EdgeInsets.all(10.w),
crossAxisCount: 2,
mainAxisSpacing: 10.h,
crossAxisSpacing: 10.w,
childAspectRatio: 1 / 0.5,
children: state.topData.value
2024-08-02 13:52:37 +08:00
.map(_buildItem)
.toList(),
2023-07-28 17:14:11 +08:00
),
),
),
Container(
color: Colors.white,
padding: EdgeInsets.only(
left: 25.h, right: 25.h, top: 25.h, bottom: 10.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
2024-08-02 13:52:37 +08:00
children: <Widget>[
Text(
2024-08-02 13:52:37 +08:00
'支付方式'.tr,
2023-07-28 17:14:11 +08:00
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 20.h,
),
Row(
2024-08-02 13:52:37 +08:00
children: <Widget>[
Image.asset(
'images/mine/icon_mine_valueAddedServices_zfb.png',
2023-07-28 17:14:11 +08:00
width: 30.w,
height: 30.w,
),
SizedBox(width: 20.w),
Expanded(
2024-08-02 13:52:37 +08:00
child: Text('支付宝'.tr,
style: TextStyle(
2023-07-28 17:14:11 +08:00
fontSize: 24.sp, color: AppColors.blackColor))),
SizedBox(width: 5.w),
Image.asset(
2024-01-23 17:48:06 +08:00
'images/icon_round_select.png',
width: 40.w,
height: 40.w,
)
],
),
SizedBox(
height: 20.h,
),
],
),
),
Container(
height: 10.h,
color: const Color(0xFFF5F5F5),
),
Container(
2023-07-28 17:14:11 +08:00
height: 80.h,
color: Colors.white,
child: Row(
2024-08-02 13:52:37 +08:00
children: <Widget>[
SizedBox(width: 20.w),
Expanded(
2024-08-02 13:52:37 +08:00
child: Text('¥50',
style: TextStyle(
2023-07-28 17:14:11 +08:00
fontSize: 24.sp,
color: AppColors.mainColor,
fontWeight: FontWeight.w500))),
SizedBox(width: 5.w),
GestureDetector(
onTap: () {
logic.showToast('支付成功'.tr);
},
child: Container(
width: 180.w,
height: 100.h,
color: AppColors.mainColor,
child: Center(
2024-08-02 13:52:37 +08:00
child: Text('去支付'.tr,
style: TextStyle(
fontSize: 24.sp,
color: Colors.white,
fontWeight: FontWeight.w500)))),
)
],
),
2023-07-28 17:14:11 +08:00
),
SizedBox(
height: 30.h,
)
],
),
);
}
Container _buildItem(String title) {
return Container(
margin: EdgeInsets.all(10.w),
padding: EdgeInsets.only(left: 30.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
2024-08-02 13:52:37 +08:00
color: title == '1' ? const Color(0xFFEDF1FD) : Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20.h)),
border: Border.all(width: 0.5.w, color: Colors.black)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
2024-08-02 13:52:37 +08:00
children: <Widget>[
Text(
'500${''.tr}',
2023-07-28 17:14:11 +08:00
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
),
SizedBox(height: 10.h),
Text(
'¥50 (¥0.08/${''.tr})',
2023-07-28 17:14:11 +08:00
style: TextStyle(
fontSize: 20.sp, color: AppColors.placeholderTextColor),
),
],
),
);
}
String _getNavTitle(int type) {
2024-08-02 13:52:37 +08:00
String topTitle = '';
switch (type) {
case 1:
2024-08-02 13:52:37 +08:00
topTitle = '购买短信'.tr;
break;
case 2:
2024-08-02 13:52:37 +08:00
topTitle = '购买邮件'.tr;
break;
case 3:
2024-08-02 13:52:37 +08:00
topTitle = '购买实名认证次数'.tr;
break;
case 4:
2024-08-02 13:52:37 +08:00
topTitle = '开通高级功能'.tr;
break;
}
return topTitle;
}
}