feat: display no access page (#5941)

* feat: display no access page

* fix: optimize the primary rounded button
This commit is contained in:
Lucas.Xu 2024-08-13 09:32:22 +08:00 committed by GitHub
parent 4b710527c9
commit 93f9a2cab1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 71 additions and 41 deletions

View File

@ -1,4 +1,5 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/application/mobile_router.dart';
import 'package:appflowy/plugins/base/emoji/emoji_text.dart';
import 'package:appflowy/plugins/document/application/document_bloc.dart';
@ -21,6 +22,7 @@ import 'package:appflowy_editor/appflowy_editor.dart'
TextTransaction,
paragraphNode;
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flutter/material.dart';
@ -105,57 +107,69 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
// memorize the result
pageMemorizer[widget.pageId] = view;
if (view == null) {
return const SizedBox.shrink();
}
final iconSize = widget.textStyle?.fontSize ?? 16.0;
final child = GestureDetector(
onTap: handleTap,
onDoubleTap: handleDoubleTap,
behavior: HitTestBehavior.translucent,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const HSpace(4),
view.icon.value.isNotEmpty
? EmojiText(
emoji: view.icon.value,
fontSize: 12,
textAlign: TextAlign.center,
lineHeight: 1.3,
)
: FlowySvg(
view.layout.icon,
size: Size.square(iconSize + 2.0),
),
const HSpace(2),
FlowyText(
view.name,
return FlowyHover(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: FlowyText(
LocaleKeys.document_mention_noAccess.tr(),
color: Theme.of(context).disabledColor,
decoration: TextDecoration.underline,
fontSize: widget.textStyle?.fontSize,
fontWeight: widget.textStyle?.fontWeight,
),
const HSpace(2),
],
),
);
if (PlatformExtension.isMobile) {
return child;
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: FlowyHover(
cursor: SystemMouseCursors.click,
child: child,
),
final iconSize = widget.textStyle?.fontSize ?? 16.0;
Widget child = Row(
mainAxisSize: MainAxisSize.min,
children: [
const HSpace(4),
view.icon.value.isNotEmpty
? EmojiText(
emoji: view.icon.value,
fontSize: 12,
textAlign: TextAlign.center,
lineHeight: 1.3,
)
: FlowySvg(
view.layout.icon,
size: Size.square(iconSize + 2.0),
),
const HSpace(2),
FlowyText(
view.name,
decoration: TextDecoration.underline,
fontSize: widget.textStyle?.fontSize,
fontWeight: widget.textStyle?.fontWeight,
),
const HSpace(4),
],
);
if (PlatformExtension.isDesktop) {
child = Padding(
padding: const EdgeInsets.symmetric(horizontal: 2),
child: FlowyHover(
cursor: SystemMouseCursors.click,
child: child,
),
);
}
return GestureDetector(
onTap: handleTap,
onDoubleTap: PlatformExtension.isMobile ? handleDoubleTap : null,
behavior: HitTestBehavior.opaque,
child: child,
);
},
);
}
Future<void> handleTap() async {
debugPrint('handleTap');
final view = await fetchView(widget.pageId);
if (view == null) {
Log.error('Page(${widget.pageId}) not found');

View File

@ -43,6 +43,7 @@ class ShareMenuButton extends StatelessWidget {
),
child: PrimaryRoundedButton(
text: LocaleKeys.shareAction_buttonText.tr(),
figmaLineHeight: 16,
),
),
),

View File

@ -263,6 +263,8 @@ class _PublishButton extends StatelessWidget {
text: LocaleKeys.shareAction_publish.tr(),
useIntrinsicWidth: false,
margin: const EdgeInsets.symmetric(vertical: 9.0),
fontSize: 14.0,
figmaLineHeight: 18.0,
onTap: onPublish,
);
}

View File

@ -248,6 +248,7 @@ class _WorkspaceInfo extends StatelessWidget {
FlowyText.medium(
workspace.name,
fontSize: 14.0,
figmaLineHeight: 17.0,
overflow: TextOverflow.ellipsis,
withTooltip: true,
),
@ -260,6 +261,7 @@ class _WorkspaceInfo extends StatelessWidget {
members.length,
),
fontSize: 10.0,
figmaLineHeight: 12.0,
color: Theme.of(context).hintColor,
),
],

View File

@ -113,6 +113,7 @@ class SingleSettingAction extends StatelessWidget {
fontSize: 12,
isDangerous: buttonType.isDangerous,
onPressed: onPressed,
lineHeight: 1.0,
),
),
],

View File

@ -306,6 +306,7 @@ class FlowyTextButton extends StatelessWidget {
this.fontFamily,
this.isDangerous = false,
this.borderColor,
this.lineHeight,
});
factory FlowyTextButton.primary({
@ -362,6 +363,7 @@ class FlowyTextButton extends StatelessWidget {
final String? fontFamily;
final bool isDangerous;
final Color? borderColor;
final double? lineHeight;
@override
Widget build(BuildContext context) {
@ -375,6 +377,7 @@ class FlowyTextButton extends StatelessWidget {
overflow: overflow,
color: textColor,
textAlign: TextAlign.center,
lineHeight: lineHeight,
));
Widget child = Row(
@ -411,7 +414,7 @@ class FlowyTextButton extends StatelessWidget {
fontSize: fontSize,
decoration: decoration,
fontFamily: fontFamily,
height: 1.1,
height: lineHeight ?? 1.1,
),
),
backgroundColor: WidgetStateProperty.resolveWith(

View File

@ -15,6 +15,8 @@ class PrimaryRoundedButton extends StatelessWidget {
this.hoverColor,
this.backgroundColor,
this.useIntrinsicWidth = true,
this.lineHeight,
this.figmaLineHeight,
});
final String text;
@ -27,6 +29,8 @@ class PrimaryRoundedButton extends StatelessWidget {
final Color? hoverColor;
final Color? backgroundColor;
final bool useIntrinsicWidth;
final double? lineHeight;
final double? figmaLineHeight;
@override
Widget build(BuildContext context) {
@ -36,6 +40,8 @@ class PrimaryRoundedButton extends StatelessWidget {
text,
fontSize: fontSize ?? 14.0,
fontWeight: fontWeight ?? FontWeight.w500,
lineHeight: lineHeight ?? 1.0,
figmaLineHeight: figmaLineHeight,
color: Theme.of(context).colorScheme.onPrimary,
textAlign: TextAlign.center,
),

View File

@ -1766,7 +1766,8 @@
"tooltip": "Click to open page"
},
"deleted": "Deleted",
"deletedContent": "This content does not exist or has been deleted"
"deletedContent": "This content does not exist or has been deleted",
"noAccess": "No Access"
},
"toolbar": {
"resetToDefaultFont": "Reset to default"