初始化项目
This commit is contained in:
85
lib/pages/main_bottom/e_page.dart
Normal file
85
lib/pages/main_bottom/e_page.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class EPage extends StatefulWidget {
|
||||
const EPage({super.key});
|
||||
|
||||
@override
|
||||
State<EPage> createState() => _EPageState();
|
||||
}
|
||||
|
||||
class _EPageState extends State<EPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: AppColors.bg_color,
|
||||
// automaticallyImplyLeading: false,
|
||||
// title: Container(
|
||||
// width: double.infinity,
|
||||
// height: 70.rpx,
|
||||
// child: Obx(
|
||||
// () => InkWell(
|
||||
// onTap: () {
|
||||
// Get.toNamed("/editUserInfoPage");
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 56.rpx,
|
||||
// height: 56.rpx,
|
||||
// clipBehavior: Clip.antiAlias,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// width: 20.rpx,
|
||||
// height: 0,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// shape: BoxShape.rectangle,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// userInfoController.model.user!.nickName ?? '匿名',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// actions: [],
|
||||
// centerTitle: false,
|
||||
// ),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Text("小e"),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
396
lib/pages/main_bottom/home_page.dart
Normal file
396
lib/pages/main_bottom/home_page.dart
Normal file
@@ -0,0 +1,396 @@
|
||||
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/CustomCard.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: AppColors.bg_color,
|
||||
// automaticallyImplyLeading: false,
|
||||
// title: Container(
|
||||
// width: double.infinity,
|
||||
// height: 70.rpx,
|
||||
// child: Obx(
|
||||
// () => InkWell(
|
||||
// onTap: () {
|
||||
// Get.toNamed("/editUserInfoPage");
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 56.rpx,
|
||||
// height: 56.rpx,
|
||||
// clipBehavior: Clip.antiAlias,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// width: 20.rpx,
|
||||
// height: 0,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// shape: BoxShape.rectangle,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// userInfoController.model.user!.nickName ?? '匿名',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// actions: [],
|
||||
// centerTitle: false,
|
||||
// ),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
// child: Text("首页"),
|
||||
child: Container(
|
||||
height: bodySize.maxHeight,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgImage.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
AppConstants().main_left_right_padding,
|
||||
47.rpx,
|
||||
AppConstants().main_left_right_padding,
|
||||
0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
AppConstants().content_left_right_padding,
|
||||
0,
|
||||
AppConstants().content_left_right_padding,
|
||||
0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
Get.toNamed("/loginPage");
|
||||
},
|
||||
title: '首页.登录'
|
||||
.tr, // 虽然 title 传入了,但当前组件里没用它(可忽略或用于调试)
|
||||
colors: [
|
||||
stringToColor("#45D989"),
|
||||
stringToColor("#00C1AA"),
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0, 16.rpx, 0),
|
||||
child: Text(
|
||||
'首页.登录'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Icon(
|
||||
Icons.add_circle_outline_outlined,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
size: 38.rpx,
|
||||
),
|
||||
// Lottie.asset(
|
||||
// 'assets/img/loading.json',
|
||||
// width: 200,
|
||||
// height: 200,
|
||||
// fit: BoxFit.contain,
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
19.rpx, 13.rpx, 0, 13.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'首页.已关联体征监测设备'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
' 0',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.277,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 690.rpx,
|
||||
minHeight: 450.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: stringToColor("#242835"),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius), // 圆角半径
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.66,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.red, Colors.orange], // 渐变颜色数组
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants()
|
||||
.button_container_radius), // 圆角半径
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
size: 28.rpx,
|
||||
),
|
||||
Text(
|
||||
'首页.扫一扫绑定'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 17.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
CustomCard(
|
||||
borderRadius: AppConstants()
|
||||
.button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
print('Button pressed ...');
|
||||
Get.toNamed("/deviceType");
|
||||
},
|
||||
colors: [
|
||||
stringToColor("45D989"),
|
||||
stringToColor("00C1AA")
|
||||
], // 渐变色是同一个色,也可以根据需要调整
|
||||
title: '首页.蓝牙绑定'.tr, // 可选,虽然这个 title 没用,但可以作为调试用
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.66,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
size: 28.rpx,
|
||||
),
|
||||
Text(
|
||||
'首页.蓝牙绑定'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 17.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFBF5D5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius), // 圆角半径
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
25.rpx, 25.rpx, 25.rpx, 25.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.volume_mute,
|
||||
color:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
size: 30.rpx,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'首页.提示标题'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.orange),
|
||||
),
|
||||
Text(
|
||||
'首页.提示内容1'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'首页.提示内容2'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'首页.提示内容3'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
height: AppConstants()
|
||||
.text_padding_up_dowm_p)),
|
||||
),
|
||||
)
|
||||
].divide(SizedBox(width: 20.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
192
lib/pages/main_bottom/main_page_bottom_change.dart
Normal file
192
lib/pages/main_bottom/main_page_bottom_change.dart
Normal file
@@ -0,0 +1,192 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/e_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/home_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/message_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/mine_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/sleep_report_page.dart';
|
||||
|
||||
class MainPageBottomChange extends GetView<MainPageController> {
|
||||
GlobalController globalController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
getBottomNavigationBarItem(String svgPath, String actSvgPath, String label,
|
||||
{double size = 0, bool isEmpty = false}) {
|
||||
if (size == 0) {
|
||||
size = 36.rpx;
|
||||
}
|
||||
return BottomNavigationBarItem(
|
||||
icon: Padding(
|
||||
padding: EdgeInsets.only(bottom: 6.rpx),
|
||||
child: isEmpty
|
||||
? Container()
|
||||
: SvgPicture.asset(
|
||||
actSvgPath,
|
||||
width: size,
|
||||
height: size,
|
||||
),
|
||||
),
|
||||
// activeIcon: Padding(
|
||||
// padding: EdgeInsets.only(bottom: 6.rpx),
|
||||
// child: isEmpty
|
||||
// ? Container()
|
||||
// : SvgPicture.asset(
|
||||
// svgPath,
|
||||
// color: stringToColor("#D3B684"),
|
||||
// width: size,
|
||||
// height: size,
|
||||
// ),
|
||||
// ),
|
||||
activeIcon: Padding(
|
||||
padding: EdgeInsets.only(bottom: 6.rpx),
|
||||
child: isEmpty
|
||||
? Container()
|
||||
: SvgPicture.asset(
|
||||
svgPath,
|
||||
width: size,
|
||||
height: size,
|
||||
),
|
||||
),
|
||||
label: label);
|
||||
}
|
||||
|
||||
List arr = [
|
||||
HomePage(),
|
||||
SleepReportPage(),
|
||||
EPage(),
|
||||
MessagePage(),
|
||||
MinePage(),
|
||||
];
|
||||
|
||||
DateTime? _lastBackPressedTime; // 记录上一次返回的时间
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (disposition, result) async {
|
||||
if (Platform.isAndroid) {
|
||||
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
if (flag) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Obx(
|
||||
() {
|
||||
if (globalController.model.hideBottomNavigationBar == true) {
|
||||
return Scaffold(
|
||||
body: arr[controller.model.currentIndex],
|
||||
floatingActionButtonAnimator:
|
||||
FloatingActionButtonAnimator.noAnimation,
|
||||
floatingActionButton: Container(),
|
||||
);
|
||||
} else {
|
||||
return Scaffold(
|
||||
body: arr[controller.model.currentIndex],
|
||||
floatingActionButtonAnimator:
|
||||
FloatingActionButtonAnimator.noAnimation,
|
||||
// floatingActionButton: Stack(
|
||||
// alignment: Alignment.center,
|
||||
// children: [
|
||||
// Positioned(
|
||||
// bottom: 10.rpx,
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// print("index 3");
|
||||
// if (globalController.model.deviceList.length == 0) {
|
||||
// showToast("请先绑定设备");
|
||||
// return;
|
||||
// }
|
||||
// if (globalController.model.deviceMain == null ||
|
||||
// globalController.model.deviceMain["mac"] == null) {
|
||||
// globalController.model.deviceMain =
|
||||
// globalController.model.deviceList[0];
|
||||
// globalController.updateAll();
|
||||
// }
|
||||
|
||||
// controller.model.currentIndex = 2;
|
||||
// controller.updateAll();
|
||||
// },
|
||||
// child: Image.asset(
|
||||
// gaplessPlayback: true,
|
||||
// excludeFromSemantics: true,
|
||||
// controller.model.currentIndex == 2
|
||||
// ? "assets/images/icon_sleep_light.png"
|
||||
// : "assets/images/icon_sleep_dark.png",
|
||||
// width: 120.rpx,
|
||||
// height: 120.rpx,
|
||||
// ),
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
floatingActionButtonLocation:
|
||||
FloatingActionButtonLocation.centerDocked,
|
||||
bottomNavigationBar: Theme(
|
||||
data: ThemeData(
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
highlightColor: Colors.transparent),
|
||||
child: BottomNavigationBar(
|
||||
unselectedItemColor: Colors.white,
|
||||
selectedItemColor: stringToColor("#D3B684"),
|
||||
backgroundColor: themeController.currentColor.sc5,
|
||||
selectedFontSize: 26.rpx,
|
||||
unselectedFontSize: 26.rpx,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
currentIndex: controller.model.currentIndex,
|
||||
onTap: (index) {
|
||||
// if(controller.model.currentIndex == 2) {
|
||||
// arr[2].closeBefore();
|
||||
// }
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
if (controller.model.currentIndex != 1) {
|
||||
globalController.model.hideBottomNavigationBar = false;
|
||||
globalController.updateAll();
|
||||
}
|
||||
});
|
||||
controller.model.currentIndex = index;
|
||||
controller.updateAll();
|
||||
},
|
||||
items: [
|
||||
getBottomNavigationBarItem("assets/img/menu/home.svg",
|
||||
"assets/img/menu/n_home.svg", "菜单.首页".tr),
|
||||
getBottomNavigationBarItem("assets/img/menu/report.svg",
|
||||
"assets/img/menu/n_report.svg", "菜单.报告".tr),
|
||||
getBottomNavigationBarItem("assets/img/menu/e.svg",
|
||||
"assets/img/menu/n_e.svg", "菜单.小e".tr),
|
||||
getBottomNavigationBarItem("assets/img/menu/message.svg",
|
||||
"assets/img/menu/n_message.svg", "菜单.消息".tr),
|
||||
getBottomNavigationBarItem("assets/img/menu/mine.svg",
|
||||
"assets/img/menu/n_mine.svg", "菜单.我的".tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> _handleBackPressed(BuildContext context) async {
|
||||
final currentTime = DateTime.now();
|
||||
|
||||
// 如果上次点击返回键时间为空,或者间隔超过 1 秒
|
||||
if (_lastBackPressedTime == null ||
|
||||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
|
||||
_lastBackPressedTime = currentTime;
|
||||
showToast("再按一次退出程序", color: color_warning, closeTime: 2);
|
||||
return false; // 阻止退出程序
|
||||
} else {
|
||||
return true; // 允许退出程序
|
||||
}
|
||||
}
|
||||
}
|
||||
85
lib/pages/main_bottom/message_page.dart
Normal file
85
lib/pages/main_bottom/message_page.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class MessagePage extends StatefulWidget {
|
||||
const MessagePage({super.key});
|
||||
|
||||
@override
|
||||
State<MessagePage> createState() => _MessagePageState();
|
||||
}
|
||||
|
||||
class _MessagePageState extends State<MessagePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: AppColors.bg_color,
|
||||
// automaticallyImplyLeading: false,
|
||||
// title: Container(
|
||||
// width: double.infinity,
|
||||
// height: 70.rpx,
|
||||
// child: Obx(
|
||||
// () => InkWell(
|
||||
// onTap: () {
|
||||
// Get.toNamed("/editUserInfoPage");
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 56.rpx,
|
||||
// height: 56.rpx,
|
||||
// clipBehavior: Clip.antiAlias,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// width: 20.rpx,
|
||||
// height: 0,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// shape: BoxShape.rectangle,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// userInfoController.model.user!.nickName ?? '匿名',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// actions: [],
|
||||
// centerTitle: false,
|
||||
// ),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Text("消息"),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
374
lib/pages/main_bottom/mine_page.dart
Normal file
374
lib/pages/main_bottom/mine_page.dart
Normal file
@@ -0,0 +1,374 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.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/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class MinePage extends StatefulWidget {
|
||||
const MinePage({super.key});
|
||||
|
||||
@override
|
||||
State<MinePage> createState() => _MinePageState();
|
||||
}
|
||||
|
||||
class _MinePageState extends State<MinePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Container(
|
||||
height: bodySize.maxHeight,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgImage.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF242835),
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
bottomRight: Radius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
topLeft: Radius.circular(0.rpx),
|
||||
topRight: Radius.circular(0.rpx),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 37.rpx, 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 65.rpx, 0, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/earphone.svg',
|
||||
width: 29.rpx,
|
||||
height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/setting.svg',
|
||||
width: 29.rpx,
|
||||
height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
].divide(SizedBox(width: 60.rpx)),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 50.rpx, 0, 66.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 120.rpx,
|
||||
height: 120.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.network(
|
||||
'https://picsum.photos/seed/270/600',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'Hello World',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEFF3F8),
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Hello World',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEAEFF3),
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 20.rpx)),
|
||||
),
|
||||
].divide(SizedBox(width: 35.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'我的.个人信息'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E4E6),
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
].divide(SizedBox(width: 16.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 25.rpx, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF242835),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx, 0, 40.rpx, 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/my_device.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
Text(
|
||||
'我的.我的设备'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E2E4),
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/device_repair.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
Text(
|
||||
'我的.设备报修'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E2E4),
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/op_ex.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
Text(
|
||||
'我的.操作说明'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E2E4),
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 14.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/like.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
Text(
|
||||
'关注我们'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E2E4),
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/version.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
Text(
|
||||
'我的.当前版本'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFE0E2E4),
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'3.61.0',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFD9E3EB),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
),
|
||||
].divide(SizedBox(width: 28.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
.divide(SizedBox(height: 60.rpx))
|
||||
.addToStart(SizedBox(height: 60.rpx))
|
||||
.addToEnd(SizedBox(height: 60.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
85
lib/pages/main_bottom/sleep_report_page.dart
Normal file
85
lib/pages/main_bottom/sleep_report_page.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class SleepReportPage extends StatefulWidget {
|
||||
const SleepReportPage({super.key});
|
||||
|
||||
@override
|
||||
State<SleepReportPage> createState() => _SleepReportPageState();
|
||||
}
|
||||
|
||||
class _SleepReportPageState extends State<SleepReportPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: AppColors.bg_color,
|
||||
// automaticallyImplyLeading: false,
|
||||
// title: Container(
|
||||
// width: double.infinity,
|
||||
// height: 70.rpx,
|
||||
// child: Obx(
|
||||
// () => InkWell(
|
||||
// onTap: () {
|
||||
// Get.toNamed("/editUserInfoPage");
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 56.rpx,
|
||||
// height: 56.rpx,
|
||||
// clipBehavior: Clip.antiAlias,
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// width: 20.rpx,
|
||||
// height: 0,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// shape: BoxShape.rectangle,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// userInfoController.model.user!.nickName ?? '匿名',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// actions: [],
|
||||
// centerTitle: false,
|
||||
// ),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Text("睡眠报告"),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user