diff --git a/lib/pages/common/search/common_search_controller.dart b/lib/pages/common/search/common_search_controller.dart index ef336f35a..928760200 100644 --- a/lib/pages/common/search/common_search_controller.dart +++ b/lib/pages/common/search/common_search_controller.dart @@ -15,7 +15,7 @@ abstract class CommonSearchController extends CommonListController { } @override - Future onRefresh() { + Future onRefresh([_]) { if (editController.value.text.isEmpty) { return Future.syncValue(null); } diff --git a/lib/pages/common/search/common_search_page.dart b/lib/pages/common/search/common_search_page.dart index 65011e1fc..3f08065ef 100644 --- a/lib/pages/common/search/common_search_page.dart +++ b/lib/pages/common/search/common_search_page.dart @@ -46,6 +46,9 @@ abstract class CommonSearchPageState ViewSliverSafeArea( sliver: Obx(() => _buildBody(controller.loadingState.value)), ), + SliverPadding( + padding: .only(bottom: MediaQuery.viewInsetsOf(context).bottom), + ), ], ), ); @@ -81,7 +84,7 @@ abstract class CommonSearchPageState ..focusNode.requestFocus(), ), ), - onSubmitted: (value) => controller.onRefresh(), + onSubmitted: controller.onRefresh, ), ); if (multiSelect) { diff --git a/lib/pages/fav_create/view.dart b/lib/pages/fav_create/view.dart index 6e04597a6..4e89f51af 100644 --- a/lib/pages/fav_create/view.dart +++ b/lib/pages/fav_create/view.dart @@ -177,7 +177,12 @@ class _CreateFavPageState extends State { final leadingStyle = const TextStyle(fontSize: 14); Widget _buildBody(ThemeData theme) => SingleChildScrollView( - padding: .only(bottom: MediaQuery.viewPaddingOf(context).bottom + 25), + padding: .only( + bottom: + MediaQuery.viewPaddingOf(context).bottom + + MediaQuery.viewInsetsOf(context).bottom + + 25, + ), child: Column( spacing: 12, children: [ @@ -234,13 +239,10 @@ class _CreateFavPageState extends State { }, ); }, - leading: Text( - '封面', - style: leadingStyle, - ), + leading: Text('封面', style: leadingStyle), trailing: Row( spacing: 10, - mainAxisSize: MainAxisSize.min, + mainAxisSize: .min, children: [ if (_cover?.isNotEmpty == true) Padding( @@ -309,10 +311,10 @@ class _CreateFavPageState extends State { color: theme.colorScheme.outline, ), border: const OutlineInputBorder( - borderSide: BorderSide.none, + borderSide: .none, gapPadding: 0, ), - contentPadding: EdgeInsets.zero, + contentPadding: .zero, ), ), ), @@ -323,7 +325,7 @@ class _CreateFavPageState extends State { ListTile( tileColor: theme.colorScheme.onInverseSurface, title: Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: .start, children: [ SizedBox( width: 55, @@ -364,7 +366,7 @@ class _CreateFavPageState extends State { ), Builder( builder: (context) { - void onTap() { + void onTap([_]) { _isPublic = !_isPublic; (context as Element).markNeedsBuild(); } @@ -381,7 +383,7 @@ class _CreateFavPageState extends State { scale: 0.8, child: Switch( value: _isPublic, - onChanged: (value) => onTap(), + onChanged: onTap, ), ), ); diff --git a/lib/pages/live_search/child/view.dart b/lib/pages/live_search/child/view.dart index 874afa6e0..eb40aa1d8 100644 --- a/lib/pages/live_search/child/view.dart +++ b/lib/pages/live_search/child/view.dart @@ -42,11 +42,14 @@ class _LiveSearchChildPageState extends State physics: const AlwaysScrollableScrollPhysics(), slivers: [ SliverPadding( - padding: EdgeInsets.only( + padding: .only( top: padding, left: padding, right: padding, - bottom: MediaQuery.viewPaddingOf(context).bottom + 100, + bottom: + MediaQuery.viewPaddingOf(context).bottom + + MediaQuery.viewInsetsOf(context).bottom + + 100, ), sliver: Obx(() => _buildBody(_controller.loadingState.value)), ), diff --git a/lib/pages/live_search/controller.dart b/lib/pages/live_search/controller.dart index 21abb667c..28297e30b 100644 --- a/lib/pages/live_search/controller.dart +++ b/lib/pages/live_search/controller.dart @@ -45,7 +45,7 @@ class LiveSearchController extends GetxController } } - void submit() { + void submit([_]) { if (editingController.text.isNotEmpty) { if (IdUtils.digitOnlyRegExp.hasMatch(editingController.text)) { PageUtils.toLiveRoom(int.parse(editingController.text)); diff --git a/lib/pages/live_search/view.dart b/lib/pages/live_search/view.dart index 74f7ac6f7..5a3b1d704 100644 --- a/lib/pages/live_search/view.dart +++ b/lib/pages/live_search/view.dart @@ -49,7 +49,7 @@ class _LiveSearchPageState extends State { onPressed: _controller.onClear, ), ), - onSubmitted: (value) => _controller.submit(), + onSubmitted: _controller.submit, onChanged: (value) { if (value.isEmpty) { _controller.hasData.value = false; diff --git a/lib/pages/login/view.dart b/lib/pages/login/view.dart index a995ec59f..9bf9af212 100644 --- a/lib/pages/login/view.dart +++ b/lib/pages/login/view.dart @@ -39,9 +39,12 @@ class _LoginPageState extends State { void didChangeDependencies() { super.didChangeDependencies(); _loginPageCtr.didChangeDependencies(context); - padding = - MediaQuery.viewPaddingOf(context).copyWith(top: 0) + - const EdgeInsets.only(bottom: 25); + final padding = MediaQuery.viewPaddingOf(context); + this.padding = .only( + left: padding.left, + right: padding.right, + bottom: padding.bottom + MediaQuery.viewInsetsOf(context).bottom + 25, + ); } Widget loginByQRCode(ThemeData theme) { diff --git a/lib/pages/member_profile/view.dart b/lib/pages/member_profile/view.dart index 0d1bf845b..3c5781658 100644 --- a/lib/pages/member_profile/view.dart +++ b/lib/pages/member_profile/view.dart @@ -85,13 +85,11 @@ class _EditProfilePageState extends State { if (mounted) { setState(() { if (res.data['code'] == 0) { - AccountMyInfoData data = AccountMyInfoData.fromJson( - res.data['data'], - ); + final data = AccountMyInfoData.fromJson(res.data['data']); _loadingState = Success(data); accountService.face.value = data.face!; try { - UserInfoData userInfo = Pref.userInfoCache! + final userInfo = Pref.userInfoCache! ..uname = data.name ..face = data.face; GStorage.userInfo.put('userInfoCache', userInfo); @@ -162,7 +160,7 @@ class _EditProfilePageState extends State { SmartDialog.showToast('硬币不足'); } else { _editDialog( - type: ProfileType.uname, + type: .uname, title: '昵称', text: response.name!, ); @@ -193,7 +191,7 @@ class _EditProfilePageState extends State { ).then((res) { if (res != null) { _update( - type: ProfileType.birthday, + type: .birthday, datum: DateFormatUtils.longFormat.format(res), ); } @@ -205,7 +203,7 @@ class _EditProfilePageState extends State { title: '个性签名', text: response.sign, onTap: () => _editDialog( - type: ProfileType.sign, + type: .sign, title: '个性签名', text: response.sign ?? '', ), @@ -277,7 +275,7 @@ class _EditProfilePageState extends State { trailing: current == sex ? const Icon(size: 22, Icons.check) : null, onTap: () { Get.back(); - _update(type: ProfileType.sex, datum: sex); + _update(type: .sex, datum: sex); }, ); } @@ -288,7 +286,7 @@ class _EditProfilePageState extends State { required String text, }) { _textController.text = text; - final lines = type == ProfileType.uname ? 1 : 4; + final lines = type == .uname ? 1 : 4; showDialog( context: context, builder: (BuildContext context) { @@ -301,13 +299,9 @@ class _EditProfilePageState extends State { maxLines: lines, autofocus: true, style: const TextStyle(fontSize: 14), - textInputAction: type == ProfileType.sign - ? TextInputAction.newline - : null, + textInputAction: type == .sign ? .newline : null, inputFormatters: [ - LengthLimitingTextInputFormatter( - type == ProfileType.uname ? 16 : 70, - ), + LengthLimitingTextInputFormatter(type == .uname ? 16 : 70), ], decoration: InputDecoration( hintText: text, @@ -359,13 +353,13 @@ class _EditProfilePageState extends State { 'platform': 'android', 's_locale': 'zh_CN', 'statistics': Constants.statistics, - if (type == ProfileType.uname) + if (type == .uname) 'uname': _textController.text - else if (type == ProfileType.sign) + else if (type == .sign) 'user_sign': _textController.text - else if (type == ProfileType.birthday) + else if (type == .birthday) 'birthday': datum - else if (type == ProfileType.sex) + else if (type == .sex) 'sex': datum.toString(), }; AppSign.appSign(data); @@ -378,7 +372,7 @@ class _EditProfilePageState extends State { ).then((res) { if (res.data['code'] == 0) { AccountMyInfoData data = _loadingState.data; - if (type == ProfileType.uname) { + if (type == .uname) { data ..name = _textController.text ..coins = data.coins! - 6; @@ -392,18 +386,18 @@ class _EditProfilePageState extends State { ..value.uname = _textController.text ..refresh(); } catch (_) {} - } else if (type == ProfileType.sign) { + } else if (type == .sign) { data.sign = _textController.text; - } else if (type == ProfileType.birthday) { + } else if (type == .birthday) { data.birthday = datum; - } else if (type == ProfileType.sex) { + } else if (type == .sex) { data.sex = datum; } SmartDialog.showToast('修改成功'); if (mounted) { setState(() {}); } - if (type == ProfileType.uname || type == ProfileType.sign) { + if (type == .uname || type == .sign) { Get.back(); } } else { @@ -436,21 +430,21 @@ class _EditProfilePageState extends State { title, style: const TextStyle( fontSize: 14, - fontWeight: FontWeight.normal, + fontWeight: .normal, ), ), title: Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: .end, children: [ if (text != null) Flexible( child: Text( text, maxLines: 1, - overflow: TextOverflow.ellipsis, + overflow: .ellipsis, style: TextStyle( fontSize: 14, - fontWeight: FontWeight.normal, + fontWeight: .normal, color: theme.colorScheme.outline, ), ), @@ -472,7 +466,7 @@ class _EditProfilePageState extends State { Future _pickImg(ThemeData theme) async { try { XFile? pickedFile = await _imagePicker.pickImage( - source: ImageSource.gallery, + source: .gallery, imageQuality: 100, ); if (pickedFile != null && mounted) { @@ -496,13 +490,13 @@ class _EditProfilePageState extends State { aspectRatioPresets: const [CropAspectRatioPresetCustom()], lockAspectRatio: true, hideBottomControls: true, - cropStyle: CropStyle.circle, + cropStyle: .circle, initAspectRatio: const CropAspectRatioPresetCustom(), ), IOSUiSettings( title: '裁剪', aspectRatioPresets: const [CropAspectRatioPresetCustom()], - cropStyle: CropStyle.circle, + cropStyle: .circle, aspectRatioLockEnabled: true, resetAspectRatioEnabled: false, aspectRatioPickerButtonHidden: true, diff --git a/lib/pages/member_search/child/view.dart b/lib/pages/member_search/child/view.dart index dda42631f..d7e72ac53 100644 --- a/lib/pages/member_search/child/view.dart +++ b/lib/pages/member_search/child/view.dart @@ -43,7 +43,10 @@ class _MemberSearchChildPageState extends State SliverPadding( padding: EdgeInsets.only( top: widget.searchType == MemberSearchType.archive ? 7 : 0, - bottom: MediaQuery.viewPaddingOf(context).bottom + 100, + bottom: + MediaQuery.viewPaddingOf(context).bottom + + MediaQuery.viewInsetsOf(context).bottom + + 100, ), sliver: switch (widget.searchType) { MemberSearchType.archive => Obx( diff --git a/lib/pages/member_search/controller.dart b/lib/pages/member_search/controller.dart index 91a323dd6..0d6aeb24b 100644 --- a/lib/pages/member_search/controller.dart +++ b/lib/pages/member_search/controller.dart @@ -47,7 +47,7 @@ class MemberSearchController extends GetxController } } - void submit() { + void submit([_]) { if (editingController.text.isNotEmpty) { hasData.value = true; arcCtr diff --git a/lib/pages/member_search/view.dart b/lib/pages/member_search/view.dart index f8ce78ef9..ee2e6a181 100644 --- a/lib/pages/member_search/view.dart +++ b/lib/pages/member_search/view.dart @@ -49,7 +49,7 @@ class _MemberSearchPageState extends State { onPressed: _controller.onClear, ), ), - onSubmitted: (value) => _controller.submit(), + onSubmitted: _controller.submit, onChanged: (value) { if (value.isEmpty) { _controller.hasData.value = false; diff --git a/lib/pages/search/controller.dart b/lib/pages/search/controller.dart index 536c91e73..687754bbe 100644 --- a/lib/pages/search/controller.dart +++ b/lib/pages/search/controller.dart @@ -138,7 +138,7 @@ class SSearchController extends GetxController } // 搜索 - Future submit() async { + Future submit([_]) async { if (controller.text.isEmpty) { if (hintText.isNullOrEmpty) { return; diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index f040dab41..8f2a1537d 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -57,10 +57,13 @@ class _SearchPageState extends State { trending, _buildHistory, ] else - SliverCrossAxisGroup( - slivers: [trending, _buildHistory], + SliverCrossAxisGroup(slivers: [trending, _buildHistory]), + SliverPadding( + padding: .only( + bottom: + padding.bottom + MediaQuery.viewInsetsOf(context).bottom, ), - SliverPadding(padding: .only(bottom: padding.bottom)), + ), ], ), ), @@ -109,7 +112,7 @@ class _SearchPageState extends State { hintText: _searchController.hintText ?? '搜索', border: InputBorder.none, ), - onSubmitted: (value) => _searchController.submit(), + onSubmitted: _searchController.submit, ), ); diff --git a/lib/pages/settings_search/view.dart b/lib/pages/settings_search/view.dart index 5fd43c7f4..4364109e1 100644 --- a/lib/pages/settings_search/view.dart +++ b/lib/pages/settings_search/view.dart @@ -105,6 +105,9 @@ class _SettingsSearchPageState ), ), ), + SliverPadding( + padding: .only(bottom: MediaQuery.viewInsetsOf(context).bottom), + ), ], ), ); diff --git a/lib/pages/video/reply_search_item/child/view.dart b/lib/pages/video/reply_search_item/child/view.dart index d73cecedc..85921bdf5 100644 --- a/lib/pages/video/reply_search_item/child/view.dart +++ b/lib/pages/video/reply_search_item/child/view.dart @@ -38,9 +38,12 @@ class _ReplySearchChildPageState extends State physics: const AlwaysScrollableScrollPhysics(), slivers: [ SliverPadding( - padding: EdgeInsets.only( + padding: .only( top: 7, - bottom: MediaQuery.viewPaddingOf(context).bottom + 100, + bottom: + MediaQuery.viewPaddingOf(context).bottom + + MediaQuery.viewInsetsOf(context).bottom + + 100, ), sliver: Obx(() => _buildBody(_controller.loadingState.value)), ), diff --git a/lib/pages/video/reply_search_item/controller.dart b/lib/pages/video/reply_search_item/controller.dart index e2f341514..db90fe799 100644 --- a/lib/pages/video/reply_search_item/controller.dart +++ b/lib/pages/video/reply_search_item/controller.dart @@ -42,7 +42,7 @@ class ReplySearchController extends GetxController submit(); } - void submit() { + void submit([_]) { videoCtr ..scrollController.jumpToTop() ..onReload(); diff --git a/lib/pages/video/reply_search_item/view.dart b/lib/pages/video/reply_search_item/view.dart index 97cb85e31..d10207055 100644 --- a/lib/pages/video/reply_search_item/view.dart +++ b/lib/pages/video/reply_search_item/view.dart @@ -62,7 +62,7 @@ class _ReplySearchPageState extends State { onPressed: _controller.onClear, ), ), - onSubmitted: (value) => _controller.submit(), + onSubmitted: _controller.submit, ), ), body: ViewSafeArea( diff --git a/lib/pages/whisper_settings/widgets/item.dart b/lib/pages/whisper_settings/widgets/item.dart index 37151a347..1caf76652 100644 --- a/lib/pages/whisper_settings/widgets/item.dart +++ b/lib/pages/whisper_settings/widgets/item.dart @@ -30,7 +30,7 @@ class ImSettingsItem extends StatelessWidget { final subtitleStyle = TextStyle(fontSize: 13, color: outline); if (item.hasSwitch_1()) { - Future onChanged() async { + Future onChanged([_]) async { item.switch_1.switchOn = !item.switch_1.switchOn; rebuild(); if (!await onSet()) { @@ -54,7 +54,7 @@ class ImSettingsItem extends StatelessWidget { scale: 0.8, child: Switch( value: item.switch_1.switchOn, - onChanged: (value) => onChanged(), + onChanged: onChanged, ), ), ); diff --git a/lib/plugin/pl_player/view/view.dart b/lib/plugin/pl_player/view/view.dart index 09d632ebc..a01c509dd 100644 --- a/lib/plugin/pl_player/view/view.dart +++ b/lib/plugin/pl_player/view/view.dart @@ -1756,11 +1756,9 @@ class _PLVideoPlayerState extends State child: BackwardSeekIndicator( duration: plPlayerController.fastForBackwardDuration, - onSubmitted: (Duration value) { - plPlayerController - ..mountSeekBackwardButton.value = false - ..onBackward(value); - }, + onSubmitted: (value) => plPlayerController + ..mountSeekBackwardButton.value = false + ..onBackward(value), ), ), ), @@ -1777,11 +1775,9 @@ class _PLVideoPlayerState extends State child: ForwardSeekIndicator( duration: plPlayerController.fastForBackwardDuration, - onSubmitted: (Duration value) { - plPlayerController - ..mountSeekForwardButton.value = false - ..onForward(value); - }, + onSubmitted: (value) => plPlayerController + ..mountSeekForwardButton.value = false + ..onForward(value), ), ), ),