diff --git a/lib/screens/hr_manage/hr_manage.dart b/lib/screens/hr_manage/hr_manage.dart index 651ded2..b0afc81 100644 --- a/lib/screens/hr_manage/hr_manage.dart +++ b/lib/screens/hr_manage/hr_manage.dart @@ -3,7 +3,6 @@ import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:sk_base_mobile/apis/api.dart'; import 'package:sk_base_mobile/app_theme.dart'; -import 'package:sk_base_mobile/config.dart'; import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/constants/constants.dart'; import 'package:sk_base_mobile/models/user_info.model.dart'; @@ -30,14 +29,6 @@ class HrManagePage extends StatelessWidget { @override Widget build(BuildContext context) { - // return Column( - // children: [ - // Expanded( - // child: Material( - // child: EditUserInfo(), - // )) - // ], - // ); return GestureDetector( onTap: () { // 取消焦点 @@ -125,7 +116,7 @@ class HrManagePage extends StatelessWidget { doSearch(''); }, )), - hint: '查询员工', + hint: '查询员工 姓名、手机号、邮箱', isDense: true, contentPadding: EdgeInsets.symmetric(vertical: ScreenAdaper.height(10)), @@ -134,23 +125,27 @@ class HrManagePage extends StatelessWidget { SizedBox( width: ScreenAdaper.width(10), ), - SkInk( - border: Border.all(color: AppTheme.grey.withOpacity(0.8)), - borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)), - onTap: () {}, - child: SizedBox( - width: ScreenAdaper.height(65), - height: ScreenAdaper.height(65), - child: Icon( - Icons.filter_list_sharp, - size: ScreenAdaper.height(50), - ), - ), - ) + buildFilterBtn() ]), ); } + Widget buildFilterBtn() { + return SkInk( + border: Border.all(color: AppTheme.grey.withOpacity(0.8)), + borderRadius: BorderRadius.circular(ScreenAdaper.sp(15)), + onTap: () {}, + child: SizedBox( + width: ScreenAdaper.height(65), + height: ScreenAdaper.height(65), + child: Icon( + Icons.filter_list_sharp, + size: ScreenAdaper.height(50), + ), + ), + ); + } + Widget buildUserCard(int index) { return SkInk( onTap: () { diff --git a/lib/screens/inventory_inout/inventory_inout_controller.dart b/lib/screens/inventory_inout/inventory_inout_controller.dart index c573843..d14484a 100644 --- a/lib/screens/inventory_inout/inventory_inout_controller.dart +++ b/lib/screens/inventory_inout/inventory_inout_controller.dart @@ -6,9 +6,7 @@ import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/constants/enum.dart'; import 'package:sk_base_mobile/db_helper/db_help.dart'; import 'package:sk_base_mobile/screens/inventory_inout/components/inventory_inout_info.dart'; -import 'package:sk_base_mobile/screens/landing/landing_controller.dart'; import 'package:sk_base_mobile/screens/new_inventory_inout/new_inventory_inout.dart'; -import 'package:sk_base_mobile/services/app_info.service.dart'; import 'package:sk_base_mobile/util/date.util.dart'; import 'package:sk_base_mobile/util/modal.util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; diff --git a/lib/screens/landing/landing_controller.dart b/lib/screens/landing/landing_controller.dart index 77197e3..04f9308 100644 --- a/lib/screens/landing/landing_controller.dart +++ b/lib/screens/landing/landing_controller.dart @@ -1,16 +1,11 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:sk_base_mobile/apis/api.dart'; import 'package:sk_base_mobile/models/app_bottom_nav_item.dart'; import 'package:sk_base_mobile/screens/inventory/inventory.dart'; import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout.dart'; import 'package:sk_base_mobile/screens/mine/mine.dart'; import 'package:sk_base_mobile/screens/workbench/workbench.dart'; import 'package:sk_base_mobile/services/app_info.service.dart'; -import 'package:sk_base_mobile/util/device.util.dart'; -import 'package:sk_base_mobile/util/modal.util.dart'; - -import '../../constants/constants.dart'; class LandingController extends GetxController { RxInt currentIndex = 0.obs; diff --git a/lib/screens/login/login.controller.dart b/lib/screens/login/login.controller.dart index d1d7a29..cd6672c 100644 --- a/lib/screens/login/login.controller.dart +++ b/lib/screens/login/login.controller.dart @@ -1,9 +1,6 @@ import 'package:flutter/widgets.dart'; import 'package:get/get.dart'; -import 'package:sk_base_mobile/apis/api.dart'; -import 'package:sk_base_mobile/util/device.util.dart'; import 'package:sk_base_mobile/util/snack_bar.util.dart'; -import '../../constants/constants.dart'; import '../../store/auth.store.dart'; // import 'package:sentry/sentry.dart'; @@ -14,6 +11,7 @@ class LoginController extends GetxController { String username = ''; String password = ''; bool loading = false; + RxBool obscureText = true.obs; Future doLogin() async { if (username.isEmpty || password.isEmpty) { SnackBarUtil().warning('请填写用户名和密码'); diff --git a/lib/screens/login/login.dart b/lib/screens/login/login.dart index 1dc90e5..e8702f2 100644 --- a/lib/screens/login/login.dart +++ b/lib/screens/login/login.dart @@ -94,6 +94,7 @@ class LoginScreen extends StatelessWidget { final children = [ buildUserNameInput(), Divider( + height: 1, thickness: ScreenAdaper.height(2), ), buildPasswordInput(), @@ -177,7 +178,7 @@ class LoginScreen extends StatelessWidget { decoration: InputDecoration( prefixIcon: Icon( Icons.person_2_outlined, - size: ScreenAdaper.height(40), + size: ScreenAdaper.height(45), ), hintText: '用户名', hintStyle: TextStyle(fontSize: ScreenAdaper.height(25)), @@ -186,7 +187,7 @@ class LoginScreen extends StatelessWidget { onFieldSubmitted: (value) { _controller.passwordFocusNode.requestFocus(); }, - style: TextStyle(fontSize: ScreenAdaper.height(25)), + style: TextStyle(fontSize: ScreenAdaper.height(30)), onChanged: (value) { _controller.username = value; }, @@ -194,26 +195,38 @@ class LoginScreen extends StatelessWidget { } Widget buildPasswordInput() { - return TextFormField( - decoration: InputDecoration( - prefixIcon: Icon( - Icons.lock_outlined, - size: ScreenAdaper.height(40), - ), - errorStyle: TextStyle(fontSize: ScreenAdaper.height(20)), - hintText: '密码', - border: InputBorder.none, - focusedBorder: InputBorder.none), - obscureText: true, - focusNode: _controller.passwordFocusNode, - onFieldSubmitted: (value) { - _controller.doLogin(); - }, - style: TextStyle(fontSize: ScreenAdaper.height(25)), - onChanged: (value) { - _controller.password = value; - }, - ); + return Obx(() => TextFormField( + decoration: InputDecoration( + prefixIcon: Icon( + Icons.lock_outlined, + size: ScreenAdaper.height(45), + ), + suffixIcon: GestureDetector( + onTap: () { + _controller.obscureText.value = + !_controller.obscureText.value; + }, + child: Icon( + !_controller.obscureText.value + ? Icons.visibility + : Icons.visibility_off, + size: ScreenAdaper.height(45), + ), + ), + errorStyle: TextStyle(fontSize: ScreenAdaper.height(20)), + hintText: '密码', + border: InputBorder.none, + focusedBorder: InputBorder.none), + obscureText: _controller.obscureText.value, + focusNode: _controller.passwordFocusNode, + onFieldSubmitted: (value) { + _controller.doLogin(); + }, + style: TextStyle(fontSize: ScreenAdaper.height(30)), + onChanged: (value) { + _controller.password = value; + }, + )); } Widget buildForgotPassword() { diff --git a/lib/screens/mine/settings/mine_settings.dart b/lib/screens/mine/settings/mine_settings.dart index 4442656..d5ff5d0 100644 --- a/lib/screens/mine/settings/mine_settings.dart +++ b/lib/screens/mine/settings/mine_settings.dart @@ -3,7 +3,6 @@ import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/constants/bg_color.dart'; import 'package:sk_base_mobile/services/app_info.service.dart'; import 'package:sk_base_mobile/store/auth.store.dart'; -import 'package:sk_base_mobile/util/device.util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; class MineSettingsPage extends StatelessWidget { diff --git a/lib/widgets/core/sk_cascade_picker.dart b/lib/widgets/core/sk_cascade_picker.dart index ec4eaf5..19f5838 100644 --- a/lib/widgets/core/sk_cascade_picker.dart +++ b/lib/widgets/core/sk_cascade_picker.dart @@ -1,10 +1,8 @@ -import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/widgets/core/sk_ink.dart'; -import 'package:sk_base_mobile/widgets/gradient_button.dart'; import 'package:sk_base_mobile/widgets/loading_indicator.dart'; class CascadeItem { @@ -28,7 +26,8 @@ class SkCascadePicker extends StatelessWidget { final Function(List>)? onConfirm; SkCascadePicker( - {required Future>> Function() getData, + {super.key, + required Future>> Function() getData, required List> Function(SkCascadePickerController) initialPageData, required NextPageCallback nextPageData, @@ -209,7 +208,7 @@ class SkCascadePicker extends StatelessWidget { height: tabHeight, color: tabColor, alignment: Alignment.center, - child: Container( + child: SizedBox( // constraints: BoxConstraints( // maxWidth: MediaQuery.of(Get.context!).size.width / // cascadeController.pagesData.length - @@ -244,7 +243,7 @@ class SkCascadePicker extends StatelessWidget { } cascadeController.isAnimateTextHide = false; if (i < cascadeController.pagesData.length - 1) { - widgets.add(Container( + widgets.add(SizedBox( // color: Colors.red, child: Icon( Icons.arrow_right, @@ -269,13 +268,12 @@ class SkCascadePicker extends StatelessWidget { item == cascadeController.selectedTabs[page] ? Padding( padding: const EdgeInsets.all(5.0), - child: selectedIcon == null - ? Icon(Icons.chevron_right, + child: selectedIcon ?? + Icon(Icons.chevron_right, size: ScreenAdaper.height(40), - color: activeColor) - : selectedIcon, + color: activeColor), ) - : SizedBox(), + : const SizedBox(), Text(item.label, style: item == cascadeController.selectedTabs[page] ? (itemTitleStyle ?? @@ -500,7 +498,7 @@ class SkCascadePickerController extends GetxController animateController.forward(); if (movePage) { pageController.animateToPage(page, - curve: Curves.linear, duration: Duration(milliseconds: 500)); + curve: Curves.linear, duration: const Duration(milliseconds: 500)); } } @@ -516,7 +514,7 @@ class SkCascadePickerController extends GetxController /// pageData: 下一页的数据 /// currentPage: 当前是第几页, /// selectIndex: 当前页选中第几项 -typedef void NextPageCallback( +typedef NextPageCallback = void Function( Function(List>) pageData, int currentPage, int selectIndex, diff --git a/lib/widgets/core/sk_ink.dart b/lib/widgets/core/sk_ink.dart index e9b5663..9c14a6f 100644 --- a/lib/widgets/core/sk_ink.dart +++ b/lib/widgets/core/sk_ink.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; import 'package:sk_base_mobile/app_theme.dart'; -import 'package:sk_base_mobile/constants/bg_color.dart'; -import 'package:sk_base_mobile/util/screen_adaper_util.dart'; class SkInk extends StatelessWidget { final Widget? child; @@ -35,7 +33,7 @@ class SkInk extends StatelessWidget { padding: padding, decoration: BoxDecoration( border: border, - color: color, + color: color ?? AppTheme.nearlyWhite, gradient: gradient, borderRadius: borderRadius, ), diff --git a/lib/widgets/core/sk_multi_picker_dialog.dart b/lib/widgets/core/sk_multi_picker_dialog.dart index 16327f2..4d9c3f8 100644 --- a/lib/widgets/core/sk_multi_picker_dialog.dart +++ b/lib/widgets/core/sk_multi_picker_dialog.dart @@ -8,7 +8,7 @@ import 'package:sk_base_mobile/widgets/loading_indicator.dart'; class SkMutiPickerDialog extends StatelessWidget { final SkMutiPickerDialogController controller; - Function(List data)? onSelected; + final Function(List data)? onSelected; SkMutiPickerDialog( {super.key, required Future>> Function() getData, diff --git a/lib/widgets/form_item/sk_text_input.dart b/lib/widgets/form_item/sk_text_input.dart index f7fc27b..c3664e0 100644 --- a/lib/widgets/form_item/sk_text_input.dart +++ b/lib/widgets/form_item/sk_text_input.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/widgets/form_item/sk_form_item.dart'; import 'package:sk_base_mobile/widgets/form_item/sk_base_field.dart'; diff --git a/lib/widgets/my_avatar.dart b/lib/widgets/my_avatar.dart index 5cb18ed..e73e07d 100644 --- a/lib/widgets/my_avatar.dart +++ b/lib/widgets/my_avatar.dart @@ -1,10 +1,8 @@ import 'dart:io'; -import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; import 'package:sk_base_mobile/store/auth.store.dart'; -import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/widgets/fade_in_cache_image.dart'; import '../util/util.dart'; diff --git a/lib/widgets/upgrade_confirm.dart b/lib/widgets/upgrade_confirm.dart index 95d453b..e5610c1 100644 --- a/lib/widgets/upgrade_confirm.dart +++ b/lib/widgets/upgrade_confirm.dart @@ -1,16 +1,13 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:get/get.dart'; import 'package:sk_base_mobile/app_theme.dart'; -import 'package:sk_base_mobile/services/app_info.service.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/widgets/gradient_button.dart'; class UpgradeConfirm extends StatelessWidget { - void Function()? onConfirm; - bool forceUpgrade; - UpgradeConfirm({super.key, this.onConfirm, this.forceUpgrade = true}); + final void Function()? onConfirm; + final bool forceUpgrade; + const UpgradeConfirm({super.key, this.onConfirm, this.forceUpgrade = true}); @override Widget build(BuildContext context) {