mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 03:54:49 +08:00
@@ -15,7 +15,7 @@ abstract class CommonSearchController<R, T> extends CommonListController<R, T> {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onRefresh() {
|
||||
Future<void> onRefresh([_]) {
|
||||
if (editController.value.text.isEmpty) {
|
||||
return Future.syncValue(null);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ abstract class CommonSearchPageState<S extends StatefulWidget, R, T>
|
||||
ViewSliverSafeArea(
|
||||
sliver: Obx(() => _buildBody(controller.loadingState.value)),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: .only(bottom: MediaQuery.viewInsetsOf(context).bottom),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -81,7 +84,7 @@ abstract class CommonSearchPageState<S extends StatefulWidget, R, T>
|
||||
..focusNode.requestFocus(),
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) => controller.onRefresh(),
|
||||
onSubmitted: controller.onRefresh,
|
||||
),
|
||||
);
|
||||
if (multiSelect) {
|
||||
|
||||
@@ -177,7 +177,12 @@ class _CreateFavPageState extends State<CreateFavPage> {
|
||||
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<CreateFavPage> {
|
||||
},
|
||||
);
|
||||
},
|
||||
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<CreateFavPage> {
|
||||
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<CreateFavPage> {
|
||||
ListTile(
|
||||
tileColor: theme.colorScheme.onInverseSurface,
|
||||
title: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 55,
|
||||
@@ -364,7 +366,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
void onTap() {
|
||||
void onTap([_]) {
|
||||
_isPublic = !_isPublic;
|
||||
(context as Element).markNeedsBuild();
|
||||
}
|
||||
@@ -381,7 +383,7 @@ class _CreateFavPageState extends State<CreateFavPage> {
|
||||
scale: 0.8,
|
||||
child: Switch(
|
||||
value: _isPublic,
|
||||
onChanged: (value) => onTap(),
|
||||
onChanged: onTap,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -42,11 +42,14 @@ class _LiveSearchChildPageState extends State<LiveSearchChildPage>
|
||||
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)),
|
||||
),
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -49,7 +49,7 @@ class _LiveSearchPageState extends State<LiveSearchPage> {
|
||||
onPressed: _controller.onClear,
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) => _controller.submit(),
|
||||
onSubmitted: _controller.submit,
|
||||
onChanged: (value) {
|
||||
if (value.isEmpty) {
|
||||
_controller.hasData.value = false;
|
||||
|
||||
@@ -39,9 +39,12 @@ class _LoginPageState extends State<LoginPage> {
|
||||
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) {
|
||||
|
||||
@@ -85,13 +85,11 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
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<EditProfilePage> {
|
||||
SmartDialog.showToast('硬币不足');
|
||||
} else {
|
||||
_editDialog(
|
||||
type: ProfileType.uname,
|
||||
type: .uname,
|
||||
title: '昵称',
|
||||
text: response.name!,
|
||||
);
|
||||
@@ -193,7 +191,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
).then((res) {
|
||||
if (res != null) {
|
||||
_update(
|
||||
type: ProfileType.birthday,
|
||||
type: .birthday,
|
||||
datum: DateFormatUtils.longFormat.format(res),
|
||||
);
|
||||
}
|
||||
@@ -205,7 +203,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
title: '个性签名',
|
||||
text: response.sign,
|
||||
onTap: () => _editDialog(
|
||||
type: ProfileType.sign,
|
||||
type: .sign,
|
||||
title: '个性签名',
|
||||
text: response.sign ?? '',
|
||||
),
|
||||
@@ -277,7 +275,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
|
||||
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<EditProfilePage> {
|
||||
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<EditProfilePage> {
|
||||
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<EditProfilePage> {
|
||||
'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<EditProfilePage> {
|
||||
).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<EditProfilePage> {
|
||||
..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<EditProfilePage> {
|
||||
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<EditProfilePage> {
|
||||
Future<void> _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<EditProfilePage> {
|
||||
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,
|
||||
|
||||
@@ -43,7 +43,10 @@ class _MemberSearchChildPageState extends State<MemberSearchChildPage>
|
||||
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(
|
||||
|
||||
@@ -47,7 +47,7 @@ class MemberSearchController extends GetxController
|
||||
}
|
||||
}
|
||||
|
||||
void submit() {
|
||||
void submit([_]) {
|
||||
if (editingController.text.isNotEmpty) {
|
||||
hasData.value = true;
|
||||
arcCtr
|
||||
|
||||
@@ -49,7 +49,7 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
|
||||
onPressed: _controller.onClear,
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) => _controller.submit(),
|
||||
onSubmitted: _controller.submit,
|
||||
onChanged: (value) {
|
||||
if (value.isEmpty) {
|
||||
_controller.hasData.value = false;
|
||||
|
||||
@@ -138,7 +138,7 @@ class SSearchController extends GetxController
|
||||
}
|
||||
|
||||
// 搜索
|
||||
Future<void> submit() async {
|
||||
Future<void> submit([_]) async {
|
||||
if (controller.text.isEmpty) {
|
||||
if (hintText.isNullOrEmpty) {
|
||||
return;
|
||||
|
||||
@@ -57,10 +57,13 @@ class _SearchPageState extends State<SearchPage> {
|
||||
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<SearchPage> {
|
||||
hintText: _searchController.hintText ?? '搜索',
|
||||
border: InputBorder.none,
|
||||
),
|
||||
onSubmitted: (value) => _searchController.submit(),
|
||||
onSubmitted: _searchController.submit,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -105,6 +105,9 @@ class _SettingsSearchPageState
|
||||
),
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: .only(bottom: MediaQuery.viewInsetsOf(context).bottom),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -38,9 +38,12 @@ class _ReplySearchChildPageState extends State<ReplySearchChildPage>
|
||||
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)),
|
||||
),
|
||||
|
||||
@@ -42,7 +42,7 @@ class ReplySearchController extends GetxController
|
||||
submit();
|
||||
}
|
||||
|
||||
void submit() {
|
||||
void submit([_]) {
|
||||
videoCtr
|
||||
..scrollController.jumpToTop()
|
||||
..onReload();
|
||||
|
||||
@@ -62,7 +62,7 @@ class _ReplySearchPageState extends State<ReplySearchPage> {
|
||||
onPressed: _controller.onClear,
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) => _controller.submit(),
|
||||
onSubmitted: _controller.submit,
|
||||
),
|
||||
),
|
||||
body: ViewSafeArea(
|
||||
|
||||
@@ -30,7 +30,7 @@ class ImSettingsItem extends StatelessWidget {
|
||||
final subtitleStyle = TextStyle(fontSize: 13, color: outline);
|
||||
|
||||
if (item.hasSwitch_1()) {
|
||||
Future<void> onChanged() async {
|
||||
Future<void> 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,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user