From 73f96b379ce6a0f09e9894caaa912e0780db5a97 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 7 Apr 2022 21:45:18 +0800 Subject: [PATCH] fix bugs --- .../opening_code_page/opening_code_page.dart | 2 +- lib/pages/sign/login/set_nick_name_page.dart | 5 ++ lib/pages/sign/widget/psd_text_field.dart | 6 +- lib/pages/sign/widget/tel_text_field.dart | 10 ++- lib/provider/user_provider.dart | 14 ++++ .../work_order/publish_work_order_page.dart | 83 +++++++++++-------- lib/ui/profile/new_house/add_house_page.dart | 6 +- lib/ui/profile/new_house/my_house_page.dart | 1 + 8 files changed, 85 insertions(+), 42 deletions(-) diff --git a/lib/pages/opening_code_page/opening_code_page.dart b/lib/pages/opening_code_page/opening_code_page.dart index 5d2aff04..6b2213ba 100644 --- a/lib/pages/opening_code_page/opening_code_page.dart +++ b/lib/pages/opening_code_page/opening_code_page.dart @@ -148,7 +148,7 @@ class _OpeningCodePageState extends State { // ), // 48.hb, Text( - '2栋 1单元 1402室', + '${UserTool.userProvider.defaultHouseString}', style: TextStyle( fontSize: 32.sp, color: Colors.black, diff --git a/lib/pages/sign/login/set_nick_name_page.dart b/lib/pages/sign/login/set_nick_name_page.dart index d9354e2c..95bffc89 100644 --- a/lib/pages/sign/login/set_nick_name_page.dart +++ b/lib/pages/sign/login/set_nick_name_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/pages/sign/sign_func.dart'; import 'package:aku_new_community/pages/sign/widget/login_button_widget.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; @@ -75,6 +76,10 @@ class _SetNickNamePageState extends State { }, maxLength: 20, controller: _nickController, + style: TextStyle( + color: Colors.black.withOpacity(0.85), + ), + cursorColor: kPrimaryColor, decoration: InputDecoration( isDense: false, contentPadding: diff --git a/lib/pages/sign/widget/psd_text_field.dart b/lib/pages/sign/widget/psd_text_field.dart index 2fe2d19f..571fd00b 100644 --- a/lib/pages/sign/widget/psd_text_field.dart +++ b/lib/pages/sign/widget/psd_text_field.dart @@ -1,6 +1,6 @@ +import 'package:aku_new_community/base/base_style.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - import 'package:flutter_screenutil/flutter_screenutil.dart'; class PsdTextField extends StatefulWidget { @@ -37,6 +37,10 @@ class _PsdTextFieldState extends State { controller: widget.controller, obscureText: !visible, obscuringCharacter: '*', + style: TextStyle( + color: Colors.black.withOpacity(0.85), + ), + cursorColor: kPrimaryColor, decoration: InputDecoration( isDense: false, contentPadding: diff --git a/lib/pages/sign/widget/tel_text_field.dart b/lib/pages/sign/widget/tel_text_field.dart index 650bbc1a..2f5dc668 100644 --- a/lib/pages/sign/widget/tel_text_field.dart +++ b/lib/pages/sign/widget/tel_text_field.dart @@ -1,13 +1,15 @@ +import 'package:aku_new_community/base/base_style.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; - import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class TelTextField extends StatefulWidget { final TextEditingController controller; final Function(String) onChange; - const TelTextField({Key? key, required this.controller, required this.onChange}) : super(key: key); + const TelTextField( + {Key? key, required this.controller, required this.onChange}) + : super(key: key); @override _TelTextFieldState createState() => _TelTextFieldState(); @@ -28,6 +30,10 @@ class _TelTextFieldState extends State { keyboardType: TextInputType.number, controller: widget.controller, onChanged: widget.onChange, + style: TextStyle( + color: Colors.black.withOpacity(0.85), + ), + cursorColor: kPrimaryColor, decoration: InputDecoration( isDense: true, border: InputBorder.none, diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index f8530546..759845a5 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -111,6 +111,20 @@ class UserProvider extends ChangeNotifier { MyHouseModel? get defaultHouse => _defaultHouse; + void updateDefaultHouse() => notifyListeners(); + + String get defaultHouseString { + if (_defaultHouse == null) { + return '暂无绑定房屋'; + } else { + return _defaultHouse!.buildingName + + '栋' + + _defaultHouse!.unitName + + '单元' + + _defaultHouse!.estateName; + } + } + ///设置性别 Future setSex(int sex) async { BaseModel baseModel = await NetUtil().get( diff --git a/lib/ui/function_and_service/work_order/publish_work_order_page.dart b/lib/ui/function_and_service/work_order/publish_work_order_page.dart index a1512b93..c37fc796 100644 --- a/lib/ui/function_and_service/work_order/publish_work_order_page.dart +++ b/lib/ui/function_and_service/work_order/publish_work_order_page.dart @@ -2,9 +2,11 @@ import 'dart:io'; import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/extensions/num_ext.dart'; +import 'package:aku_new_community/provider/user_provider.dart'; import 'package:aku_new_community/saas_model/work_order/work_order_type_model.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/work_order_func.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/work_order_remark_page.dart'; +import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/widget/beeImageNetwork.dart'; import 'package:aku_new_community/widget/bee_divider.dart'; @@ -20,6 +22,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:provider/provider.dart'; import 'package:velocity_x/src/extensions/string_ext.dart'; class PublishWorkOrderPage extends StatefulWidget { @@ -54,53 +57,61 @@ class _PublishWorkOrderPageState extends State { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '发布工单', body: SafeArea( child: ListView( children: [ 2.hb, - Container( - width: double.infinity, - color: Colors.white, - height: 164.w, - padding: EdgeInsets.all(32.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ClipOval( - child: BeeImageNetwork( - width: 100.w, - height: 100.w, - imgs: UserTool.userProvider.userInfoModel?.imgList ?? [], - ), - ), - 16.wb, - Column( - crossAxisAlignment: CrossAxisAlignment.start, + GestureDetector( + onTap: () { + Get.to(MyHousePage()); + }, + child: Material( + color: Colors.transparent, + child: Container( + width: double.infinity, + color: Colors.white, + height: 164.w, + padding: EdgeInsets.all(32.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - '${UserTool.userProvider.userInfoModel!.nickName}' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), + ClipOval( + child: BeeImageNetwork( + width: 100.w, + height: 100.w, + imgs: UserTool.userProvider.userInfoModel?.imgList ?? + [], + ), + ), + 16.wb, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '${UserTool.userProvider.userInfoModel!.nickName}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + Spacer(), + '${userProvider.defaultHouseString}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + ], + ), Spacer(), - '租户 | 绿城·碧桂园3栋14单元104室' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.45)) - .make(), - ], - ), - Spacer(), - GestureDetector( - onTap: () {}, - child: Icon( + Icon( CupertinoIcons.chevron_right, color: Colors.black.withOpacity(0.25), size: 32.w, - )), - ], + ), + ], + ), + ), ), ), 20.hb, diff --git a/lib/ui/profile/new_house/add_house_page.dart b/lib/ui/profile/new_house/add_house_page.dart index 2724c320..ec9c6041 100644 --- a/lib/ui/profile/new_house/add_house_page.dart +++ b/lib/ui/profile/new_house/add_house_page.dart @@ -348,7 +348,9 @@ class _AddHousePageState extends State { '${_otherPickHouse == null ? '请选择楼层房号' : '${_otherPickHouse!.building!.name}-${_otherPickHouse!.unit!.name}-${_otherPickHouse!.floor!.name}-${_otherPickHouse!.house!.name}'}' .text .size(28.sp) - .color(Colors.black.withOpacity(0.25)) + .color(_otherPickHouse == null + ? Colors.black.withOpacity(0.25) + : Colors.black.withOpacity(0.85)) .maxLines(2) .make(), ), @@ -512,7 +514,7 @@ class _AddHousePageState extends State { .text .size(28.sp) .color(model.house != null - ? Colors.black.withOpacity(0.5) + ? Colors.black.withOpacity(0.85) : Colors.black.withOpacity(0.25)) .make(), ), diff --git a/lib/ui/profile/new_house/my_house_page.dart b/lib/ui/profile/new_house/my_house_page.dart index 86907a74..faa074c8 100644 --- a/lib/ui/profile/new_house/my_house_page.dart +++ b/lib/ui/profile/new_house/my_house_page.dart @@ -98,6 +98,7 @@ class _MyHousePageState extends State { params: {'estateId': model.id}); if (base.success) { _refreshController.callRefresh(); + UserTool.userProvider.updateDefaultHouse(); } else { BotToast.showText(text: '切换默认房屋失败'); }