269 lines
8.7 KiB
Dart
269 lines
8.7 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/appRouters.dart';
|
|
import 'package:star_lock/tools/noData.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import 'videoLog_logic.dart';
|
|
|
|
class VideoLogPage extends StatefulWidget {
|
|
const VideoLogPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<VideoLogPage> createState() => _VideoLogPageState();
|
|
}
|
|
|
|
class _VideoLogPageState extends State<VideoLogPage> {
|
|
final logic = Get.put(VideoLogLogic());
|
|
final state = Get.find<VideoLogLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
haveTitleWidget: true,
|
|
titleWidget: navBtn(),
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor,
|
|
),
|
|
body: Column(
|
|
children: [
|
|
// 云存顶部
|
|
Visibility(
|
|
visible: !state.isNavLocal.value,
|
|
child: vipTip()
|
|
),
|
|
// 本地顶部
|
|
Visibility(
|
|
visible: state.isNavLocal.value,
|
|
child: localTip()
|
|
),
|
|
// title加编辑按钮
|
|
editVideoTip(),
|
|
Visibility(
|
|
visible: !state.isNavLocal.value,
|
|
child: Expanded(
|
|
child: ListView.builder(
|
|
itemCount: 5,
|
|
itemBuilder: (c, index) {
|
|
return Column(children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w),
|
|
child: Row(
|
|
children: [
|
|
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)),
|
|
]
|
|
)),
|
|
mainListView(index)
|
|
],);
|
|
})
|
|
)
|
|
),
|
|
// 本地顶部
|
|
Visibility(
|
|
visible: state.isNavLocal.value,
|
|
child: Expanded(
|
|
child: state.localList.isNotEmpty ? ListView.builder(
|
|
itemCount: 5,
|
|
itemBuilder: (c, index) {
|
|
return Column(children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w),
|
|
child: Row(
|
|
children: [
|
|
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)),
|
|
]
|
|
)),
|
|
mainListView(index)
|
|
],);
|
|
}): const NoData()
|
|
)
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// nav按钮
|
|
Widget navBtn(){
|
|
return SizedBox(
|
|
width: 300.w,
|
|
// color: Colors.white,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
TextButton(
|
|
onPressed: (){
|
|
setState(() {
|
|
state.isNavLocal.value = false;
|
|
});
|
|
},
|
|
child: Obx(() => Text("云存",
|
|
style: state.isNavLocal.value == true ?
|
|
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600) :
|
|
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600)))
|
|
),
|
|
TextButton(
|
|
onPressed: (){
|
|
setState(() {
|
|
state.isNavLocal.value = true;
|
|
});
|
|
},
|
|
child: Obx(() => Text("本地",
|
|
style: state.isNavLocal.value == true ?
|
|
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600) :
|
|
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600)))
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// 云存顶部视频
|
|
Widget vipTip(){
|
|
return GestureDetector(
|
|
onTap: (){
|
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
|
},
|
|
child: Container(
|
|
height: 150.h,
|
|
margin: EdgeInsets.all(15.w),
|
|
padding: EdgeInsets.only(left:20.w, top:20.w, bottom:20.w, right: 10.w),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFF6F7F8),
|
|
borderRadius: BorderRadius.circular(20.h)
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text("3天滚动储存", style: TextStyle(fontSize: 24.sp)),
|
|
SizedBox(height: 10.h),
|
|
Text("星锁已为本设备免费提供3大滚动视频储存服务", style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
|
|
],
|
|
)),
|
|
SizedBox(width: 15.w),
|
|
Text("去升级", style: TextStyle(fontSize: 22.sp)),
|
|
Image(width: 40.w, height: 24.w, image: const AssetImage("images/icon_right_black.png"))
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 本地顶部
|
|
Widget localTip(){
|
|
return GestureDetector(
|
|
onTap: (){
|
|
Get.toNamed(Routers.videoLogDownLoadPage);
|
|
},
|
|
child: Container(
|
|
// height: 130.h,
|
|
margin: EdgeInsets.all(15.w),
|
|
padding: EdgeInsets.only(left:20.w, top:30.w, bottom:30.w, right: 10.w),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFF6F7F8),
|
|
borderRadius: BorderRadius.circular(20.h)
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// SizedBox(height: 20.h),
|
|
Text("下载列表", style: TextStyle(fontSize: 24.sp)),
|
|
SizedBox(height: 15.h),
|
|
Text("暂无下载内容", style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
|
|
],
|
|
)),
|
|
SizedBox(width: 15.w),
|
|
// Text("去升级", style: TextStyle(fontSize: 24.sp)),
|
|
Image(width: 40.w, height: 24.w, image: const AssetImage("images/icon_right_black.png"))
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 标题加编辑按钮
|
|
Widget editVideoTip(){
|
|
return Container(
|
|
margin: EdgeInsets.only(left:20.w),
|
|
child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(state.isNavLocal.value == true ? "已下载":"全部视频", style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)),
|
|
Expanded(child: SizedBox(width: 10.w)),
|
|
IconButton(
|
|
icon: Image(width: 40.w, height: 40.w, image: const AssetImage("images/main/icon_lockDetail_monitoringEditVoice.png")),
|
|
iconSize: 30,
|
|
color: Colors.black54, onPressed: () {
|
|
Get.toNamed(Routers.editVideoLogPage);
|
|
},
|
|
)
|
|
// TextButton(
|
|
// onPressed: (){
|
|
//
|
|
// },
|
|
// child: Image(width: 40.w, height: 40.w, image: const AssetImage("images/main/icon_lockDetail_monitoringEditVoice.png"),)
|
|
// ),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
var itemW = (1.sw - 15.w*4)/3;
|
|
var itemH = (1.sw - 15.w*4)/3+40.h;
|
|
|
|
// 云存列表
|
|
Widget mainListView(int index){
|
|
return GridView.builder(
|
|
padding: EdgeInsets.only(left: 15.w, right: 15.w),
|
|
itemCount: index+1,
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
//横轴元素个数
|
|
crossAxisCount: 3,
|
|
//纵轴间距
|
|
mainAxisSpacing: 15.w,
|
|
// 横轴间距
|
|
crossAxisSpacing: 15.w,
|
|
//子组件宽高长度比例
|
|
childAspectRatio: itemW/itemH
|
|
),
|
|
itemBuilder: (context, index) {
|
|
return videoItem((){
|
|
Get.toNamed(Routers.videoLogDetailPage);
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget videoItem(Function() action){
|
|
return GestureDetector(
|
|
onTap: action,
|
|
child: SizedBox(
|
|
width: itemW,
|
|
height: itemH,
|
|
child: Column(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(10.w),
|
|
child: Image(width: itemW, height: itemW, fit: BoxFit.fill, image: const AssetImage("images/main/icon_lockDetail_monitoringvoiceFrist.png")),
|
|
),
|
|
SizedBox(height:5.h),
|
|
Text("2023.10.23 10:00", style: TextStyle(fontSize: 20.sp))
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|