Next refactors
Some checks failed
Build Linux App / build (push) Failing after 1m18s

This commit is contained in:
Kazimierz Ciołek
2026-02-24 02:19:28 +01:00
parent 0c9eb8878d
commit 9dcc4b87de
40 changed files with 3515 additions and 2575 deletions

View File

@@ -0,0 +1,89 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
import 'package:trainhub_flutter/core/theme/app_colors.dart';
import 'package:trainhub_flutter/presentation/chat/chat_state.dart';
import 'package:trainhub_flutter/presentation/chat/widgets/thinking_block.dart';
import 'package:trainhub_flutter/presentation/chat/widgets/typing_indicator.dart';
class TypingBubble extends StatelessWidget {
const TypingBubble({
super.key,
required this.thinkingSteps,
this.streamingContent,
});
final List<ThinkingStep> thinkingSteps;
final String? streamingContent;
@override
Widget build(BuildContext context) {
final maxWidth = MediaQuery.of(context).size.width * 0.55;
return Padding(
padding: const EdgeInsets.only(bottom: UIConstants.spacing12),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 28,
height: 28,
decoration: BoxDecoration(
color: AppColors.surfaceContainerHigh,
borderRadius: BorderRadius.circular(8),
),
child: const Icon(
Icons.auto_awesome_rounded,
size: 14,
color: AppColors.accent,
),
),
const SizedBox(width: UIConstants.spacing8),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (thinkingSteps.isNotEmpty)
Container(
constraints: BoxConstraints(maxWidth: maxWidth),
margin: const EdgeInsets.only(bottom: 8),
child: ThinkingBlock(steps: thinkingSteps),
),
if (streamingContent != null && streamingContent!.isNotEmpty)
Container(
constraints: BoxConstraints(maxWidth: maxWidth),
padding: const EdgeInsets.symmetric(
horizontal: UIConstants.spacing16,
vertical: UIConstants.spacing12,
),
decoration: BoxDecoration(
color: AppColors.surfaceContainer,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
bottomLeft: Radius.circular(4),
bottomRight: Radius.circular(16),
),
border:
Border.all(color: AppColors.border, width: 1),
),
child: MarkdownBody(
data: streamingContent!,
styleSheet: MarkdownStyleSheet(
p: const TextStyle(
color: AppColors.textPrimary,
fontSize: 14,
height: 1.5,
),
),
),
)
else
const TypingIndicator(),
],
),
),
],
),
);
}
}