Merge branch 'fix'

This commit is contained in:
guozhigq
2024-03-01 00:15:14 +08:00
3 changed files with 62 additions and 55 deletions

View File

@ -88,36 +88,32 @@ class _UpPanelState extends State<UpPanel> {
Container( Container(
height: 90, height: 90,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: Row( child: Expanded(
children: [ child: ListView(
Expanded( scrollDirection: Axis.horizontal,
child: ListView( controller: scrollController,
scrollDirection: Axis.horizontal, children: [
controller: scrollController, const SizedBox(width: 10),
children: [ if (liveList.isNotEmpty) ...[
const SizedBox(width: 10), for (int i = 0; i < liveList.length; i++) ...[
if (liveList.isNotEmpty) ...[ upItemBuild(liveList[i], i)
for (int i = 0; i < liveList.length; i++) ...[
upItemBuild(liveList[i], i)
],
VerticalDivider(
indent: 20,
endIndent: 40,
width: 26,
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5),
),
],
for (int i = 0; i < upList.length; i++) ...[
upItemBuild(upList[i], i)
],
const SizedBox(width: 10),
], ],
), VerticalDivider(
), indent: 20,
], endIndent: 40,
width: 26,
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5),
),
],
for (int i = 0; i < upList.length; i++) ...[
upItemBuild(upList[i], i)
],
const SizedBox(width: 10),
],
),
), ),
), ),
Container( Container(

View File

@ -109,21 +109,24 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { final String routePath = Get.currentRoute;
// 键盘高度 if (mounted && routePath.startsWith('/video')) {
final viewInsets = EdgeInsets.fromViewPadding( WidgetsBinding.instance.addPostFrameCallback((_) {
View.of(context).viewInsets, View.of(context).devicePixelRatio); // 键盘高度
_debouncer.run(() { final viewInsets = EdgeInsets.fromViewPadding(
if (mounted) { View.of(context).viewInsets, View.of(context).devicePixelRatio);
if (keyboardHeight == 0 && emoteHeight == 0) { _debouncer.run(() {
setState(() { if (mounted) {
emoteHeight = keyboardHeight = if (keyboardHeight == 0 && emoteHeight == 0) {
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; setState(() {
}); emoteHeight = keyboardHeight =
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
});
}
} }
} });
}); });
}); }
} }
@override @override
@ -131,11 +134,15 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
_replyContentController.dispose(); _replyContentController.dispose();
replyContentFocusNode.removeListener(() {}); replyContentFocusNode.removeListener(() {});
replyContentFocusNode.dispose();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double keyboardHeight = EdgeInsets.fromViewPadding(
View.of(context).viewInsets, View.of(context).devicePixelRatio)
.bottom;
return Container( return Container(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -51,27 +51,31 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { final String routePath = Get.currentRoute;
// 键盘高度 if (mounted && routePath.startsWith('/whisper_detail')) {
final viewInsets = EdgeInsets.fromViewPadding( WidgetsBinding.instance.addPostFrameCallback((_) {
View.of(context).viewInsets, View.of(context).devicePixelRatio); // 键盘高度
_debouncer.run(() { final viewInsets = EdgeInsets.fromViewPadding(
if (mounted) { View.of(context).viewInsets, View.of(context).devicePixelRatio);
if (keyboardHeight == 0) { _debouncer.run(() {
setState(() { if (mounted) {
emoteHeight = keyboardHeight = if (keyboardHeight == 0) {
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; setState(() {
}); emoteHeight = keyboardHeight =
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
});
}
} }
} });
}); });
}); }
} }
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
replyContentFocusNode.removeListener(() {}); replyContentFocusNode.removeListener(() {});
replyContentFocusNode.dispose();
super.dispose(); super.dispose();
} }