mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-13 17:07:40 +00:00
fix(flutter_desktop): selection in AI chat going missing while scrolling (#7281)
This commit is contained in:
parent
00cdee831d
commit
fc9c152553
@ -121,21 +121,24 @@ class _ChatContentPage extends StatelessWidget {
|
|||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: _wrapConstraints(
|
child: _wrapConstraints(
|
||||||
ScrollConfiguration(
|
SelectionArea(
|
||||||
behavior: ScrollConfiguration.of(context)
|
child: ScrollConfiguration(
|
||||||
.copyWith(scrollbars: false),
|
behavior: ScrollConfiguration.of(context)
|
||||||
child: Chat(
|
.copyWith(scrollbars: false),
|
||||||
chatController:
|
child: Chat(
|
||||||
context.read<ChatBloc>().chatController,
|
chatController:
|
||||||
user: User(id: userProfile.id.toString()),
|
context.read<ChatBloc>().chatController,
|
||||||
darkTheme: ChatTheme.fromThemeData(Theme.of(context)),
|
user: User(id: userProfile.id.toString()),
|
||||||
theme: ChatTheme.fromThemeData(Theme.of(context)),
|
darkTheme:
|
||||||
builders: Builders(
|
ChatTheme.fromThemeData(Theme.of(context)),
|
||||||
inputBuilder: (_) => const SizedBox.shrink(),
|
theme: ChatTheme.fromThemeData(Theme.of(context)),
|
||||||
textMessageBuilder: _buildTextMessage,
|
builders: Builders(
|
||||||
chatMessageBuilder: _buildChatMessage,
|
inputBuilder: (_) => const SizedBox.shrink(),
|
||||||
scrollToBottomBuilder: _buildScrollToBottom,
|
textMessageBuilder: _buildTextMessage,
|
||||||
chatAnimatedListBuilder: _buildChatAnimatedList,
|
chatMessageBuilder: _buildChatMessage,
|
||||||
|
scrollToBottomBuilder: _buildScrollToBottom,
|
||||||
|
chatAnimatedListBuilder: _buildChatAnimatedList,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -83,7 +83,6 @@ class TextMessageText extends StatelessWidget {
|
|||||||
text,
|
text,
|
||||||
lineHeight: 1.4,
|
lineHeight: 1.4,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
selectable: true,
|
|
||||||
color: AFThemeExtension.of(context).textColor,
|
color: AFThemeExtension.of(context).textColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
final TextDecoration? decoration;
|
final TextDecoration? decoration;
|
||||||
final Color? decorationColor;
|
final Color? decorationColor;
|
||||||
final double? decorationThickness;
|
final double? decorationThickness;
|
||||||
final bool selectable;
|
|
||||||
final String? fontFamily;
|
final String? fontFamily;
|
||||||
final List<String>? fallbackFontFamily;
|
final List<String>? fallbackFontFamily;
|
||||||
final bool withTooltip;
|
final bool withTooltip;
|
||||||
@ -41,7 +40,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.fallbackFontFamily,
|
this.fallbackFontFamily,
|
||||||
// // https://api.flutter.dev/flutter/painting/TextStyle/height.html
|
// // https://api.flutter.dev/flutter/painting/TextStyle/height.html
|
||||||
@ -63,7 +61,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.fallbackFontFamily,
|
this.fallbackFontFamily,
|
||||||
this.lineHeight,
|
this.lineHeight,
|
||||||
@ -86,7 +83,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.fallbackFontFamily,
|
this.fallbackFontFamily,
|
||||||
this.lineHeight,
|
this.lineHeight,
|
||||||
@ -108,7 +104,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.fallbackFontFamily,
|
this.fallbackFontFamily,
|
||||||
this.lineHeight,
|
this.lineHeight,
|
||||||
@ -130,7 +125,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.fallbackFontFamily,
|
this.fallbackFontFamily,
|
||||||
this.lineHeight,
|
this.lineHeight,
|
||||||
@ -153,7 +147,6 @@ class FlowyText extends StatelessWidget {
|
|||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.decoration,
|
this.decoration,
|
||||||
this.decorationColor,
|
this.decorationColor,
|
||||||
this.selectable = false,
|
|
||||||
this.lineHeight,
|
this.lineHeight,
|
||||||
this.withTooltip = false,
|
this.withTooltip = false,
|
||||||
this.strutStyle = const StrutStyle(forceStrutHeight: true),
|
this.strutStyle = const StrutStyle(forceStrutHeight: true),
|
||||||
@ -211,32 +204,21 @@ class FlowyText extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectable) {
|
child = Text(
|
||||||
child = IntrinsicHeight(
|
text,
|
||||||
child: SelectableText(
|
maxLines: maxLines,
|
||||||
text,
|
textAlign: textAlign,
|
||||||
maxLines: maxLines,
|
overflow: overflow ?? TextOverflow.clip,
|
||||||
textAlign: textAlign,
|
style: textStyle,
|
||||||
style: textStyle,
|
strutStyle: !isEmoji || (isEmoji && optimizeEmojiAlign)
|
||||||
),
|
? StrutStyle.fromTextStyle(
|
||||||
);
|
textStyle,
|
||||||
} else {
|
forceStrutHeight: true,
|
||||||
child = Text(
|
leadingDistribution: TextLeadingDistribution.even,
|
||||||
text,
|
height: lineHeight,
|
||||||
maxLines: maxLines,
|
)
|
||||||
textAlign: textAlign,
|
: null,
|
||||||
overflow: overflow ?? TextOverflow.clip,
|
);
|
||||||
style: textStyle,
|
|
||||||
strutStyle: !isEmoji || (isEmoji && optimizeEmojiAlign)
|
|
||||||
? StrutStyle.fromTextStyle(
|
|
||||||
textStyle,
|
|
||||||
forceStrutHeight: true,
|
|
||||||
leadingDistribution: TextLeadingDistribution.even,
|
|
||||||
height: lineHeight,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (withTooltip) {
|
if (withTooltip) {
|
||||||
child = FlowyTooltip(
|
child = FlowyTooltip(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user