💄 Updating compose toolbar styling
This commit is contained in:
@@ -72,18 +72,17 @@ class ComposeToolbar extends HookConsumerWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
builder:
|
builder: (context) => DraftManagerSheet(
|
||||||
(context) => DraftManagerSheet(
|
onDraftSelected: (draftId) {
|
||||||
onDraftSelected: (draftId) {
|
final draft = ref.read(composeStorageProvider)[draftId];
|
||||||
final draft = ref.read(composeStorageProvider)[draftId];
|
if (draft != null) {
|
||||||
if (draft != null) {
|
state.titleController.text = draft.title ?? '';
|
||||||
state.titleController.text = draft.title ?? '';
|
state.descriptionController.text = draft.description ?? '';
|
||||||
state.descriptionController.text = draft.description ?? '';
|
state.contentController.text = draft.content ?? '';
|
||||||
state.contentController.text = draft.content ?? '';
|
state.visibility.value = draft.visibility;
|
||||||
state.visibility.value = draft.visibility;
|
}
|
||||||
}
|
},
|
||||||
},
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,144 +96,154 @@ class ComposeToolbar extends HookConsumerWidget {
|
|||||||
final colorScheme = Theme.of(context).colorScheme;
|
final colorScheme = Theme.of(context).colorScheme;
|
||||||
|
|
||||||
if (isCompact) {
|
if (isCompact) {
|
||||||
return Container(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
elevation: 8,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 560),
|
constraints: const BoxConstraints(maxWidth: 560),
|
||||||
child: Row(
|
child:
|
||||||
children: [
|
Row(
|
||||||
Expanded(
|
children: [
|
||||||
child: SingleChildScrollView(
|
Expanded(
|
||||||
scrollDirection: Axis.horizontal,
|
child: SingleChildScrollView(
|
||||||
child: Row(
|
scrollDirection: Axis.horizontal,
|
||||||
children: [
|
child: Row(
|
||||||
UploadMenu(
|
children: [
|
||||||
items: uploadMenuItems,
|
UploadMenu(
|
||||||
isCompact: isCompact,
|
items: uploadMenuItems,
|
||||||
),
|
isCompact: isCompact,
|
||||||
IconButton(
|
),
|
||||||
onPressed: linkAttachment,
|
IconButton(
|
||||||
icon: const Icon(Symbols.attach_file),
|
onPressed: linkAttachment,
|
||||||
tooltip: 'linkAttachment'.tr(),
|
icon: const Icon(Symbols.attach_file),
|
||||||
color: colorScheme.primary,
|
tooltip: 'linkAttachment'.tr(),
|
||||||
visualDensity: const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Poll button with visual state when a poll is linked
|
|
||||||
ListenableBuilder(
|
|
||||||
listenable: state.pollId,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: pickPoll,
|
|
||||||
icon: const Icon(Symbols.how_to_vote),
|
|
||||||
tooltip: 'poll'.tr(),
|
|
||||||
color: colorScheme.primary,
|
color: colorScheme.primary,
|
||||||
visualDensity: const VisualDensity(
|
visualDensity: const VisualDensity(
|
||||||
horizontal: -4,
|
horizontal: -4,
|
||||||
vertical: -2,
|
vertical: -2,
|
||||||
),
|
),
|
||||||
style: ButtonStyle(
|
),
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
// Poll button with visual state when a poll is linked
|
||||||
state.pollId.value != null
|
ListenableBuilder(
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
listenable: state.pollId,
|
||||||
: null,
|
builder: (context, _) {
|
||||||
),
|
return IconButton(
|
||||||
),
|
onPressed: pickPoll,
|
||||||
);
|
icon: const Icon(Symbols.how_to_vote),
|
||||||
},
|
tooltip: 'poll'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
|
horizontal: -4,
|
||||||
|
vertical: -2,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.pollId.value != null
|
||||||
|
? colorScheme.primary.withOpacity(
|
||||||
|
0.15,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Fund button with visual state when a fund is linked
|
||||||
|
ListenableBuilder(
|
||||||
|
listenable: state.fundId,
|
||||||
|
builder: (context, _) {
|
||||||
|
return IconButton(
|
||||||
|
onPressed: pickFund,
|
||||||
|
icon: const Icon(
|
||||||
|
Symbols.account_balance_wallet,
|
||||||
|
),
|
||||||
|
tooltip: 'fund'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
|
horizontal: -4,
|
||||||
|
vertical: -2,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.fundId.value != null
|
||||||
|
? colorScheme.primary.withOpacity(
|
||||||
|
0.15,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Embed button with visual state when embed is present
|
||||||
|
ListenableBuilder(
|
||||||
|
listenable: state.embedView,
|
||||||
|
builder: (context, _) {
|
||||||
|
return IconButton(
|
||||||
|
onPressed: showEmbedSheet,
|
||||||
|
icon: const Icon(Symbols.iframe),
|
||||||
|
tooltip: 'embedView'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
|
horizontal: -4,
|
||||||
|
vertical: -2,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.embedView.value != null
|
||||||
|
? colorScheme.primary.withOpacity(
|
||||||
|
0.15,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
// Fund button with visual state when a fund is linked
|
),
|
||||||
ListenableBuilder(
|
|
||||||
listenable: state.fundId,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: pickFund,
|
|
||||||
icon: const Icon(Symbols.account_balance_wallet),
|
|
||||||
tooltip: 'fund'.tr(),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
visualDensity: const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -2,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
|
||||||
state.fundId.value != null
|
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// Embed button with visual state when embed is present
|
|
||||||
ListenableBuilder(
|
|
||||||
listenable: state.embedView,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: showEmbedSheet,
|
|
||||||
icon: const Icon(Symbols.iframe),
|
|
||||||
tooltip: 'embedView'.tr(),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
visualDensity: const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -2,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
|
||||||
state.embedView.value != null
|
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
if (originalPost == null && state.isEmpty)
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Symbols.draft, size: 20),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
onPressed: showDraftManager,
|
||||||
|
tooltip: 'drafts'.tr(),
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
|
horizontal: -4,
|
||||||
|
vertical: -4,
|
||||||
|
),
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
minWidth: 32,
|
||||||
|
minHeight: 48,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (originalPost == null)
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Symbols.save, size: 20),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
onPressed: saveDraft,
|
||||||
|
onLongPress: showDraftManager,
|
||||||
|
tooltip: 'saveDraft'.tr(),
|
||||||
|
visualDensity: const VisualDensity(
|
||||||
|
horizontal: -4,
|
||||||
|
vertical: -4,
|
||||||
|
),
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
minWidth: 32,
|
||||||
|
minHeight: 48,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(
|
||||||
|
horizontal: 16,
|
||||||
|
top: 4,
|
||||||
|
bottom: useSafeArea
|
||||||
|
? MediaQuery.of(context).padding.bottom + 4
|
||||||
|
: 4,
|
||||||
),
|
),
|
||||||
if (originalPost == null && state.isEmpty)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.draft, size: 20),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
onPressed: showDraftManager,
|
|
||||||
tooltip: 'drafts'.tr(),
|
|
||||||
visualDensity: const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -4,
|
|
||||||
),
|
|
||||||
constraints: const BoxConstraints(
|
|
||||||
minWidth: 32,
|
|
||||||
minHeight: 48,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else if (originalPost == null)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.save, size: 20),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
onPressed: saveDraft,
|
|
||||||
onLongPress: showDraftManager,
|
|
||||||
tooltip: 'saveDraft'.tr(),
|
|
||||||
visualDensity: const VisualDensity(
|
|
||||||
horizontal: -4,
|
|
||||||
vertical: -4,
|
|
||||||
),
|
|
||||||
constraints: const BoxConstraints(
|
|
||||||
minWidth: 32,
|
|
||||||
minHeight: 48,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(
|
|
||||||
horizontal: 8,
|
|
||||||
top: 4,
|
|
||||||
bottom:
|
|
||||||
useSafeArea ? MediaQuery.of(context).padding.bottom + 4 : 4,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -246,102 +255,108 @@ class ComposeToolbar extends HookConsumerWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 560),
|
constraints: const BoxConstraints(maxWidth: 560),
|
||||||
child: Row(
|
child:
|
||||||
children: [
|
Row(
|
||||||
Expanded(
|
children: [
|
||||||
child: SingleChildScrollView(
|
Expanded(
|
||||||
scrollDirection: Axis.horizontal,
|
child: SingleChildScrollView(
|
||||||
child: Row(
|
scrollDirection: Axis.horizontal,
|
||||||
children: [
|
child: Row(
|
||||||
UploadMenu(items: uploadMenuItems, isCompact: isCompact),
|
children: [
|
||||||
IconButton(
|
UploadMenu(
|
||||||
onPressed: linkAttachment,
|
items: uploadMenuItems,
|
||||||
icon: const Icon(Symbols.attach_file),
|
isCompact: isCompact,
|
||||||
tooltip: 'linkAttachment'.tr(),
|
),
|
||||||
color: colorScheme.primary,
|
IconButton(
|
||||||
),
|
onPressed: linkAttachment,
|
||||||
// Poll button with visual state when a poll is linked
|
icon: const Icon(Symbols.attach_file),
|
||||||
ListenableBuilder(
|
tooltip: 'linkAttachment'.tr(),
|
||||||
listenable: state.pollId,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: pickPoll,
|
|
||||||
icon: const Icon(Symbols.how_to_vote),
|
|
||||||
tooltip: 'poll'.tr(),
|
|
||||||
color: colorScheme.primary,
|
color: colorScheme.primary,
|
||||||
style: ButtonStyle(
|
),
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
// Poll button with visual state when a poll is linked
|
||||||
state.pollId.value != null
|
ListenableBuilder(
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
listenable: state.pollId,
|
||||||
: null,
|
builder: (context, _) {
|
||||||
),
|
return IconButton(
|
||||||
),
|
onPressed: pickPoll,
|
||||||
);
|
icon: const Icon(Symbols.how_to_vote),
|
||||||
},
|
tooltip: 'poll'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.pollId.value != null
|
||||||
|
? colorScheme.primary.withOpacity(0.15)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Fund button with visual state when a fund is linked
|
||||||
|
ListenableBuilder(
|
||||||
|
listenable: state.fundId,
|
||||||
|
builder: (context, _) {
|
||||||
|
return IconButton(
|
||||||
|
onPressed: pickFund,
|
||||||
|
icon: const Icon(
|
||||||
|
Symbols.account_balance_wallet,
|
||||||
|
),
|
||||||
|
tooltip: 'fund'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.fundId.value != null
|
||||||
|
? colorScheme.primary.withOpacity(0.15)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// Embed button with visual state when embed is present
|
||||||
|
ListenableBuilder(
|
||||||
|
listenable: state.embedView,
|
||||||
|
builder: (context, _) {
|
||||||
|
return IconButton(
|
||||||
|
onPressed: showEmbedSheet,
|
||||||
|
icon: const Icon(Symbols.iframe),
|
||||||
|
tooltip: 'embedView'.tr(),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStatePropertyAll(
|
||||||
|
state.embedView.value != null
|
||||||
|
? colorScheme.primary.withOpacity(0.15)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
// Fund button with visual state when a fund is linked
|
),
|
||||||
ListenableBuilder(
|
|
||||||
listenable: state.fundId,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: pickFund,
|
|
||||||
icon: const Icon(Symbols.account_balance_wallet),
|
|
||||||
tooltip: 'fund'.tr(),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
|
||||||
state.fundId.value != null
|
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// Embed button with visual state when embed is present
|
|
||||||
ListenableBuilder(
|
|
||||||
listenable: state.embedView,
|
|
||||||
builder: (context, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: showEmbedSheet,
|
|
||||||
icon: const Icon(Symbols.iframe),
|
|
||||||
tooltip: 'embedView'.tr(),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStatePropertyAll(
|
|
||||||
state.embedView.value != null
|
|
||||||
? colorScheme.primary.withOpacity(0.15)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
if (originalPost == null && state.isEmpty)
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Symbols.draft),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
onPressed: showDraftManager,
|
||||||
|
tooltip: 'drafts'.tr(),
|
||||||
|
)
|
||||||
|
else if (originalPost == null)
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Symbols.save),
|
||||||
|
color: colorScheme.primary,
|
||||||
|
onPressed: saveDraft,
|
||||||
|
onLongPress: showDraftManager,
|
||||||
|
tooltip: 'saveDraft'.tr(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).padding(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 16,
|
||||||
|
horizontal: 16,
|
||||||
|
top: 8,
|
||||||
),
|
),
|
||||||
if (originalPost == null && state.isEmpty)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.draft),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
onPressed: showDraftManager,
|
|
||||||
tooltip: 'drafts'.tr(),
|
|
||||||
)
|
|
||||||
else if (originalPost == null)
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Symbols.save),
|
|
||||||
color: colorScheme.primary,
|
|
||||||
onPressed: saveDraft,
|
|
||||||
onLongPress: showDraftManager,
|
|
||||||
tooltip: 'saveDraft'.tr(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(
|
|
||||||
bottom: MediaQuery.of(context).padding.bottom + 16,
|
|
||||||
horizontal: 16,
|
|
||||||
top: 8,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user