refactor: simplify chat input and drawer layout
This commit is contained in:
@@ -217,9 +217,6 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
// Main input area with unified 2-row design
|
// Main input area with unified 2-row design
|
||||||
Container(
|
Container(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
padding: EdgeInsets.only(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: context.conduitTheme.inputBackground,
|
color: context.conduitTheme.inputBackground,
|
||||||
borderRadius: const BorderRadius.vertical(
|
borderRadius: const BorderRadius.vertical(
|
||||||
@@ -243,135 +240,30 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
boxShadow: ConduitShadows.input,
|
boxShadow: ConduitShadows.input,
|
||||||
),
|
),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ConstrainedBox(
|
child: SafeArea(
|
||||||
constraints: BoxConstraints(
|
top: false,
|
||||||
// cap the input area to 40% of screen height to avoid bottom overflow
|
child: ConstrainedBox(
|
||||||
maxHeight: MediaQuery.of(context).size.height * 0.4,
|
constraints: BoxConstraints(
|
||||||
),
|
// cap the input area to 40% of screen height to avoid bottom overflow
|
||||||
child: AnimatedSize(
|
maxHeight: MediaQuery.of(context).size.height * 0.4,
|
||||||
duration:
|
),
|
||||||
AnimationDuration.fast, // Faster for better responsiveness
|
child: AnimatedSize(
|
||||||
curve: Curves.fastOutSlowIn, // More efficient curve
|
duration: AnimationDuration
|
||||||
alignment: Alignment.topCenter,
|
.fast, // Faster for better responsiveness
|
||||||
child: SingleChildScrollView(
|
curve: Curves.fastOutSlowIn, // More efficient curve
|
||||||
physics: const ClampingScrollPhysics(),
|
alignment: Alignment.topCenter,
|
||||||
child: Column(
|
child: SingleChildScrollView(
|
||||||
mainAxisSize: MainAxisSize.min,
|
physics: const ClampingScrollPhysics(),
|
||||||
children: [
|
child: Column(
|
||||||
// Collapsed/Expanded top row: text input with left/right buttons in collapsed
|
mainAxisSize: MainAxisSize.min,
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(Spacing.inputPadding),
|
// Collapsed/Expanded top row: text input with left/right buttons in collapsed
|
||||||
child: Row(
|
Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
padding: const EdgeInsets.all(Spacing.inputPadding),
|
||||||
children: [
|
child: Row(
|
||||||
if (!_isExpanded) ...[
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
_buildRoundButton(
|
children: [
|
||||||
icon: Icons.add,
|
if (!_isExpanded) ...[
|
||||||
onTap: widget.enabled
|
|
||||||
? _showAttachmentOptions
|
|
||||||
: null,
|
|
||||||
tooltip: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.addAttachment,
|
|
||||||
),
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
],
|
|
||||||
// Text input expands to fill
|
|
||||||
Expanded(
|
|
||||||
child: Semantics(
|
|
||||||
textField: true,
|
|
||||||
label: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.messageInputLabel,
|
|
||||||
hint: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.messageInputHint,
|
|
||||||
child: TextField(
|
|
||||||
controller: _controller,
|
|
||||||
focusNode: _focusNode,
|
|
||||||
enabled: widget.enabled,
|
|
||||||
autofocus: false,
|
|
||||||
maxLines: _isExpanded ? null : 1,
|
|
||||||
keyboardType: TextInputType.multiline,
|
|
||||||
textCapitalization:
|
|
||||||
TextCapitalization.sentences,
|
|
||||||
textInputAction: TextInputAction.newline,
|
|
||||||
showCursor: true,
|
|
||||||
cursorColor: context.conduitTheme.inputText,
|
|
||||||
style: AppTypography.chatMessageStyle
|
|
||||||
.copyWith(
|
|
||||||
color: context.conduitTheme.inputText,
|
|
||||||
),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.messageHintText,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color:
|
|
||||||
context.conduitTheme.inputPlaceholder,
|
|
||||||
fontSize: AppTypography.bodyLarge,
|
|
||||||
fontWeight: _isRecording
|
|
||||||
? FontWeight.w500
|
|
||||||
: FontWeight.w400,
|
|
||||||
fontStyle: _isRecording
|
|
||||||
? FontStyle.italic
|
|
||||||
: FontStyle.normal,
|
|
||||||
),
|
|
||||||
// Ensure the text field background matches its parent container
|
|
||||||
// and does not use the global InputDecorationTheme fill
|
|
||||||
filled: false,
|
|
||||||
border: InputBorder.none,
|
|
||||||
enabledBorder: InputBorder.none,
|
|
||||||
focusedBorder: InputBorder.none,
|
|
||||||
errorBorder: InputBorder.none,
|
|
||||||
disabledBorder: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
isDense: true,
|
|
||||||
alignLabelWithHint: true,
|
|
||||||
),
|
|
||||||
// Removed onChanged setState to reduce rebuilds
|
|
||||||
onSubmitted: (_) => _sendMessage(),
|
|
||||||
onTap: () {
|
|
||||||
if (!widget.enabled) return;
|
|
||||||
if (!_isExpanded) {
|
|
||||||
_setExpanded(true);
|
|
||||||
WidgetsBinding.instance
|
|
||||||
.addPostFrameCallback((_) {
|
|
||||||
if (!mounted) return;
|
|
||||||
_ensureFocusedIfEnabled();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
_ensureFocusedIfEnabled();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (!_isExpanded) ...[
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
// Primary action button (Send/Stop) when collapsed
|
|
||||||
_buildPrimaryButton(
|
|
||||||
_hasText,
|
|
||||||
isGenerating,
|
|
||||||
stopGeneration,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Expanded bottom row with additional options
|
|
||||||
if (_isExpanded) ...[
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: Spacing.inputPadding,
|
|
||||||
right: Spacing.inputPadding,
|
|
||||||
bottom: Spacing.inputPadding,
|
|
||||||
),
|
|
||||||
child: FadeTransition(
|
|
||||||
opacity: _expandController,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
_buildRoundButton(
|
_buildRoundButton(
|
||||||
icon: Icons.add,
|
icon: Icons.add,
|
||||||
onTap: widget.enabled
|
onTap: widget.enabled
|
||||||
@@ -382,103 +274,214 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
|
|||||||
)!.addAttachment,
|
)!.addAttachment,
|
||||||
),
|
),
|
||||||
const SizedBox(width: Spacing.sm),
|
const SizedBox(width: Spacing.sm),
|
||||||
// Quick pills: no scroll, clip text within fixed max width
|
],
|
||||||
Expanded(
|
// Text input expands to fill
|
||||||
child: Row(
|
Expanded(
|
||||||
children: [
|
child: Semantics(
|
||||||
Flexible(
|
textField: true,
|
||||||
fit: FlexFit.loose,
|
label: AppLocalizations.of(
|
||||||
child: _buildPillButton(
|
context,
|
||||||
icon: Platform.isIOS
|
)!.messageInputLabel,
|
||||||
? CupertinoIcons.search
|
hint: AppLocalizations.of(
|
||||||
: Icons.search,
|
context,
|
||||||
label: AppLocalizations.of(
|
)!.messageInputHint,
|
||||||
context,
|
child: TextField(
|
||||||
)!.web,
|
controller: _controller,
|
||||||
isActive: webSearchEnabled,
|
focusNode: _focusNode,
|
||||||
onTap: widget.enabled
|
enabled: widget.enabled,
|
||||||
? () {
|
autofocus: false,
|
||||||
ref
|
maxLines: _isExpanded ? null : 1,
|
||||||
.read(
|
keyboardType: TextInputType.multiline,
|
||||||
webSearchEnabledProvider
|
textCapitalization:
|
||||||
.notifier,
|
TextCapitalization.sentences,
|
||||||
)
|
textInputAction: TextInputAction.newline,
|
||||||
.state =
|
showCursor: true,
|
||||||
!webSearchEnabled;
|
cursorColor: context.conduitTheme.inputText,
|
||||||
}
|
style: AppTypography.chatMessageStyle
|
||||||
: null,
|
.copyWith(
|
||||||
|
color: context.conduitTheme.inputText,
|
||||||
),
|
),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.messageHintText,
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
color: context
|
||||||
|
.conduitTheme
|
||||||
|
.inputPlaceholder,
|
||||||
|
fontSize: AppTypography.bodyLarge,
|
||||||
|
fontWeight: _isRecording
|
||||||
|
? FontWeight.w500
|
||||||
|
: FontWeight.w400,
|
||||||
|
fontStyle: _isRecording
|
||||||
|
? FontStyle.italic
|
||||||
|
: FontStyle.normal,
|
||||||
),
|
),
|
||||||
if (imageGenAvailable) ...[
|
// Ensure the text field background matches its parent container
|
||||||
const SizedBox(width: Spacing.sm),
|
// and does not use the global InputDecorationTheme fill
|
||||||
Flexible(
|
filled: false,
|
||||||
fit: FlexFit.loose,
|
border: InputBorder.none,
|
||||||
child: _buildPillButton(
|
enabledBorder: InputBorder.none,
|
||||||
icon: Platform.isIOS
|
focusedBorder: InputBorder.none,
|
||||||
? CupertinoIcons.photo
|
errorBorder: InputBorder.none,
|
||||||
: Icons.image,
|
disabledBorder: InputBorder.none,
|
||||||
label: AppLocalizations.of(
|
contentPadding: EdgeInsets.zero,
|
||||||
context,
|
isDense: true,
|
||||||
)!.imageGen,
|
alignLabelWithHint: true,
|
||||||
isActive: imageGenEnabled,
|
),
|
||||||
onTap: widget.enabled
|
// Removed onChanged setState to reduce rebuilds
|
||||||
? () {
|
onSubmitted: (_) => _sendMessage(),
|
||||||
ref
|
onTap: () {
|
||||||
.read(
|
if (!widget.enabled) return;
|
||||||
imageGenerationEnabledProvider
|
if (!_isExpanded) {
|
||||||
.notifier,
|
_setExpanded(true);
|
||||||
)
|
WidgetsBinding.instance
|
||||||
.state =
|
.addPostFrameCallback((_) {
|
||||||
!imageGenEnabled;
|
if (!mounted) return;
|
||||||
}
|
_ensureFocusedIfEnabled();
|
||||||
: null,
|
});
|
||||||
),
|
} else {
|
||||||
),
|
_ensureFocusedIfEnabled();
|
||||||
],
|
}
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
if (!_isExpanded) ...[
|
||||||
const SizedBox(width: Spacing.sm),
|
const SizedBox(width: Spacing.sm),
|
||||||
_buildRoundButton(
|
// Primary action button (Send/Stop) when collapsed
|
||||||
icon: Icons.more_horiz,
|
|
||||||
onTap: widget.enabled
|
|
||||||
? _showUnifiedToolsModal
|
|
||||||
: null,
|
|
||||||
tooltip: AppLocalizations.of(context)!.tools,
|
|
||||||
isActive:
|
|
||||||
ref
|
|
||||||
.watch(selectedToolIdsProvider)
|
|
||||||
.isNotEmpty ||
|
|
||||||
webSearchEnabled ||
|
|
||||||
imageGenEnabled,
|
|
||||||
),
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
// Microphone button: call provided callback for premium voice UI
|
|
||||||
_buildRoundButton(
|
|
||||||
icon: Platform.isIOS
|
|
||||||
? CupertinoIcons.mic_fill
|
|
||||||
: Icons.mic,
|
|
||||||
onTap: widget.enabled
|
|
||||||
? widget.onVoiceInput
|
|
||||||
: null,
|
|
||||||
tooltip: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
)!.voiceInput,
|
|
||||||
isActive: _isRecording,
|
|
||||||
),
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
// Primary action button (Send/Stop) when expanded
|
|
||||||
_buildPrimaryButton(
|
_buildPrimaryButton(
|
||||||
_hasText,
|
_hasText,
|
||||||
isGenerating,
|
isGenerating,
|
||||||
stopGeneration,
|
stopGeneration,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Expanded bottom row with additional options
|
||||||
|
if (_isExpanded) ...[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: Spacing.inputPadding,
|
||||||
|
right: Spacing.inputPadding,
|
||||||
|
bottom: Spacing.inputPadding,
|
||||||
|
),
|
||||||
|
child: FadeTransition(
|
||||||
|
opacity: _expandController,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
_buildRoundButton(
|
||||||
|
icon: Icons.add,
|
||||||
|
onTap: widget.enabled
|
||||||
|
? _showAttachmentOptions
|
||||||
|
: null,
|
||||||
|
tooltip: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.addAttachment,
|
||||||
|
),
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
// Quick pills: no scroll, clip text within fixed max width
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
fit: FlexFit.loose,
|
||||||
|
child: _buildPillButton(
|
||||||
|
icon: Platform.isIOS
|
||||||
|
? CupertinoIcons.search
|
||||||
|
: Icons.search,
|
||||||
|
label: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.web,
|
||||||
|
isActive: webSearchEnabled,
|
||||||
|
onTap: widget.enabled
|
||||||
|
? () {
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
webSearchEnabledProvider
|
||||||
|
.notifier,
|
||||||
|
)
|
||||||
|
.state =
|
||||||
|
!webSearchEnabled;
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (imageGenAvailable) ...[
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
Flexible(
|
||||||
|
fit: FlexFit.loose,
|
||||||
|
child: _buildPillButton(
|
||||||
|
icon: Platform.isIOS
|
||||||
|
? CupertinoIcons.photo
|
||||||
|
: Icons.image,
|
||||||
|
label: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.imageGen,
|
||||||
|
isActive: imageGenEnabled,
|
||||||
|
onTap: widget.enabled
|
||||||
|
? () {
|
||||||
|
ref
|
||||||
|
.read(
|
||||||
|
imageGenerationEnabledProvider
|
||||||
|
.notifier,
|
||||||
|
)
|
||||||
|
.state =
|
||||||
|
!imageGenEnabled;
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
_buildRoundButton(
|
||||||
|
icon: Icons.more_horiz,
|
||||||
|
onTap: widget.enabled
|
||||||
|
? _showUnifiedToolsModal
|
||||||
|
: null,
|
||||||
|
tooltip: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.tools,
|
||||||
|
isActive:
|
||||||
|
ref
|
||||||
|
.watch(selectedToolIdsProvider)
|
||||||
|
.isNotEmpty ||
|
||||||
|
webSearchEnabled ||
|
||||||
|
imageGenEnabled,
|
||||||
|
),
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
// Microphone button: call provided callback for premium voice UI
|
||||||
|
_buildRoundButton(
|
||||||
|
icon: Platform.isIOS
|
||||||
|
? CupertinoIcons.mic_fill
|
||||||
|
: Icons.mic,
|
||||||
|
onTap: widget.enabled
|
||||||
|
? widget.onVoiceInput
|
||||||
|
: null,
|
||||||
|
tooltip: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.voiceInput,
|
||||||
|
isActive: _isRecording,
|
||||||
|
),
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
// Primary action button (Send/Stop) when expanded
|
||||||
|
_buildPrimaryButton(
|
||||||
|
_hasText,
|
||||||
|
isGenerating,
|
||||||
|
stopGeneration,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -65,42 +65,40 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
// Bottom section now only shows navigation actions
|
// Bottom section now only shows navigation actions
|
||||||
final theme = context.conduitTheme;
|
final theme = context.conduitTheme;
|
||||||
|
|
||||||
return SafeArea(
|
return Container(
|
||||||
child: Container(
|
color: theme.surfaceBackground,
|
||||||
color: theme.surfaceBackground,
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
children: [
|
||||||
children: [
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.symmetric(
|
||||||
padding: const EdgeInsets.symmetric(
|
horizontal: Spacing.md,
|
||||||
horizontal: Spacing.md,
|
vertical: Spacing.sm,
|
||||||
vertical: Spacing.sm,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(child: _buildSearchField(context)),
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Platform.isIOS
|
|
||||||
? CupertinoIcons.bubble_left
|
|
||||||
: Icons.add_comment,
|
|
||||||
color: theme.iconPrimary,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
chat.startNewChat(ref);
|
|
||||||
if (mounted) Navigator.of(context).maybePop();
|
|
||||||
},
|
|
||||||
tooltip: AppLocalizations.of(context)!.newChat,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Expanded(child: _buildConversationList(context)),
|
child: Row(
|
||||||
const Divider(height: 1),
|
children: [
|
||||||
_buildBottomSection(context),
|
Expanded(child: _buildSearchField(context)),
|
||||||
],
|
const SizedBox(width: Spacing.sm),
|
||||||
),
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Platform.isIOS
|
||||||
|
? CupertinoIcons.bubble_left
|
||||||
|
: Icons.add_comment,
|
||||||
|
color: theme.iconPrimary,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
chat.startNewChat(ref);
|
||||||
|
if (mounted) Navigator.of(context).maybePop();
|
||||||
|
},
|
||||||
|
tooltip: AppLocalizations.of(context)!.newChat,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(child: _buildConversationList(context)),
|
||||||
|
const Divider(height: 1),
|
||||||
|
_buildBottomSection(context),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1118,91 +1116,81 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
|||||||
Widget _buildBottomSection(BuildContext context) {
|
Widget _buildBottomSection(BuildContext context) {
|
||||||
final theme = context.conduitTheme;
|
final theme = context.conduitTheme;
|
||||||
final user = ref.watch(authUserProvider);
|
final user = ref.watch(authUserProvider);
|
||||||
return SafeArea(
|
return Padding(
|
||||||
top: false,
|
padding: const EdgeInsets.fromLTRB(Spacing.sm, 0, Spacing.sm, Spacing.sm),
|
||||||
child: Padding(
|
child: Column(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
mainAxisSize: MainAxisSize.min,
|
||||||
Spacing.sm,
|
children: [
|
||||||
0,
|
if (user != null) ...[
|
||||||
Spacing.sm,
|
const SizedBox(height: Spacing.sm),
|
||||||
Spacing.sm,
|
Container(
|
||||||
),
|
padding: const EdgeInsets.all(Spacing.sm),
|
||||||
child: Column(
|
decoration: BoxDecoration(
|
||||||
mainAxisSize: MainAxisSize.min,
|
color: theme.surfaceBackground.withValues(alpha: 0.04),
|
||||||
children: [
|
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
||||||
if (user != null) ...[
|
border: Border.all(
|
||||||
const SizedBox(height: Spacing.sm),
|
color: theme.dividerColor,
|
||||||
Container(
|
width: BorderWidth.regular,
|
||||||
padding: const EdgeInsets.all(Spacing.sm),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: theme.surfaceBackground.withValues(alpha: 0.04),
|
|
||||||
borderRadius: BorderRadius.circular(AppBorderRadius.md),
|
|
||||||
border: Border.all(
|
|
||||||
color: theme.dividerColor,
|
|
||||||
width: BorderWidth.regular,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: IconSize.avatar,
|
|
||||||
height: IconSize.avatar,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: theme.buttonPrimary.withValues(alpha: 0.15),
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
AppBorderRadius.avatar,
|
|
||||||
),
|
|
||||||
border: Border.all(
|
|
||||||
color: theme.buttonPrimary.withValues(alpha: 0.35),
|
|
||||||
width: BorderWidth.thin,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Text(
|
|
||||||
(user.name ?? user.username ?? 'U')
|
|
||||||
.toString()
|
|
||||||
.substring(0, 1)
|
|
||||||
.toUpperCase(),
|
|
||||||
style: AppTypography.bodyLargeStyle.copyWith(
|
|
||||||
color: theme.buttonPrimary,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: Spacing.sm),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
(user.name ?? user.username ?? 'User').toString(),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: AppTypography.bodyLargeStyle.copyWith(
|
|
||||||
color: theme.textPrimary,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).maybePop();
|
|
||||||
Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => const ProfilePage(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text(AppLocalizations.of(context)!.manage),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: IconSize.avatar,
|
||||||
|
height: IconSize.avatar,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: theme.buttonPrimary.withValues(alpha: 0.15),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
AppBorderRadius.avatar,
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color: theme.buttonPrimary.withValues(alpha: 0.35),
|
||||||
|
width: BorderWidth.thin,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
(user.name ?? user.username ?? 'U')
|
||||||
|
.toString()
|
||||||
|
.substring(0, 1)
|
||||||
|
.toUpperCase(),
|
||||||
|
style: AppTypography.bodyLargeStyle.copyWith(
|
||||||
|
color: theme.buttonPrimary,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: Spacing.sm),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
(user.name ?? user.username ?? 'User').toString(),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: AppTypography.bodyLargeStyle.copyWith(
|
||||||
|
color: theme.textPrimary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).maybePop();
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(builder: (_) => const ProfilePage()),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.manage),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user