fix: embed link button ui on mobile

This commit is contained in:
Lucas.Xu 2024-08-17 12:01:51 +08:00
parent 7c93a0ab14
commit cd45a09e83
4 changed files with 38 additions and 12 deletions

View File

@ -142,8 +142,10 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
);
} else {
child = Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0),
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 12.0,
),
child: child,
);
}

View File

@ -1,5 +1,6 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/shared/patterns/common_patterns.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
@ -22,13 +23,26 @@ class _EmbedImageUrlWidgetState extends State<EmbedImageUrlWidget> {
@override
Widget build(BuildContext context) {
return Column(
children: [
const VSpace(12),
FlowyTextField(
final textField = FlowyTextField(
hintText: LocaleKeys.document_imageBlock_embedLink_placeholder.tr(),
onChanged: (value) => inputText = value,
onEditingComplete: submit,
textStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontSize: 14,
),
hintStyle: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).hintColor,
fontSize: 14,
),
);
return Column(
children: [
const VSpace(12),
PlatformExtension.isDesktop
? textField
: SizedBox(
height: 42,
child: textField,
),
if (!isUrlValid) ...[
const VSpace(12),
@ -39,18 +53,23 @@ class _EmbedImageUrlWidgetState extends State<EmbedImageUrlWidget> {
],
const VSpace(20),
SizedBox(
height: 32,
height: PlatformExtension.isMobile ? 36 : 32,
width: 300,
child: FlowyButton(
backgroundColor: Theme.of(context).colorScheme.primary,
hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.9),
showDefaultBoxDecorationOnMobile: true,
radius:
PlatformExtension.isMobile ? BorderRadius.circular(8) : null,
margin: const EdgeInsets.all(5),
text: FlowyText(
LocaleKeys.document_imageBlock_embedLink_label.tr(),
lineHeight: 1,
textAlign: TextAlign.center,
color: Theme.of(context).colorScheme.onPrimary,
color: PlatformExtension.isMobile
? null
: Theme.of(context).colorScheme.onPrimary,
fontSize: PlatformExtension.isMobile ? 14 : null,
),
onTap: submit,
),

View File

@ -24,7 +24,7 @@ class UploadImageFileWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final child = FlowyButton(
Widget child = FlowyButton(
showDefaultBoxDecorationOnMobile: true,
radius: PlatformExtension.isMobile ? BorderRadius.circular(8.0) : null,
text: Container(
@ -38,7 +38,12 @@ class UploadImageFileWidget extends StatelessWidget {
);
if (PlatformExtension.isDesktopOrWeb) {
return FlowyHover(child: child);
child = FlowyHover(child: child);
} else {
child = Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: child,
);
}
return child;

View File

@ -264,7 +264,7 @@ class FlowyButton extends StatelessWidget {
? BoxDecoration(
border: Border.all(
color: borderColor ??
Theme.of(context).colorScheme.surfaceContainerHighest,
Theme.of(context).colorScheme.outline,
width: 1.0,
),
borderRadius: radius,