175 lines
6.6 KiB
Dart
175 lines
6.6 KiB
Dart
import 'package:ef/ef.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
|
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
|
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
|
|
|
class SleepDataModuleWidget extends StatefulWidget {
|
|
final Map<String, dynamic> data;
|
|
|
|
const SleepDataModuleWidget({super.key, required this.data});
|
|
|
|
@override
|
|
State<SleepDataModuleWidget> createState() => _SleepDataModuleWidgetState();
|
|
}
|
|
|
|
class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
|
|
@override
|
|
void setState(VoidCallback callback) {
|
|
super.setState(callback);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ThemeController themeController = Get.find();
|
|
return ClickableContainer(
|
|
backgroundColor: themeController.currentColor.sc5,
|
|
highlightColor: themeController.currentColor.sc3,
|
|
borderRadius: 20.rpx,
|
|
padding: EdgeInsetsDirectional.fromSTEB(18.rpx, 18.rpx, 18.rpx, 22.rpx),
|
|
onTap: () {
|
|
print('点击了离床次数卡片');
|
|
},
|
|
child: Container(
|
|
// width: MediaQuery.sizeOf(context).width * 0.267,
|
|
width: MediaQuery.sizeOf(context).width * 0.267,
|
|
constraints: BoxConstraints(
|
|
minWidth: 200.rpx,
|
|
minHeight: 161.rpx,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Text(
|
|
'${widget.data['name']}',
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 26.rpx,
|
|
letterSpacing: 0.0,
|
|
color: themeController.currentColor.sc3,
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text(
|
|
'${widget.data['value']}',
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: 40.rpx,
|
|
letterSpacing: 0.0,
|
|
color: themeController.currentColor.sc3,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 10.rpx),
|
|
child: Text(
|
|
'${widget.data['unit'] ?? ''}',
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: AppConstants().small_text_fontSize,
|
|
letterSpacing: 0.0,
|
|
color: themeController.currentColor.sc3,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// Container(
|
|
// width: MediaQuery.sizeOf(context).width * 0.07,
|
|
// height: MediaQuery.sizeOf(context).height * 0.014,
|
|
// constraints: BoxConstraints(
|
|
// minWidth: 43.rpx,
|
|
// minHeight: 36.rpx,
|
|
// ),
|
|
// child: FFButtonWidget(
|
|
// onPressed: () {
|
|
// print('Button pressed ...');
|
|
// },
|
|
// // text: '${widget.data['level']}',
|
|
// text: '${widget.data['level']}',
|
|
// options: FFButtonOptions(
|
|
// height: 40.rpx,
|
|
// padding: EdgeInsets.zero,
|
|
// // color: themeController.currentColor.sc14,
|
|
// color: stringToColor('${widget.data['color']}'),
|
|
// textStyle:
|
|
// FlutterFlowTheme.of(context).titleSmall.override(
|
|
// fontFamily: 'Inter Tight',
|
|
// color: themeController.currentColor.sc3,
|
|
// // color: stringToColor('${widget.data['color']}'),
|
|
// letterSpacing: 0.0,
|
|
// fontSize: 15.rpx,
|
|
// ),
|
|
// elevation: 0,
|
|
// borderRadius: BorderRadius.circular(8.rpx),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
|
|
ClickableContainer(
|
|
backgroundColor: stringToColor('${widget.data['color']}'),
|
|
highlightColor: themeController.currentColor.sc3,
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 0.rpx,
|
|
vertical: 0.rpx,
|
|
),
|
|
borderRadius: 8.rpx,
|
|
onTap: () {
|
|
print('Button pressed ...');
|
|
},
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
constraints: BoxConstraints(
|
|
minWidth: 43.rpx,
|
|
minHeight: 36.rpx,
|
|
),
|
|
child: Text(
|
|
'${widget.data['level']}',
|
|
style: FlutterFlowTheme.of(context).titleSmall.override(
|
|
fontFamily: 'Inter Tight',
|
|
color: themeController.currentColor.sc3,
|
|
letterSpacing: 0.0,
|
|
fontSize: 15.rpx,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
].divide(SizedBox(width: 0.rpx)),
|
|
),
|
|
Text(
|
|
'${widget.data['range']}',
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
fontSize: AppConstants().small_text_fontSize,
|
|
letterSpacing: 0.0,
|
|
color: themeController.currentColor.sc4,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|