更新页面
This commit is contained in:
145
lib/component/home_page/SleepDataModuleWidget.dart
Normal file
145
lib/component/home_page/SleepDataModuleWidget.dart
Normal file
@@ -0,0 +1,145 @@
|
||||
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.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/controller/theme_controller/ThemeController.dart';
|
||||
|
||||
class SleepDataModuleWidget extends StatefulWidget {
|
||||
const SleepDataModuleWidget({super.key});
|
||||
|
||||
@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 Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.27,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 200.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: stringToColor("#313541"),
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(18.rpx, 18.rpx, 18.rpx, 22.rpx),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'离床次数',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 21.rpx,
|
||||
// ),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'4',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 40.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0, 0.rpx, 10.rpx),
|
||||
child: Text(
|
||||
'次',
|
||||
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,
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () {
|
||||
print('Button pressed ...');
|
||||
},
|
||||
text: '异常',
|
||||
options: FFButtonOptions(
|
||||
height: 40.rpx,
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0),
|
||||
color: stringToColor("#FF7159"),
|
||||
textStyle:
|
||||
FlutterFlowTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0.0,
|
||||
fontSize: 15.rpx,
|
||||
),
|
||||
elevation: 0,
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'正常值:0~2',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().small_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
136
lib/component/home_page/SleepDateWidget.dart
Normal file
136
lib/component/home_page/SleepDateWidget.dart
Normal file
@@ -0,0 +1,136 @@
|
||||
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.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 SleepDateWidget extends StatefulWidget {
|
||||
const SleepDateWidget({super.key});
|
||||
|
||||
@override
|
||||
State<SleepDateWidget> createState() => _SleepDateWidgetState();
|
||||
}
|
||||
|
||||
class _SleepDateWidgetState extends State<SleepDateWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeController themeController = Get.find();
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent, // 原 BoxDecoration 为空
|
||||
highlightColor:
|
||||
themeController.currentColor.sc3.withOpacity(0.1), // 自定义点击波纹颜色
|
||||
borderRadius: AppConstants().normal_container_radius, // 原来没设置圆角
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () {
|
||||
print("今日评分卡片点击");
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.19,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 143.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(10.rpx, 25.rpx, 10.rpx, 22.rpx),
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 14.rpx),
|
||||
child: Text(
|
||||
'今日',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 33.rpx),
|
||||
child: Text(
|
||||
'07/15',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 20.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 16.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'70',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 48.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#00C1AA")),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 16.rpx, 0, 0.rpx),
|
||||
child: Text(
|
||||
'分',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().small_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 0.2.rpx,
|
||||
height: 2.4.rpx,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 123.rpx,
|
||||
minHeight: 47.rpx,
|
||||
),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () {
|
||||
print('合格按钮点击');
|
||||
},
|
||||
text: '合格',
|
||||
options: FFButtonOptions(
|
||||
height: 40.rpx,
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(16.rpx, 0, 16.rpx, 0),
|
||||
iconPadding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0),
|
||||
color: stringToColor("#00C1AA"),
|
||||
textStyle:
|
||||
FlutterFlowTheme.of(context).titleSmall.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
elevation: 0,
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
45
lib/component/tool/ClickableContainer.dart
Normal file
45
lib/component/tool/ClickableContainer.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ClickableContainer extends StatelessWidget {
|
||||
final Color backgroundColor; // 容器背景色
|
||||
final Color highlightColor; // 点击时背景色
|
||||
final EdgeInsetsGeometry padding; // 内部间距
|
||||
final VoidCallback onTap; // 点击回调
|
||||
final Widget child; // 子组件
|
||||
final double borderRadius; // 容器圆角(可选,默认为0)
|
||||
|
||||
const ClickableContainer({
|
||||
Key? key,
|
||||
required this.backgroundColor,
|
||||
required this.highlightColor,
|
||||
required this.padding,
|
||||
required this.onTap,
|
||||
required this.child,
|
||||
this.borderRadius = 0, // 默认无圆角
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Ink(
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
onTap: onTap,
|
||||
splashColor: highlightColor.withOpacity(0.3), // 点击时的波纹效果
|
||||
child: Padding(
|
||||
padding: padding,
|
||||
child: child, // 内容自适应
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ class CustomCard extends StatefulWidget {
|
||||
final VoidCallback onTap; // 点击回调
|
||||
final List<Color> colors; // 背景颜色列表
|
||||
final Widget child; // 子组件
|
||||
final String title; // 标题
|
||||
final bool enableAnimation; // 是否启用动画效果
|
||||
final bool enableGradient; // 是否启用渐变
|
||||
|
||||
@@ -15,7 +14,6 @@ class CustomCard extends StatefulWidget {
|
||||
required this.onTap,
|
||||
required this.colors,
|
||||
required this.child,
|
||||
required this.title,
|
||||
this.enableAnimation = true, // 默认启用动画效果
|
||||
this.enableGradient = true, // 默认启用渐变效果
|
||||
}) : super(key: key);
|
||||
|
||||
37
lib/component/tool/FrostedDialog.dart
Normal file
37
lib/component/tool/FrostedDialog.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FrostedDialog extends StatelessWidget {
|
||||
final Widget child;
|
||||
final double blurSigma;
|
||||
final Color barrierColor;
|
||||
|
||||
const FrostedDialog({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.blurSigma = 5.0,
|
||||
this.barrierColor = const Color.fromRGBO(0, 0, 0, 0.5),
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
// 毛玻璃背景
|
||||
BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: blurSigma, sigmaY: blurSigma),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
),
|
||||
Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
backgroundColor: Colors.transparent, // 背景透明,由 child 自己决定
|
||||
child: child,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user