mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: display no access page (#5941)
* feat: display no access page * fix: optimize the primary rounded button
This commit is contained in:
parent
4b710527c9
commit
93f9a2cab1
@ -1,4 +1,5 @@
|
|||||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
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/mobile/application/mobile_router.dart';
|
||||||
import 'package:appflowy/plugins/base/emoji/emoji_text.dart';
|
import 'package:appflowy/plugins/base/emoji/emoji_text.dart';
|
||||||
import 'package:appflowy/plugins/document/application/document_bloc.dart';
|
import 'package:appflowy/plugins/document/application/document_bloc.dart';
|
||||||
@ -21,6 +22,7 @@ import 'package:appflowy_editor/appflowy_editor.dart'
|
|||||||
TextTransaction,
|
TextTransaction,
|
||||||
paragraphNode;
|
paragraphNode;
|
||||||
import 'package:collection/collection.dart';
|
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/flowy_infra_ui.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -105,15 +107,22 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
|
|||||||
// memorize the result
|
// memorize the result
|
||||||
pageMemorizer[widget.pageId] = view;
|
pageMemorizer[widget.pageId] = view;
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
return const SizedBox.shrink();
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final iconSize = widget.textStyle?.fontSize ?? 16.0;
|
final iconSize = widget.textStyle?.fontSize ?? 16.0;
|
||||||
final child = GestureDetector(
|
Widget child = Row(
|
||||||
onTap: handleTap,
|
|
||||||
onDoubleTap: handleDoubleTap,
|
|
||||||
behavior: HitTestBehavior.translucent,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const HSpace(4),
|
const HSpace(4),
|
||||||
@ -135,27 +144,32 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
|
|||||||
fontSize: widget.textStyle?.fontSize,
|
fontSize: widget.textStyle?.fontSize,
|
||||||
fontWeight: widget.textStyle?.fontWeight,
|
fontWeight: widget.textStyle?.fontWeight,
|
||||||
),
|
),
|
||||||
const HSpace(2),
|
const HSpace(4),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PlatformExtension.isMobile) {
|
if (PlatformExtension.isDesktop) {
|
||||||
return child;
|
child = Padding(
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||||
child: FlowyHover(
|
child: FlowyHover(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: handleTap,
|
||||||
|
onDoubleTap: PlatformExtension.isMobile ? handleDoubleTap : null,
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleTap() async {
|
Future<void> handleTap() async {
|
||||||
|
debugPrint('handleTap');
|
||||||
final view = await fetchView(widget.pageId);
|
final view = await fetchView(widget.pageId);
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
Log.error('Page(${widget.pageId}) not found');
|
Log.error('Page(${widget.pageId}) not found');
|
||||||
|
@ -43,6 +43,7 @@ class ShareMenuButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: PrimaryRoundedButton(
|
child: PrimaryRoundedButton(
|
||||||
text: LocaleKeys.shareAction_buttonText.tr(),
|
text: LocaleKeys.shareAction_buttonText.tr(),
|
||||||
|
figmaLineHeight: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -263,6 +263,8 @@ class _PublishButton extends StatelessWidget {
|
|||||||
text: LocaleKeys.shareAction_publish.tr(),
|
text: LocaleKeys.shareAction_publish.tr(),
|
||||||
useIntrinsicWidth: false,
|
useIntrinsicWidth: false,
|
||||||
margin: const EdgeInsets.symmetric(vertical: 9.0),
|
margin: const EdgeInsets.symmetric(vertical: 9.0),
|
||||||
|
fontSize: 14.0,
|
||||||
|
figmaLineHeight: 18.0,
|
||||||
onTap: onPublish,
|
onTap: onPublish,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -248,6 +248,7 @@ class _WorkspaceInfo extends StatelessWidget {
|
|||||||
FlowyText.medium(
|
FlowyText.medium(
|
||||||
workspace.name,
|
workspace.name,
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
|
figmaLineHeight: 17.0,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
withTooltip: true,
|
withTooltip: true,
|
||||||
),
|
),
|
||||||
@ -260,6 +261,7 @@ class _WorkspaceInfo extends StatelessWidget {
|
|||||||
members.length,
|
members.length,
|
||||||
),
|
),
|
||||||
fontSize: 10.0,
|
fontSize: 10.0,
|
||||||
|
figmaLineHeight: 12.0,
|
||||||
color: Theme.of(context).hintColor,
|
color: Theme.of(context).hintColor,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -113,6 +113,7 @@ class SingleSettingAction extends StatelessWidget {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
isDangerous: buttonType.isDangerous,
|
isDangerous: buttonType.isDangerous,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
|
lineHeight: 1.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -306,6 +306,7 @@ class FlowyTextButton extends StatelessWidget {
|
|||||||
this.fontFamily,
|
this.fontFamily,
|
||||||
this.isDangerous = false,
|
this.isDangerous = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
|
this.lineHeight,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory FlowyTextButton.primary({
|
factory FlowyTextButton.primary({
|
||||||
@ -362,6 +363,7 @@ class FlowyTextButton extends StatelessWidget {
|
|||||||
final String? fontFamily;
|
final String? fontFamily;
|
||||||
final bool isDangerous;
|
final bool isDangerous;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
|
final double? lineHeight;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -375,6 +377,7 @@ class FlowyTextButton extends StatelessWidget {
|
|||||||
overflow: overflow,
|
overflow: overflow,
|
||||||
color: textColor,
|
color: textColor,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
lineHeight: lineHeight,
|
||||||
));
|
));
|
||||||
|
|
||||||
Widget child = Row(
|
Widget child = Row(
|
||||||
@ -411,7 +414,7 @@ class FlowyTextButton extends StatelessWidget {
|
|||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
fontFamily: fontFamily,
|
fontFamily: fontFamily,
|
||||||
height: 1.1,
|
height: lineHeight ?? 1.1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: WidgetStateProperty.resolveWith(
|
backgroundColor: WidgetStateProperty.resolveWith(
|
||||||
|
@ -15,6 +15,8 @@ class PrimaryRoundedButton extends StatelessWidget {
|
|||||||
this.hoverColor,
|
this.hoverColor,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
this.useIntrinsicWidth = true,
|
this.useIntrinsicWidth = true,
|
||||||
|
this.lineHeight,
|
||||||
|
this.figmaLineHeight,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String text;
|
final String text;
|
||||||
@ -27,6 +29,8 @@ class PrimaryRoundedButton extends StatelessWidget {
|
|||||||
final Color? hoverColor;
|
final Color? hoverColor;
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
final bool useIntrinsicWidth;
|
final bool useIntrinsicWidth;
|
||||||
|
final double? lineHeight;
|
||||||
|
final double? figmaLineHeight;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -36,6 +40,8 @@ class PrimaryRoundedButton extends StatelessWidget {
|
|||||||
text,
|
text,
|
||||||
fontSize: fontSize ?? 14.0,
|
fontSize: fontSize ?? 14.0,
|
||||||
fontWeight: fontWeight ?? FontWeight.w500,
|
fontWeight: fontWeight ?? FontWeight.w500,
|
||||||
|
lineHeight: lineHeight ?? 1.0,
|
||||||
|
figmaLineHeight: figmaLineHeight,
|
||||||
color: Theme.of(context).colorScheme.onPrimary,
|
color: Theme.of(context).colorScheme.onPrimary,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
@ -1766,7 +1766,8 @@
|
|||||||
"tooltip": "Click to open page"
|
"tooltip": "Click to open page"
|
||||||
},
|
},
|
||||||
"deleted": "Deleted",
|
"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": {
|
"toolbar": {
|
||||||
"resetToDefaultFont": "Reset to default"
|
"resetToDefaultFont": "Reset to default"
|
||||||
|
Loading…
Reference in New Issue
Block a user