1,新增TimeLine
2,完善门锁日志页面
This commit is contained in:
parent
e93f8624cf
commit
c82b3493ca
@ -244,9 +244,9 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
_initReplySubscription();
|
// _initReplySubscription();
|
||||||
|
|
||||||
mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
getLockRecordLastUploadDataTime();
|
// getLockRecordLastUploadDataTime();
|
||||||
// senderReferEventRecordTime();
|
// senderReferEventRecordTime();
|
||||||
// senderReferEventRecordNumber();
|
// senderReferEventRecordNumber();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import 'package:cupertino_stepper/cupertino_stepper.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_advanced_calendar/flutter_advanced_calendar.dart';
|
import 'package:flutter_advanced_calendar/flutter_advanced_calendar.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:gzx_dropdown_menu/gzx_dropdown_menu.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
||||||
|
import 'package:timelines/timelines.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
@ -56,270 +54,143 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: Column(
|
||||||
child: Column(
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisSize: MainAxisSize.max,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Theme(
|
||||||
Theme(
|
data: theme.copyWith(
|
||||||
data: theme.copyWith(
|
textTheme: theme.textTheme.copyWith(
|
||||||
textTheme: theme.textTheme.copyWith(
|
titleMedium: theme.textTheme.titleMedium!.copyWith(
|
||||||
titleMedium: theme.textTheme.titleMedium!.copyWith(
|
fontSize: 16,
|
||||||
fontSize: 16,
|
color: theme.colorScheme.secondary,
|
||||||
color: theme.colorScheme.secondary,
|
|
||||||
),
|
|
||||||
bodyLarge: theme.textTheme.bodyLarge!.copyWith(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.black54,
|
|
||||||
),
|
|
||||||
bodyMedium: theme.textTheme.bodyMedium!.copyWith(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
primaryColor: AppColors.mainColor,
|
bodyLarge: theme.textTheme.bodyLarge!.copyWith(
|
||||||
highlightColor: Colors.yellow,
|
fontSize: 14,
|
||||||
disabledColor: Colors.green,
|
color: Colors.black54,
|
||||||
),
|
),
|
||||||
child: AdvancedCalendar(
|
bodyMedium: theme.textTheme.bodyMedium!.copyWith(
|
||||||
controller: state.calendarControllerCustom,
|
fontSize: 12,
|
||||||
events: state.events,
|
color: Colors.black87,
|
||||||
weekLineHeight: 48.0,
|
|
||||||
startWeekDay: 1,
|
|
||||||
innerDot: true,
|
|
||||||
keepLineSize: true,
|
|
||||||
calendarTextStyle: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
height: 1.3125,
|
|
||||||
letterSpacing: 0,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
primaryColor: AppColors.mainColor,
|
||||||
|
highlightColor: Colors.yellow,
|
||||||
|
disabledColor: Colors.green,
|
||||||
),
|
),
|
||||||
Stack(
|
child: AdvancedCalendar(
|
||||||
key: state.stackKey,
|
controller: state.calendarControllerCustom,
|
||||||
children: <Widget>[
|
events: state.events,
|
||||||
Column(
|
weekLineHeight: 48.0,
|
||||||
children: <Widget>[
|
startWeekDay: 1,
|
||||||
_buildHeaderView(),
|
innerDot: true,
|
||||||
],
|
keepLineSize: true,
|
||||||
),
|
calendarTextStyle: const TextStyle(
|
||||||
// 下拉菜单,注意GZXDropDownMenu目前只能在Stack内,后续有时间会改进,以及支持CustomScrollView和NestedScrollView
|
fontSize: 18,
|
||||||
_buildDropDownMenu()
|
fontWeight: FontWeight.w400,
|
||||||
],
|
height: 1.3125,
|
||||||
|
letterSpacing: 0,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
OrientationBuilder(
|
),
|
||||||
builder: (BuildContext context, Orientation orientation) {
|
Row(children: [
|
||||||
switch (orientation) {
|
SizedBox(
|
||||||
case Orientation.portrait:
|
width: 30.w,
|
||||||
return _buildStepper(StepperType.vertical);
|
|
||||||
case Orientation.landscape:
|
|
||||||
return _buildStepper(StepperType.horizontal);
|
|
||||||
default:
|
|
||||||
throw UnimplementedError(orientation.toString());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
Obx(() => DropdownButton<String>(
|
||||||
),
|
value: state.dropdownValue.value,
|
||||||
),
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
);
|
iconSize: 40,
|
||||||
}
|
elevation: 12,
|
||||||
|
style: TextStyle(fontSize: 26.sp, color: Colors.black),
|
||||||
//下拉头部控件GZXDropDownHeader
|
iconEnabledColor: Colors.grey,
|
||||||
Widget _buildHeaderView() {
|
onChanged: (newValue) {
|
||||||
return GZXDropDownHeader(
|
state.dropdownValue.value = newValue!;
|
||||||
// 下拉的头部项,目前每一项,只能自定义显示的文字、图标、图标大小修改
|
},
|
||||||
items: [
|
items: state.dropDownItemList.obs
|
||||||
GZXDropDownHeaderItem(state.dropDownDoorLockItem[0], iconSize: 36),
|
.map<DropdownMenuItem<String>>((item) {
|
||||||
],
|
return DropdownMenuItem<String>(
|
||||||
// GZXDropDownHeader对应第一父级Stack的key
|
value: item,
|
||||||
stackKey: state.stackKey,
|
child: Text(item),
|
||||||
// controller用于控制menu的显示或隐藏
|
);
|
||||||
controller: state.dropdownMenuController,
|
}).toList(),
|
||||||
// 当点击头部项的事件,在这里可以进行页面跳转或openEndDrawer
|
))
|
||||||
onItemTap: (index) {},
|
]),
|
||||||
// 头部的高度
|
SizedBox(
|
||||||
height: 46,
|
height: 20.h,
|
||||||
// 头部背景颜色
|
),
|
||||||
color: Colors.white,
|
Expanded(
|
||||||
// 文字样式
|
child: Container(
|
||||||
style: TextStyle(
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
color: AppColors.darkGrayTextColor, fontSize: ScreenUtil().setSp(24)),
|
//给contain设置一个10像素的圆角
|
||||||
// 下拉时文字样式
|
decoration: BoxDecoration(
|
||||||
dropDownStyle: TextStyle(
|
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
|
||||||
fontSize: ScreenUtil().setSp(24),
|
child: Timeline.tileBuilder(
|
||||||
color: AppColors.darkGrayTextColor,
|
builder: TimelineTileBuilder.fromStyle(
|
||||||
),
|
contentsAlign: ContentsAlign.basic,
|
||||||
// 图标大小
|
contentsBuilder: (context, index) => Padding(
|
||||||
iconSize: 20,
|
padding: EdgeInsets.all(24.0.w),
|
||||||
// 图标颜色
|
child: Column(
|
||||||
iconColor: AppColors.greyBackgroundColor,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
// 下拉时图标颜色
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
iconDropDownColor: AppColors.mainColor,
|
children: [
|
||||||
);
|
Text('09:30 有人出现在门口',
|
||||||
}
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
//下拉菜单
|
color: AppColors.darkGrayTextColor,
|
||||||
Widget _buildDropDownMenu() {
|
fontSize: 24.sp,
|
||||||
return Obx(() => GZXDropDownMenu(
|
)),
|
||||||
// controller用于控制menu的显示或隐藏
|
SizedBox(
|
||||||
controller: state.dropdownMenuController,
|
height: 10.h,
|
||||||
// 下拉菜单显示或隐藏动画时长
|
),
|
||||||
animationMilliseconds: 300,
|
const Image(
|
||||||
// 下拉后遮罩颜色
|
image: AssetImage(
|
||||||
// maskColor: Theme.of(context).primaryColor.withOpacity(0.5),
|
'images/main/icon_lockDetail_monitoringvoiceFrist.png')),
|
||||||
// maskColor: Colors.red.withOpacity(0.5),
|
],
|
||||||
dropdownMenuChanging: (isShow, index) {},
|
|
||||||
dropdownMenuChanged: (isShow, index) {},
|
|
||||||
// 下拉菜单,高度自定义,你想显示什么就显示什么,完全由你决定,你只需要在选择后调用_dropdownMenuController.hide();即可
|
|
||||||
menus: [
|
|
||||||
GZXDropdownMenuBuilder(
|
|
||||||
dropDownHeight: 44.0.h * state.eventSortConditions.value.length,
|
|
||||||
dropDownWidget: _buildConditionListWidget(
|
|
||||||
state.eventSortConditions.value, (value) {
|
|
||||||
state.selectGroupSortCondition = value;
|
|
||||||
state.dropDownDoorLockItem[0] =
|
|
||||||
state.selectGroupSortCondition.name;
|
|
||||||
})),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
_buildConditionListWidget(
|
|
||||||
items, void Function(SortCondition sortCondition) itemOnTap) {
|
|
||||||
return Container(
|
|
||||||
color: Colors.white,
|
|
||||||
child: ListView.separated(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
scrollDirection: Axis.vertical,
|
|
||||||
itemCount: items.length,
|
|
||||||
// item 的个数
|
|
||||||
separatorBuilder: (BuildContext context, int index) =>
|
|
||||||
const Divider(height: 1.0),
|
|
||||||
// 添加分割线
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return gestureDetector(items, index, itemOnTap, context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GestureDetector gestureDetector(
|
|
||||||
items,
|
|
||||||
int index,
|
|
||||||
void Function(SortCondition sortCondition) itemOnTap,
|
|
||||||
BuildContext context) {
|
|
||||||
SortCondition goodsSortCondition = items[index];
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
for (var value in items) {
|
|
||||||
value.isSelected = false;
|
|
||||||
}
|
|
||||||
goodsSortCondition.isSelected = true;
|
|
||||||
|
|
||||||
itemOnTap(goodsSortCondition);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 44.h,
|
|
||||||
child: Center(
|
|
||||||
child: Obx(() => Text(
|
|
||||||
goodsSortCondition.name,
|
|
||||||
style: TextStyle(
|
|
||||||
color: goodsSortCondition.isSelected
|
|
||||||
? AppColors.mainColor
|
|
||||||
: Colors.black,
|
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
),
|
itemCount: 10,
|
||||||
));
|
),
|
||||||
}
|
theme: TimelineThemeData(
|
||||||
|
nodePosition: 0.04, //居左侧距离
|
||||||
CupertinoStepper _buildStepper(StepperType type) {
|
connectorTheme: const ConnectorThemeData(
|
||||||
final canCancel = state.currentStep.value > 0;
|
thickness: 2.0,
|
||||||
final canContinue = state.currentStep.value < 3;
|
color: AppColors.greyBackgroundColor,
|
||||||
return CupertinoStepper(
|
indent: 0.5),
|
||||||
type: type,
|
indicatorTheme: const IndicatorThemeData(
|
||||||
currentStep: state.currentStep.value,
|
size: 16.0,
|
||||||
onStepTapped: (step) => setState(() => state.currentStep.value = step),
|
color: AppColors.greyBackgroundColor,
|
||||||
onStepCancel:
|
position: 0.07),
|
||||||
canCancel ? () => setState(() => --state.currentStep.value) : null,
|
),
|
||||||
onStepContinue:
|
),
|
||||||
canContinue ? () => setState(() => ++state.currentStep.value) : null,
|
)),
|
||||||
steps: [
|
],
|
||||||
for (var i = 0; i < 3; ++i)
|
|
||||||
_buildStep(
|
|
||||||
title: const Text(''),
|
|
||||||
isActive: i == state.currentStep.value,
|
|
||||||
state: i == state.currentStep.value
|
|
||||||
? StepState.editing
|
|
||||||
: i < state.currentStep.value
|
|
||||||
? StepState.complete
|
|
||||||
: StepState.indexed,
|
|
||||||
),
|
|
||||||
// _buildStep(
|
|
||||||
// title: Text('Error'),
|
|
||||||
// state: StepState.error,
|
|
||||||
// ),
|
|
||||||
// _buildStep(
|
|
||||||
// title: Text('Disabled'),
|
|
||||||
// state: StepState.disabled,
|
|
||||||
// )
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Step _buildStep({
|
|
||||||
required Widget title,
|
|
||||||
StepState state = StepState.indexed,
|
|
||||||
bool isActive = false,
|
|
||||||
}) {
|
|
||||||
return Step(
|
|
||||||
title: title,
|
|
||||||
subtitle: const Text('10:45 有人出现在门口'),
|
|
||||||
state: state,
|
|
||||||
isActive: isActive,
|
|
||||||
content: LimitedBox(
|
|
||||||
maxWidth: 300,
|
|
||||||
maxHeight: 300,
|
|
||||||
child: Container(color: CupertinoColors.systemGrey),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String getTypeIcon(int type) {
|
String getTypeIcon(int type) {
|
||||||
String title = 'images/controls_user.png';
|
String title = 'images/controls_user.png';
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
// 蓝牙开锁
|
// 蓝牙开锁
|
||||||
title = 'images/controls_user.png';
|
title = 'images/controls_user.png';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// 密码开锁
|
// 密码开锁
|
||||||
title = 'images/icon_password.png';
|
title = 'images/icon_password.png';
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// ic卡
|
// ic卡
|
||||||
title = 'images/icon_card.png';
|
title = 'images/icon_card.png';
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
// 指纹开锁
|
// 指纹开锁
|
||||||
title = 'images/icon_fingerprint.png';
|
title = 'images/icon_fingerprint.png';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
return title;
|
||||||
}
|
}
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SortCondition {
|
|
||||||
String name;
|
|
||||||
bool isSelected;
|
|
||||||
|
|
||||||
SortCondition({
|
|
||||||
required this.name,
|
|
||||||
required this.isSelected,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_advanced_calendar/flutter_advanced_calendar.dart';
|
import 'package:flutter_advanced_calendar/flutter_advanced_calendar.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:gzx_dropdown_menu/gzx_dropdown_menu.dart';
|
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart';
|
|
||||||
|
|
||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import '../electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
@ -11,25 +8,14 @@ class DoorLockLogState {
|
|||||||
final keyInfos = LockListInfoItemEntity().obs;
|
final keyInfos = LockListInfoItemEntity().obs;
|
||||||
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
final lockOperatingRecordListData = <KeyRecordDataItem>[].obs;
|
||||||
final calendarControllerToday = AdvancedCalendarController.today();
|
final calendarControllerToday = AdvancedCalendarController.today();
|
||||||
final calendarControllerCustom =
|
final calendarControllerCustom = AdvancedCalendarController.today();
|
||||||
AdvancedCalendarController(DateTime(2024, 01, 10));
|
|
||||||
final events = <DateTime>[
|
final events = <DateTime>[
|
||||||
DateTime.now(),
|
DateTime.now(),
|
||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
final eventSortConditions = [
|
var dropdownValue = '全部事件'.obs;
|
||||||
SortCondition(name: '全部事件', isSelected: true),
|
final List dropDownItemList =
|
||||||
SortCondition(name: '门锁异常', isSelected: false),
|
['全部事件', '门锁异常', '有人出现', '有人按门铃', '一次性密码开门'].obs;
|
||||||
SortCondition(name: '有人出现', isSelected: false),
|
|
||||||
SortCondition(name: '有人按门铃', isSelected: false),
|
|
||||||
SortCondition(name: '一次性密码开门', isSelected: false)
|
|
||||||
].obs;
|
|
||||||
final List dropDownDoorLockItem = ['全部事件'];
|
|
||||||
final GZXDropdownMenuController dropdownMenuController =
|
|
||||||
GZXDropdownMenuController();
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
|
||||||
final GlobalKey stackKey = GlobalKey();
|
|
||||||
late SortCondition selectGroupSortCondition = eventSortConditions.value[0];
|
|
||||||
var currentStep = 0.obs;
|
var currentStep = 0.obs;
|
||||||
|
|
||||||
DoorLockLogState() {
|
DoorLockLogState() {
|
||||||
|
|||||||
@ -135,9 +135,7 @@ dependencies:
|
|||||||
#监听网络连接状态
|
#监听网络连接状态
|
||||||
connectivity_plus: ^5.0.2
|
connectivity_plus: ^5.0.2
|
||||||
flutter_advanced_calendar: ^1.4.1
|
flutter_advanced_calendar: ^1.4.1
|
||||||
#下拉选择菜单框
|
timelines: ^0.1.0
|
||||||
gzx_dropdown_menu: ^3.1.0
|
|
||||||
cupertino_stepper: ^0.2.1
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user