You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
4.3 KiB
132 lines
4.3 KiB
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import '../controllers/goodsmeet_controller.dart';
|
|
|
|
class GoodsmeetView extends GetView<GoodsmeetController> {
|
|
const GoodsmeetView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50],
|
|
appBar: AppBar(
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
|
elevation: 0.5,
|
|
title: Text(
|
|
'conferenceAssistant'.tr,
|
|
style: TextStyle(
|
|
fontSize: 18.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
),
|
|
),
|
|
centerTitle: true,
|
|
),
|
|
body: Obx(() {
|
|
if (controller.loading.value) {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
if (controller.error.isNotEmpty) {
|
|
return Center(child: Text(controller.error.value));
|
|
}
|
|
return ListView.separated(
|
|
padding: EdgeInsets.all(16.w),
|
|
itemCount: controller.items.length,
|
|
separatorBuilder: (_, __) => SizedBox(height: 12.h),
|
|
itemBuilder: (_, index) {
|
|
final item = controller.items[index];
|
|
return _buildCard(item, isDarkMode);
|
|
},
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
|
|
Widget _buildCard(MeetItem item, bool isDarkMode) {
|
|
return Container(
|
|
padding: EdgeInsets.all(16.w),
|
|
decoration: BoxDecoration(
|
|
color: isDarkMode ? Colors.grey[900] : Colors.white,
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: isDarkMode
|
|
? Colors.black.withOpacity(0.2)
|
|
: Colors.black.withOpacity(0.05),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 42.w,
|
|
height: 42.w,
|
|
decoration: BoxDecoration(
|
|
color: isDarkMode
|
|
? Colors.pink[900]!.withOpacity(0.3)
|
|
: Colors.pink[100]!,
|
|
borderRadius: BorderRadius.circular(21.r),
|
|
),
|
|
child: Icon(Icons.people_alt,
|
|
color: isDarkMode
|
|
? Colors.pink[300]!
|
|
: Colors.pink[600]!),
|
|
),
|
|
SizedBox(width: 12.w),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(item.title,
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
)),
|
|
SizedBox(height: 4.h),
|
|
Text(item.description,
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color:
|
|
isDarkMode ? Colors.white70 : Colors.grey[600],
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text('¥${item.price.toStringAsFixed(2)}',
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDarkMode ? Colors.white : Colors.black,
|
|
)),
|
|
SizedBox(height: 8.h),
|
|
GestureDetector(
|
|
onTap: () => controller.purchase(item),
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 12.w, vertical: 6.h),
|
|
decoration: BoxDecoration(
|
|
color: Colors.blue[600],
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
),
|
|
child: Text(
|
|
'购买',
|
|
style: TextStyle(fontSize: 12.sp, color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|