chore: polish upload image menu (#5928)

* chore: polish upload image menu

* fix: text align issue

---------

Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
Annie 2024-08-12 13:52:53 +08:00 committed by GitHub
parent f7adcae8ff
commit 2bc7875bdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 26 deletions

View File

@ -150,9 +150,16 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
final type = values[currentTabIndex]; final type = values[currentTabIndex];
switch (type) { switch (type) {
case UploadImageType.local: case UploadImageType.local:
return Container( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Container(
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Theme.of(context).colorScheme.outline,
),
),
constraints: constraints, constraints: constraints,
child: Column( child: Column(
children: [ children: [
@ -170,6 +177,7 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
], ],
], ],
), ),
),
); );
case UploadImageType.url: case UploadImageType.url:
return Container( return Container(

View File

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/shared/patterns/common_patterns.dart'; import 'package:appflowy/shared/patterns/common_patterns.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
class EmbedImageUrlWidget extends StatefulWidget { class EmbedImageUrlWidget extends StatefulWidget {
const EmbedImageUrlWidget({ const EmbedImageUrlWidget({
@ -25,31 +24,38 @@ class _EmbedImageUrlWidgetState extends State<EmbedImageUrlWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
const VSpace(12),
FlowyTextField( FlowyTextField(
hintText: LocaleKeys.document_imageBlock_embedLink_placeholder.tr(), hintText: LocaleKeys.document_imageBlock_embedLink_placeholder.tr(),
onChanged: (value) => inputText = value, onChanged: (value) => inputText = value,
onEditingComplete: submit, onEditingComplete: submit,
), ),
if (!isUrlValid) ...[ if (!isUrlValid) ...[
const VSpace(8), const VSpace(12),
FlowyText( FlowyText(
LocaleKeys.document_plugins_cover_invalidImageUrl.tr(), LocaleKeys.document_plugins_cover_invalidImageUrl.tr(),
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
), ),
], ],
const VSpace(8), const VSpace(20),
SizedBox( SizedBox(
width: 160, height: 32,
width: 300,
child: FlowyButton( child: FlowyButton(
backgroundColor: Theme.of(context).colorScheme.primary,
hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9),
showDefaultBoxDecorationOnMobile: true, showDefaultBoxDecorationOnMobile: true,
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(5),
text: FlowyText( text: FlowyText(
LocaleKeys.document_imageBlock_embedLink_label.tr(), LocaleKeys.document_imageBlock_embedLink_label.tr(),
lineHeight: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Theme.of(context).colorScheme.onPrimary,
), ),
onTap: submit, onTap: submit,
), ),
), ),
const VSpace(8),
], ],
); );
} }

View File

@ -448,7 +448,7 @@ Widget _slashMenuItemNameBuilder(
SelectionMenuStyle style, SelectionMenuStyle style,
bool isSelected, bool isSelected,
) { ) {
return FlowyText( return FlowyText.regular(
name, name,
fontSize: 12.0, fontSize: 12.0,
figmaLineHeight: 15.0, figmaLineHeight: 15.0,

View File

@ -167,10 +167,11 @@ class FlowyText extends StatelessWidget {
} }
double? lineHeight; double? lineHeight;
if (this.lineHeight != null) { // use figma line height as first priority
lineHeight = this.lineHeight!; if (figmaLineHeight != null) {
} else if (figmaLineHeight != null) {
lineHeight = figmaLineHeight! / fontSize; lineHeight = figmaLineHeight! / fontSize;
} else if (this.lineHeight != null) {
lineHeight = this.lineHeight!;
} }
if (isEmoji && (_useNotoColorEmoji || Platform.isWindows)) { if (isEmoji && (_useNotoColorEmoji || Platform.isWindows)) {
@ -210,7 +211,7 @@ class FlowyText extends StatelessWidget {
textAlign: textAlign, textAlign: textAlign,
overflow: overflow ?? TextOverflow.clip, overflow: overflow ?? TextOverflow.clip,
style: textStyle, style: textStyle,
strutStyle: (isEmoji && optimizeEmojiAlign) strutStyle: !isEmoji || (isEmoji && optimizeEmojiAlign)
? StrutStyle.fromTextStyle( ? StrutStyle.fromTextStyle(
textStyle, textStyle,
forceStrutHeight: true, forceStrutHeight: true,