From a63763721b6e70f0cce84e84df5b362ec19e8d18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 11:28:26 +0000 Subject: [PATCH 1/2] Initial plan From 9bc9c35815c9b9579377ce970e3d234e27aaac53 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 11:31:53 +0000 Subject: [PATCH 2/2] Add chatTextFieldHeightFallback parameter to ChatView widget Agent-Logs-Url: https://github.com/SimformSolutionsPvtLtd/chatview/sessions/52d306bf-39f4-4ed3-aa9a-c5c140d46e10 Co-authored-by: vatsaltanna-simformsolutions <63704011+vatsaltanna-simformsolutions@users.noreply.github.com> --- lib/src/extensions/extensions.dart | 4 +++- lib/src/widgets/chat_view.dart | 10 ++++++++++ lib/src/widgets/chat_view_inherited_widget.dart | 11 ++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/src/extensions/extensions.dart b/lib/src/extensions/extensions.dart index d7371e70..b770ed05 100644 --- a/lib/src/extensions/extensions.dart +++ b/lib/src/extensions/extensions.dart @@ -261,12 +261,14 @@ extension BuildContextExtension on BuildContext { /// This getter will provide the height of the text field from the /// current context if available, otherwise it will return the - /// default height of the text field. + /// configurable fallback height from [ChatViewInheritedWidget], or the + /// [defaultChatTextFieldHeight] if no fallback is configured. /// /// **Note**: Make sure the `chatTextFieldViewKey` is assigned to retrieve /// actual height of text field. double get textFieldHeight => chatViewIW?.chatTextFieldViewKey.currentContext?.size?.height ?? + chatViewIW?.chatTextFieldHeightFallback ?? defaultChatTextFieldHeight; ChatViewInheritedWidget? get chatViewIW => diff --git a/lib/src/widgets/chat_view.dart b/lib/src/widgets/chat_view.dart index be3c7a9e..f615d2ca 100644 --- a/lib/src/widgets/chat_view.dart +++ b/lib/src/widgets/chat_view.dart @@ -30,6 +30,7 @@ import 'package:flutter/material.dart'; import '../extensions/extensions.dart'; import '../inherited_widgets/configurations_inherited_widgets.dart'; +import '../utils/constants/constants.dart'; import '../utils/timeago/timeago.dart'; import '../values/custom_time_messages.dart'; import '../values/enumeration.dart'; @@ -65,6 +66,7 @@ class ChatView extends StatefulWidget { this.replyMessageBuilder, this.replySuggestionsConfig, this.scrollToBottomButtonConfig, + this.chatTextFieldHeightFallback, }) : chatBackgroundConfig = chatBackgroundConfig ?? const ChatBackgroundConfiguration(), chatViewStateConfig = @@ -152,6 +154,12 @@ class ChatView extends StatefulWidget { /// Provides a configuration for scroll to bottom button config final ScrollToBottomButtonConfig? scrollToBottomButtonConfig; + /// Fallback height used for the bottom padding of the message list when the + /// actual chat text field height cannot be determined from the layout. + /// This is useful to prevent the last message from being hidden behind the + /// chat input field. If not provided, defaults to [defaultChatTextFieldHeight]. + final double? chatTextFieldHeightFallback; + static void closeReplyMessageView(BuildContext context) { final state = context.findAncestorStateOfType<_ChatViewState>(); @@ -216,6 +224,8 @@ class _ChatViewState extends State featureActiveConfig: featureActiveConfig, profileCircleConfiguration: widget.profileCircleConfig, chatTextFieldViewKey: chatTextFieldViewKey, + chatTextFieldHeightFallback: widget.chatTextFieldHeightFallback ?? + defaultChatTextFieldHeight, child: SuggestionsConfigIW( suggestionsConfig: widget.replySuggestionsConfig, child: ConfigurationsInheritedWidget( diff --git a/lib/src/widgets/chat_view_inherited_widget.dart b/lib/src/widgets/chat_view_inherited_widget.dart index d230ec98..6d7c2a00 100644 --- a/lib/src/widgets/chat_view_inherited_widget.dart +++ b/lib/src/widgets/chat_view_inherited_widget.dart @@ -25,6 +25,7 @@ import 'package:flutter/material.dart'; import '../models/config_models/feature_active_config.dart'; import '../models/config_models/profile_circle_configuration.dart'; +import '../utils/constants/constants.dart'; import 'reaction_popup.dart'; /// This widget for alternative of excessive amount of passing arguments @@ -37,11 +38,18 @@ class ChatViewInheritedWidget extends InheritedWidget { required this.chatController, required this.chatTextFieldViewKey, this.profileCircleConfiguration, + this.chatTextFieldHeightFallback = defaultChatTextFieldHeight, }) : super(key: key, child: child); final FeatureActiveConfig featureActiveConfig; final ProfileCircleConfiguration? profileCircleConfiguration; final ChatController chatController; final GlobalKey chatTextFieldViewKey; + + /// Fallback height used for the bottom padding of the message list when the + /// actual chat text field height cannot be determined from the layout. + /// Defaults to [defaultChatTextFieldHeight]. + final double chatTextFieldHeightFallback; + final ValueNotifier showPopUp = ValueNotifier(false); final ValueNotifier chatTextFieldHeight = ValueNotifier(0.0); final GlobalKey reactionPopupKey = GlobalKey(); @@ -51,5 +59,6 @@ class ChatViewInheritedWidget extends InheritedWidget { @override bool updateShouldNotify(covariant ChatViewInheritedWidget oldWidget) => - oldWidget.featureActiveConfig != featureActiveConfig; + oldWidget.featureActiveConfig != featureActiveConfig || + oldWidget.chatTextFieldHeightFallback != chatTextFieldHeightFallback; }