fix: dynamically update input bar height to offset event list (#1859)
parent
99b7b7cd42
commit
e591ce3a4d
@ -0,0 +1,80 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/themes.dart';
|
||||||
|
import 'package:fluffychat/pages/chat/chat.dart';
|
||||||
|
import 'package:fluffychat/pages/chat/chat_emoji_picker.dart';
|
||||||
|
import 'package:fluffychat/pages/chat/reply_display.dart';
|
||||||
|
import 'package:fluffychat/pangea/chat/widgets/input_bar_wrapper.dart';
|
||||||
|
import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart';
|
||||||
|
|
||||||
|
class ChatInputBar extends StatefulWidget {
|
||||||
|
final ChatController controller;
|
||||||
|
final double padding;
|
||||||
|
|
||||||
|
const ChatInputBar({
|
||||||
|
required this.controller,
|
||||||
|
required this.padding,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ChatInputBar> createState() => ChatInputBarState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class ChatInputBarState extends State<ChatInputBar> {
|
||||||
|
void updateHeight() {
|
||||||
|
final renderBox = context.findRenderObject() as RenderBox?;
|
||||||
|
if (renderBox == null || !renderBox.hasSize) return;
|
||||||
|
widget.controller.updateInputBarHeight(renderBox.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return NotificationListener(
|
||||||
|
onNotification: (SizeChangedLayoutNotification notification) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) => updateHeight());
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: SizeChangedLayoutNotifier(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: widget.padding,
|
||||||
|
left: widget.padding,
|
||||||
|
right: widget.padding,
|
||||||
|
),
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxWidth: FluffyThemes.columnWidth * 2.5,
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Material(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(24),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ITBar(choreographer: widget.controller.choreographer),
|
||||||
|
DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ReplyDisplay(widget.controller),
|
||||||
|
ChatInputRowWrapper(
|
||||||
|
controller: widget.controller,
|
||||||
|
),
|
||||||
|
ChatEmojiPicker(widget.controller),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
|
import 'package:fluffychat/config/themes.dart';
|
||||||
|
import 'package:fluffychat/pages/chat/chat.dart';
|
||||||
|
import 'package:fluffychat/pangea/analytics_misc/gain_points_animation.dart';
|
||||||
|
import 'package:fluffychat/pangea/analytics_misc/put_analytics_controller.dart';
|
||||||
|
import 'package:fluffychat/pangea/chat/widgets/chat_floating_action_button.dart';
|
||||||
|
|
||||||
|
class ChatInputBarHeader extends StatelessWidget {
|
||||||
|
final ChatController controller;
|
||||||
|
final double padding;
|
||||||
|
|
||||||
|
const ChatInputBarHeader({
|
||||||
|
required this.controller,
|
||||||
|
required this.padding,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (controller.selectMode) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
bottom: 10,
|
||||||
|
left: padding,
|
||||||
|
right: padding,
|
||||||
|
),
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
maxWidth: FluffyThemes.columnWidth * 2.4,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
const PointsGainedAnimation(
|
||||||
|
gainColor: AppConfig.gold,
|
||||||
|
origin: AnalyticsUpdateOrigin.sendMessage,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 100),
|
||||||
|
ChatFloatingActionButton(
|
||||||
|
controller: controller,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue