11import 'package:app_flowy/plugins/document/presentation/plugins/base/insert_page_command.dart' ;
22import 'package:app_flowy/startup/startup.dart' ;
33import 'package:app_flowy/workspace/application/app/app_service.dart' ;
4- import 'package:app_flowy/workspace/application/view/view_ext.dart' ;
5- import 'package:app_flowy/workspace/presentation/home/home_stack.dart' ;
6- import 'package:app_flowy/workspace/presentation/home/menu/menu.dart' ;
74import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart' ;
85import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart' ;
96import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart' ;
107import 'package:appflowy_editor/appflowy_editor.dart' ;
11- import 'package:appflowy_popover/appflowy_popover.dart' ;
128import 'package:dartz/dartz.dart' as dartz;
13- import 'package:flowy_infra_ui/style_widget/icon_button.dart' ;
9+ import 'package:flowy_infra_ui/style_widget/text.dart' ;
10+ import 'package:flowy_infra_ui/widget/spacing.dart' ;
1411import 'package:flutter/material.dart' ;
1512import 'package:app_flowy/generated/locale_keys.g.dart' ;
1613import 'package:easy_localization/easy_localization.dart' ;
1714import 'package:flowy_infra/image.dart' ;
15+ import 'package:app_flowy/workspace/application/view/view_ext.dart' ;
16+ import 'package:app_flowy/workspace/presentation/home/home_stack.dart' ;
17+ import 'package:app_flowy/workspace/presentation/home/menu/menu.dart' ;
18+ import 'package:appflowy_popover/appflowy_popover.dart' ;
19+ import 'package:flowy_infra_ui/style_widget/icon_button.dart' ;
1820
1921class BuiltInPageWidget extends StatefulWidget {
2022 const BuiltInPageWidget ({
@@ -103,41 +105,66 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
103105 return Positioned (
104106 top: 5 ,
105107 left: 5 ,
106- child: PopoverActionList <_ActionWrapper >(
107- direction: PopoverDirection .bottomWithCenterAligned,
108- actions:
109- _ActionType .values.map ((action) => _ActionWrapper (action)).toList (),
110- buildChild: (controller) {
111- return FlowyIconButton (
112- tooltipText: LocaleKeys .tooltip_openMenu.tr (),
113- width: 25 ,
114- height: 30 ,
108+ child: Row (
109+ mainAxisSize: MainAxisSize .min,
110+ mainAxisAlignment: MainAxisAlignment .center,
111+ children: [
112+ // information
113+ FlowyIconButton (
114+ tooltipText: LocaleKeys .tooltip_referencePage.tr (namedArgs: {
115+ 'name' : viewPB.layout.name,
116+ }),
117+ width: 24 ,
118+ height: 24 ,
115119 iconPadding: const EdgeInsets .all (3 ),
116- icon: svgWidget ('editor/details' ),
117- onPressed: () => controller.show (),
118- );
119- },
120- onSelected: (action, controller) async {
121- switch (action.inner) {
122- case _ActionType .openAsPage:
123- getIt <MenuSharedState >().latestOpenView = viewPB;
124- getIt <HomeStackManager >().setPlugin (viewPB.plugin ());
125- break ;
126- case _ActionType .delete:
127- final transaction = widget.editorState.transaction;
128- transaction.deleteNode (widget.node);
129- widget.editorState.apply (transaction);
130- break ;
131- }
132- controller.close ();
133- },
120+ icon: svgWidget ('common/information' ),
121+ ),
122+ // Name
123+ const Space (7 , 0 ),
124+ FlowyText .medium (
125+ viewPB.name,
126+ fontSize: 16.0 ,
127+ ),
128+ // setting
129+ const Space (7 , 0 ),
130+ PopoverActionList <_ActionWrapper >(
131+ direction: PopoverDirection .bottomWithCenterAligned,
132+ actions: _ActionType .values
133+ .map ((action) => _ActionWrapper (action))
134+ .toList (),
135+ buildChild: (controller) {
136+ return FlowyIconButton (
137+ tooltipText: LocaleKeys .tooltip_openMenu.tr (),
138+ width: 24 ,
139+ height: 24 ,
140+ iconPadding: const EdgeInsets .all (3 ),
141+ icon: svgWidget ('common/settings' ),
142+ onPressed: () => controller.show (),
143+ );
144+ },
145+ onSelected: (action, controller) async {
146+ switch (action.inner) {
147+ case _ActionType .viewDatabase:
148+ getIt <MenuSharedState >().latestOpenView = viewPB;
149+ getIt <HomeStackManager >().setPlugin (viewPB.plugin ());
150+ break ;
151+ case _ActionType .delete:
152+ final transaction = widget.editorState.transaction;
153+ transaction.deleteNode (widget.node);
154+ widget.editorState.apply (transaction);
155+ break ;
156+ }
157+ controller.close ();
158+ },
159+ )
160+ ],
134161 ),
135162 );
136163 }
137164}
138165
139166enum _ActionType {
140- openAsPage ,
167+ viewDatabase ,
141168 delete,
142169}
143170
@@ -151,8 +178,8 @@ class _ActionWrapper extends ActionCell {
151178 @override
152179 String get name {
153180 switch (inner) {
154- case _ActionType .openAsPage :
155- return LocaleKeys .tooltip_openAsPage .tr ();
181+ case _ActionType .viewDatabase :
182+ return LocaleKeys .tooltip_viewDataBase .tr ();
156183 case _ActionType .delete:
157184 return LocaleKeys .disclosureAction_delete.tr ();
158185 }
0 commit comments