更新页面
This commit is contained in:
619
lib/pages/person/person_page.dart
Normal file
619
lib/pages/person/person_page.dart
Normal file
@@ -0,0 +1,619 @@
|
||||
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/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/person/person_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/pages/person/select_time.dart';
|
||||
|
||||
class PersonPage extends StatefulWidget {
|
||||
const PersonPage({super.key});
|
||||
|
||||
@override
|
||||
State<PersonPage> createState() => _EPageState();
|
||||
}
|
||||
|
||||
class _EPageState extends State<PersonPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
PersonController personController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 加上这一行
|
||||
appBar: AppBar(
|
||||
backgroundColor: stringToColor("#242835"),
|
||||
// backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
// color: Colors.grey,
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'人员资料.标题'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
Get.offAllNamed("/bindDeviceSuccess");
|
||||
},
|
||||
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
70.rpx, 141.rpx, 70.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: TextFormField(
|
||||
// controller: _model.textController1,
|
||||
// focusNode: _model.textFieldFocusNode1,
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
isDense: true,
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white),
|
||||
hintText: '人员资料.名字输入提示'.tr,
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
filled: true,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
// validator: _model.textController1Validator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 90.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 90.rpx,
|
||||
height: 90.rpx,
|
||||
decoration: BoxDecoration(),
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/man.png",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'男',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 14.rpx)),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 90.rpx,
|
||||
height: 90.rpx,
|
||||
decoration: BoxDecoration(),
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/woman.png",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'女',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 14.rpx)),
|
||||
),
|
||||
].divide(SizedBox(width: 170.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
70.rpx, 50.rpx, 70.rpx, 0),
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// height: 100.rpx,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(50.rpx),
|
||||
// border: Border.all(
|
||||
// color: Color(0xFFF3EDED),
|
||||
// ),
|
||||
// ),
|
||||
// child: Align(
|
||||
// alignment: AlignmentDirectional(0, 0),
|
||||
// child: Obx(
|
||||
// () => Container(
|
||||
// width: double.infinity,
|
||||
// height:
|
||||
// MediaQuery.sizeOf(context).height * 0.064,
|
||||
// decoration: BoxDecoration(),
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// // 触摸收起键盘
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(FocusNode());
|
||||
// Future.delayed(
|
||||
// const Duration(milliseconds: 250), () {
|
||||
// // 延迟执行的代码
|
||||
// showDateSelectionDialog(context,
|
||||
// checkDate:
|
||||
// personController.model.birthday ??
|
||||
// DateTime.now(),
|
||||
// checkChange: (DateTime d) {
|
||||
// personController.model.birthday = d;
|
||||
// personController.updateAll();
|
||||
// print("$d");
|
||||
// }).then((d) {
|
||||
// // Timer(Duration.zero, () {
|
||||
// // FocusScope.of(context).unfocus();
|
||||
// // });
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
// child: Container(
|
||||
// constraints:
|
||||
// BoxConstraints(minWidth: 200.rpx),
|
||||
// child: Text(
|
||||
// personController.model.birthday != null
|
||||
// ? DateFormat("yyyy年MM月dd日").format(
|
||||
// personController.model.birthday!)
|
||||
// : '人员资料.生日输入提示'.tr,
|
||||
// textAlign: TextAlign.right,
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
child: Container(
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(color: Color(0xFFF3EDED)),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
Future.delayed(Duration(milliseconds: 250), () {
|
||||
showDateSelectionDialog(
|
||||
context,
|
||||
checkDate: personController.model.birthday ??
|
||||
DateTime.now(),
|
||||
checkChange: (DateTime d) {
|
||||
personController.model.birthday = d;
|
||||
personController.updateAll();
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
personController.model.birthday != null
|
||||
? DateFormat("yyyy年MM月dd日").format(
|
||||
personController.model.birthday!)
|
||||
: '人员资料.生日输入提示'.tr,
|
||||
textAlign: TextAlign.right,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: personController.model.birthday !=
|
||||
null
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
70.rpx, 18.rpx, 70.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: TextFormField(
|
||||
// controller: _model.textController3,
|
||||
// focusNode: _model.textFieldFocusNode3,
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
isDense: true,
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
hintText: '人员资料.体重输入提示'.tr,
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: personController.model.birthday !=
|
||||
null
|
||||
? Colors.white
|
||||
: Colors.grey,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
),
|
||||
filled: true,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
// validator: _model.textController3Validator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 117.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Text(
|
||||
'人员资料.疾病标题'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF3F4F5),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
70.rpx, 70.rpx, 70.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 152.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFE9E3E3),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 30.rpx, 30.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 8.rpx, 0, 0),
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Color(0xFFE4EBF0),
|
||||
size: 24.rpx,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'人员资料.提示'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEEF3F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 23.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard(BuildContext context,
|
||||
{required String title, required String imageUrl, required String type}) {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx, // 圆角大小
|
||||
onTap: () {
|
||||
if (type != null) {
|
||||
if (type == '1') {
|
||||
Get.toNamed("/blueteethDevice");
|
||||
}
|
||||
}
|
||||
},
|
||||
// colors: [Colors.white.withOpacity(0.06)], // 背景色
|
||||
colors: [stringToColor("#242835")], // 背景色
|
||||
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.135,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFC2CED7),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
child: Image.asset(
|
||||
imageUrl,
|
||||
width: 212.rpx,
|
||||
height: 168.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
290
lib/pages/person/select_time.dart
Normal file
290
lib/pages/person/select_time.dart
Normal file
@@ -0,0 +1,290 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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';
|
||||
|
||||
Future showDateSelectionDialog(BuildContext context,
|
||||
{required DateTime checkDate, Function? checkChange, String title = "生日"}) {
|
||||
Color checkColor = stringToColor("#D3B684");
|
||||
List years = [], months = [], days = [];
|
||||
var days_select = [].obs;
|
||||
int day_len = 31;
|
||||
int year = DateTime.now().year;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
years.insert(0, year - i);
|
||||
}
|
||||
for (var i = 1; i < 13; i++) {
|
||||
months.add(i);
|
||||
}
|
||||
for (var i = 1; i < 32; i++) {
|
||||
days.add(i);
|
||||
}
|
||||
int yearIndex = years.lastIndexOf(checkDate.year);
|
||||
int monthIndex = months.lastIndexOf(checkDate.month);
|
||||
day_len = DateTime.fromMillisecondsSinceEpoch(
|
||||
DateTime(years[yearIndex], months[monthIndex] + 1)
|
||||
.millisecondsSinceEpoch -
|
||||
1000)
|
||||
.day;
|
||||
days_select.value = days.sublist(0, day_len);
|
||||
int dayIndex = days.lastIndexOf(checkDate.day);
|
||||
ThemeController themeController = Get.find();
|
||||
return showDialog(
|
||||
// barrierColor: stringToColor("#000320"),
|
||||
context: context,
|
||||
barrierDismissible: true, // 点击对话框外部可关闭
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0, // 控制弹窗距离顶部的位置
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: stringToColor("#242835"),
|
||||
// backgroundColor: Colors.transparent,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
topRight: Radius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
bottomLeft: Radius.circular(0.rpx),
|
||||
bottomRight: Radius.circular(0.rpx),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: themeController.currentColor.sc5,
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
child: Text(
|
||||
"日期.取消".tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize),
|
||||
),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
Text(
|
||||
"$title",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize),
|
||||
),
|
||||
// closeIconWhite,
|
||||
InkWell(
|
||||
child: Text(
|
||||
"日期.确定".tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize),
|
||||
),
|
||||
onTap: () {
|
||||
checkChange?.call(DateTime(years[yearIndex],
|
||||
months[monthIndex], days[dayIndex]));
|
||||
Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 240.rpx,
|
||||
margin: EdgeInsets.only(top: 60.rpx, bottom: 60.rpx),
|
||||
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 40.rpx, right: 30.rpx),
|
||||
child: getOnePicker(context, years, yearIndex,
|
||||
(d) {
|
||||
yearIndex = d;
|
||||
dayIndex = 0;
|
||||
day_len =
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
DateTime(
|
||||
years[yearIndex],
|
||||
months[monthIndex] +
|
||||
1)
|
||||
.millisecondsSinceEpoch -
|
||||
1000)
|
||||
.day;
|
||||
days_select.value =
|
||||
days.sublist(0, day_len);
|
||||
}),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
"年",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx, right: 30.rpx),
|
||||
child: getOnePicker(
|
||||
context, months, monthIndex, (d) {
|
||||
monthIndex = d;
|
||||
dayIndex = 0;
|
||||
day_len =
|
||||
DateTime.fromMillisecondsSinceEpoch(
|
||||
DateTime(
|
||||
years[yearIndex],
|
||||
months[monthIndex] +
|
||||
1)
|
||||
.millisecondsSinceEpoch -
|
||||
1000)
|
||||
.day;
|
||||
days_select.value =
|
||||
days.sublist(0, day_len);
|
||||
}),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
"月",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx, right: 40.rpx),
|
||||
child: Obx(
|
||||
() {
|
||||
// print("${dayIndex} ${day_len}");
|
||||
return getOnePicker(
|
||||
context,
|
||||
days_select,
|
||||
dayIndex,
|
||||
(d) {
|
||||
dayIndex = d;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
"日",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
|
||||
{bool looping = false}) {
|
||||
return CupertinoPicker(
|
||||
key: UniqueKey(),
|
||||
useMagnifier: false,
|
||||
itemExtent: 80.rpx,
|
||||
magnification: 1,
|
||||
diameterRatio: 3,
|
||||
squeeze: 1,
|
||||
looping: looping,
|
||||
scrollController: FixedExtentScrollController(initialItem: checkIndex),
|
||||
selectionOverlay: Container(),
|
||||
onSelectedItemChanged: (int value) {
|
||||
// print("$value");
|
||||
onSelectedItemChanged.call(value);
|
||||
},
|
||||
children: [
|
||||
...List.generate(arr.length, (index) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
width: 400.rpx,
|
||||
decoration: BoxDecoration(
|
||||
// border: Border(
|
||||
// bottom: index != arr.length
|
||||
// ? BorderSide(
|
||||
// color: stringToColor("#8D95B0"),
|
||||
// )
|
||||
// : BorderSide.none,
|
||||
// ),
|
||||
),
|
||||
child: Text("${arr[index]}",
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx)),
|
||||
);
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user