120 lines
3.8 KiB
Dart
Executable File
120 lines
3.8 KiB
Dart
Executable File
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/videoLog/videoLog/videoLog_entity.dart';
|
|
import 'package:star_lock/main/lockDetail/videoLog/videoLogDownLoad/videoLogDownLoad_state.dart';
|
|
import 'package:star_lock/tools/dateTool.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/noData.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import 'videoLogDownLoad_logic.dart';
|
|
|
|
class VideoLogDownLoadPage extends StatefulWidget {
|
|
const VideoLogDownLoadPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<VideoLogDownLoadPage> createState() => _VideoLogDownLoadPageState();
|
|
}
|
|
|
|
class _VideoLogDownLoadPageState extends State<VideoLogDownLoadPage> {
|
|
final VideoLogDownLoadLogic logic = Get.put(VideoLogDownLoadLogic());
|
|
final VideoLogDownLoadState state = Get.find<VideoLogDownLoadLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
barTitle: '下载列表'.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor,
|
|
),
|
|
body: Container(
|
|
color: AppColors.greyBackgroundColor,
|
|
child: Column(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Obx(
|
|
() => state.videoLogDownloadList.isNotEmpty
|
|
? mainListView(state.videoLogDownloadList.value)
|
|
: NoData(),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
double itemW = (1.sw - 15.w * 4) / 3;
|
|
double itemH = (1.sw - 15.w * 4) / 3 + 40.h;
|
|
Widget mainListView(List<RecordListData> itemList) {
|
|
return ListView.separated(
|
|
itemCount: itemList.length,
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
separatorBuilder: (BuildContext c, int index) {
|
|
return const Divider(
|
|
height: 1,
|
|
color: Colors.transparent,
|
|
);
|
|
},
|
|
itemBuilder: (BuildContext c, int index) {
|
|
final RecordListData recordData = itemList[index];
|
|
return videoItem(recordData, index);
|
|
});
|
|
}
|
|
|
|
Widget videoItem(RecordListData recordData, int index) {
|
|
return Container(
|
|
padding:
|
|
EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
|
|
color: Colors.white,
|
|
child: Row(
|
|
children: <Widget>[
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(10.w),
|
|
child: Image(
|
|
fit: BoxFit.cover,
|
|
width: 120.w,
|
|
height: 80.w,
|
|
image: Image.network(recordData.imagesUrl ??
|
|
'images/icon_video_placeholder.jpg')
|
|
.image),
|
|
),
|
|
SizedBox(width: 15.w),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
Text(
|
|
DateTool()
|
|
.dateToYMDHNString(recordData.operateDate.toString()),
|
|
style: TextStyle(fontSize: 20.sp)),
|
|
],
|
|
),
|
|
Expanded(
|
|
child: SizedBox(
|
|
width: 20.w,
|
|
)),
|
|
GestureDetector(
|
|
onTap: () {},
|
|
child: Container(
|
|
width: 120.w,
|
|
height: 50.h,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: AppColors.mainColor),
|
|
borderRadius: BorderRadius.circular(8.w)),
|
|
child: Center(
|
|
child: Text('下载'.tr,
|
|
style: TextStyle(
|
|
fontSize: 20.sp, color: AppColors.mainColor)),
|
|
)),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|