refactor: tweaks

This commit is contained in:
cogwheel0
2025-09-20 19:23:37 +05:30
parent 185196df98
commit 9662e22cce
2 changed files with 34 additions and 25 deletions

View File

@@ -457,7 +457,11 @@ class _AssistantMessageWidgetState extends ConsumerState<AssistantMessageWidget>
Widget _buildDocumentationMessage() { Widget _buildDocumentationMessage() {
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: const EdgeInsets.only(bottom: 16, left: 12, right: 12), margin: const EdgeInsets.only(
bottom: 16,
left: Spacing.xs,
right: Spacing.xs,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View File

@@ -587,8 +587,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
textInputAction: sendOnEnter textInputAction: sendOnEnter
? TextInputAction.send ? TextInputAction.send
: TextInputAction.newline, : TextInputAction.newline,
autofillHints: autofillHints: const <String>[],
const <String>[],
showCursor: true, showCursor: true,
scrollPadding: scrollPadding:
const EdgeInsets.only( const EdgeInsets.only(
@@ -1159,7 +1158,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
final bodyChildren = <Widget>[ final bodyChildren = <Widget>[
const SheetHandle(), const SheetHandle(),
const SizedBox(height: Spacing.md), const SizedBox(height: Spacing.sm),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
@@ -1167,7 +1166,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
for (var i = 0; i < attachments.length; i++) ...[ for (var i = 0; i < attachments.length; i++) ...[
if (i != 0) const SizedBox(width: Spacing.md), if (i != 0) const SizedBox(width: Spacing.sm),
Expanded(child: attachments[i]), Expanded(child: attachments[i]),
], ],
], ],
@@ -1178,12 +1177,12 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
if (featureTiles.isNotEmpty) { if (featureTiles.isNotEmpty) {
bodyChildren bodyChildren
..add(const SizedBox(height: Spacing.md)) ..add(const SizedBox(height: Spacing.sm))
..addAll(_withVerticalSpacing(featureTiles, Spacing.xs)); ..addAll(_withVerticalSpacing(featureTiles, Spacing.xxs));
} }
bodyChildren bodyChildren
..add(const SizedBox(height: Spacing.md)) ..add(const SizedBox(height: Spacing.sm))
..add(_buildSectionLabel(l10n.tools)) ..add(_buildSectionLabel(l10n.tools))
..add(toolsSection); ..add(toolsSection);
@@ -1219,8 +1218,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
0.9, 0.9,
); );
} }
final double computedMin = math.min(0.25, computedMax); final double computedMin = math.min(0.2, computedMax);
final double computedInitial = math.min(0.4, computedMax); final double computedInitial = math.min(0.34, computedMax);
return Stack( return Stack(
children: [ children: [
@@ -1252,6 +1251,12 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
boxShadow: ConduitShadows.modal, boxShadow: ConduitShadows.modal,
), ),
child: ModalSheetSafeArea( child: ModalSheetSafeArea(
padding: const EdgeInsets.fromLTRB(
Spacing.md,
Spacing.xs,
Spacing.md,
Spacing.md,
),
child: SingleChildScrollView( child: SingleChildScrollView(
controller: scrollController, controller: scrollController,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@@ -1300,7 +1305,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
Widget _buildSectionLabel(String text) { Widget _buildSectionLabel(String text) {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: Spacing.xs), padding: const EdgeInsets.only(bottom: Spacing.xxs),
child: Text( child: Text(
text, text,
style: AppTypography.labelStyle.copyWith( style: AppTypography.labelStyle.copyWith(
@@ -1352,7 +1357,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
duration: const Duration(milliseconds: 180), duration: const Duration(milliseconds: 180),
curve: Curves.easeOutCubic, curve: Curves.easeOutCubic,
margin: const EdgeInsets.symmetric(vertical: Spacing.xxs), margin: const EdgeInsets.symmetric(vertical: Spacing.xxs),
padding: const EdgeInsets.all(Spacing.md), padding: const EdgeInsets.all(Spacing.sm),
decoration: BoxDecoration( decoration: BoxDecoration(
color: background, color: background,
borderRadius: BorderRadius.circular(AppBorderRadius.input), borderRadius: BorderRadius.circular(AppBorderRadius.input),
@@ -1363,7 +1368,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
_buildToolGlyph(icon: icon, selected: value, theme: theme), _buildToolGlyph(icon: icon, selected: value, theme: theme),
const SizedBox(width: Spacing.sm), const SizedBox(width: Spacing.xs),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -1393,7 +1398,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
], ],
), ),
), ),
const SizedBox(width: Spacing.sm), const SizedBox(width: Spacing.xs),
_buildTogglePill(isOn: value, theme: theme), _buildTogglePill(isOn: value, theme: theme),
], ],
), ),
@@ -1439,7 +1444,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
duration: const Duration(milliseconds: 180), duration: const Duration(milliseconds: 180),
curve: Curves.easeOutCubic, curve: Curves.easeOutCubic,
margin: const EdgeInsets.symmetric(vertical: Spacing.xxs), margin: const EdgeInsets.symmetric(vertical: Spacing.xxs),
padding: const EdgeInsets.all(Spacing.md), padding: const EdgeInsets.all(Spacing.sm),
decoration: BoxDecoration( decoration: BoxDecoration(
color: background, color: background,
borderRadius: BorderRadius.circular(AppBorderRadius.input), borderRadius: BorderRadius.circular(AppBorderRadius.input),
@@ -1454,7 +1459,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
selected: selected, selected: selected,
theme: theme, theme: theme,
), ),
const SizedBox(width: Spacing.sm), const SizedBox(width: Spacing.xs),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -1486,7 +1491,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
], ],
), ),
), ),
const SizedBox(width: Spacing.sm), const SizedBox(width: Spacing.xs),
_buildTogglePill(isOn: selected, theme: theme), _buildTogglePill(isOn: selected, theme: theme),
], ],
), ),
@@ -1512,8 +1517,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
: theme.iconPrimary.withValues(alpha: Alpha.strong); : theme.iconPrimary.withValues(alpha: Alpha.strong);
return Container( return Container(
width: 44, width: 36,
height: 44, height: 36,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
gradient: LinearGradient( gradient: LinearGradient(
@@ -1701,8 +1706,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
duration: const Duration(milliseconds: 180), duration: const Duration(milliseconds: 180),
curve: Curves.easeOutCubic, curve: Curves.easeOutCubic,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: Spacing.sm, horizontal: Spacing.xs,
vertical: Spacing.md, vertical: Spacing.sm,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(AppBorderRadius.card), borderRadius: BorderRadius.circular(AppBorderRadius.card),
@@ -1713,8 +1718,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
width: 44, width: 36,
height: 44, height: 36,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
gradient: LinearGradient( gradient: LinearGradient(
@@ -1730,11 +1735,11 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
), ),
child: Icon(icon, color: iconColor, size: IconSize.modal), child: Icon(icon, color: iconColor, size: IconSize.modal),
), ),
const SizedBox(height: Spacing.sm), const SizedBox(height: Spacing.xs),
Text( Text(
label, label,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppTypography.bodySmallStyle.copyWith( style: AppTypography.captionStyle.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: textColor, color: textColor,
), ),