161 lines
5.0 KiB
Dart
161 lines
5.0 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import '../../components/my_app_bar.dart';
|
|
import '../../util/util.dart';
|
|
import 'logic.dart';
|
|
|
|
class MyfeedbacklistPage extends StatelessWidget {
|
|
MyfeedbacklistPage({Key? key}) : super(key: key);
|
|
|
|
final logic = Get.find<MyfeedbacklistLogic>();
|
|
final state = Get.find<MyfeedbacklistLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<MyfeedbacklistLogic>(builder: (logic) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(getBaseImage("home_back")),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
appBar: const MyAppBar(centerTitle: '我的反馈',),
|
|
body: SafeArea(
|
|
child: logic.isLoad ? loaddingWidget(true) : logic.lists.isEmpty ? noResultWidget() : SmartRefresher(
|
|
controller: logic.refreshController,
|
|
onRefresh: _onRefresh,
|
|
onLoading: _onLoading,
|
|
child: ListView.builder(
|
|
|
|
itemCount: logic.lists.length,
|
|
itemBuilder: (context, index) {
|
|
return ListTile(
|
|
title: ListItem(logic.lists[index]),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),),
|
|
);
|
|
});
|
|
}
|
|
Widget ListItem(Post item) {
|
|
return Column(children: [
|
|
Text(item.createTime , style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
),),
|
|
Container(
|
|
margin: EdgeInsets.only(bottom: 12.0.sp,top: 12.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(8.0.sp),
|
|
color: const Color(0xff282733),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
|
|
Container(
|
|
padding:
|
|
EdgeInsets.symmetric(vertical: 16.0.sp, horizontal: 16.0.sp),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xff282733),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(8.0.sp),
|
|
topRight: Radius.circular(8.0.sp),
|
|
),
|
|
),
|
|
child: Text(
|
|
item.content,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 120.sp,
|
|
child: GridView.builder(
|
|
scrollDirection: Axis.vertical,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 3, // 每行显示的项目数量
|
|
),
|
|
itemCount:item.album.length, // Replace with your item count
|
|
itemBuilder: (context, index) {
|
|
|
|
// 后续项目,根据接口获取数据
|
|
// 假设通过接口获取到的数据存储在一个名为 data 的列表中
|
|
// var itemData = data[index - 1]; // 减去第一个固定图片的索引
|
|
return Container(
|
|
margin: EdgeInsets.all(5.sp),
|
|
child: Center(
|
|
child: _buildImageItem( item.album[index].url,// Replace with your item count
|
|
logic,index),
|
|
),
|
|
);
|
|
|
|
},
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 16.sp,right: 16.sp,bottom: 16.sp),
|
|
child: Text(
|
|
item.reply!=null?"反馈回复:"+item.reply:"审核中",
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
fontSize: 12.0.sp,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],);
|
|
}
|
|
|
|
|
|
|
|
Widget _buildImageItem(String url, MyfeedbacklistLogic controller, int index) {
|
|
return ClipRRect(
|
|
borderRadius: BorderRadius.circular(0.0),
|
|
child: SizedBox(
|
|
width: double.infinity, // 设置容器宽度为屏幕宽度
|
|
height: double.infinity, // 设置容器高度为屏幕高度
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(0.0),
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
// Get.toNamed(AppRoutes.Swiper, arguments: {
|
|
// 'imaglist': controller.lists.album,
|
|
// 'index': index
|
|
// });
|
|
},
|
|
child: Image.network(
|
|
fit: BoxFit.cover,
|
|
url,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _onRefresh() async {
|
|
logic.page = 1;
|
|
logic.initList();
|
|
}
|
|
|
|
void _onLoading() async {
|
|
logic.page = logic.page + 1;
|
|
logic.initList();
|
|
}
|
|
}
|