fix: tauri folder display (#2176)

* fix: tauri folder display

* refactor: rename layout type
This commit is contained in:
Nathan.fooo
2023-04-04 14:08:50 +08:00
committed by GitHub
parent e1c8135f5d
commit ddd3fbb178
71 changed files with 288 additions and 532 deletions

View File

@ -79,7 +79,7 @@ class DatabaseController {
final DatabaseViewBackendService _databaseViewBackendSvc;
final FieldController fieldController;
late DatabaseViewCache _viewCache;
final LayoutTypePB layoutType;
final DatabaseLayoutPB layoutType;
// Callbacks
DatabaseCallbacks? _databaseCallbacks;
@ -110,7 +110,7 @@ class DatabaseController {
_listenOnFieldsChanged();
_listenOnGroupChanged();
_listenOnLayoutChanged();
if (layoutType == LayoutTypePB.Calendar) {
if (layoutType == DatabaseLayoutPB.Calendar) {
_listenOnCalendarLayoutChanged();
}
}

View File

@ -86,7 +86,7 @@ class DatabaseViewBackendService {
}
Future<Either<LayoutSettingPB, FlowyError>> getLayoutSetting(
LayoutTypePB layoutType) {
DatabaseLayoutPB layoutType) {
final payload = DatabaseLayoutIdPB.create()
..viewId = viewId
..layout = layoutType;

View File

@ -30,7 +30,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
BoardBloc({required ViewPB view})
: _databaseController = DatabaseController(
view: view,
layoutType: LayoutTypePB.Board,
layoutType: DatabaseLayoutPB.Board,
),
super(BoardState.initial(view.id)) {
boardController = AppFlowyBoardController(

View File

@ -29,7 +29,7 @@ class BoardPluginBuilder implements PluginBuilder {
PluginType get pluginType => PluginType.board;
@override
ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Board;
ViewLayoutPB? get layoutType => ViewLayoutPB.Board;
}
class BoardPluginConfig implements PluginConfig {

View File

@ -28,7 +28,7 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
CalendarBloc({required ViewPB view})
: _databaseController = DatabaseController(
view: view,
layoutType: LayoutTypePB.Calendar,
layoutType: DatabaseLayoutPB.Calendar,
),
super(CalendarState.initial()) {
on<CalendarEvent>(

View File

@ -29,7 +29,7 @@ class CalendarPluginBuilder extends PluginBuilder {
PluginType get pluginType => PluginType.calendar;
@override
ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Calendar;
ViewLayoutPB? get layoutType => ViewLayoutPB.Calendar;
}
class CalendarPluginConfig implements PluginConfig {

View File

@ -29,7 +29,7 @@ class GridPluginBuilder implements PluginBuilder {
PluginType get pluginType => PluginType.grid;
@override
ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Grid;
ViewLayoutPB? get layoutType => ViewLayoutPB.Grid;
}
class GridPluginConfig implements PluginConfig {

View File

@ -38,7 +38,7 @@ class GridPage extends StatefulWidget {
Key? key,
}) : databaseController = DatabaseController(
view: view,
layoutType: LayoutTypePB.Grid,
layoutType: DatabaseLayoutPB.Grid,
),
super(key: key);

View File

@ -34,7 +34,7 @@ class DocumentPluginBuilder extends PluginBuilder {
PluginType get pluginType => PluginType.editor;
@override
ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Document;
ViewLayoutPB? get layoutType => ViewLayoutPB.Document;
}
class DocumentPlugin extends Plugin<int> {

View File

@ -30,9 +30,9 @@ extension InsertPage on EditorState {
String _convertPageType(ViewPB viewPB) {
switch (viewPB.layout) {
case ViewLayoutTypePB.Grid:
case ViewLayoutPB.Grid:
return kGridType;
case ViewLayoutTypePB.Board:
case ViewLayoutPB.Board:
return kBoardType;
default:
throw Exception('Unknown layout type');

View File

@ -17,7 +17,7 @@ void showLinkToPageMenu(
EditorState editorState,
SelectionMenuService menuService,
BuildContext context,
ViewLayoutTypePB pageType,
ViewLayoutPB pageType,
) {
final alignment = menuService.alignment;
final offset = menuService.offset;
@ -27,10 +27,10 @@ void showLinkToPageMenu(
String hintText = '';
switch (pageType) {
case ViewLayoutTypePB.Grid:
case ViewLayoutPB.Grid:
hintText = LocaleKeys.document_slashMenu_grid_selectAGridToLinkTo.tr();
break;
case ViewLayoutTypePB.Board:
case ViewLayoutPB.Board:
hintText = LocaleKeys.document_slashMenu_board_selectABoardToLinkTo.tr();
break;
default:
@ -82,7 +82,7 @@ class LinkToPageMenu extends StatefulWidget {
});
final EditorState editorState;
final ViewLayoutTypePB layoutType;
final ViewLayoutPB layoutType;
final String hintText;
final void Function(ViewPB view, ViewPB childView) onSelected;
@ -174,9 +174,9 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
String _iconName(ViewPB viewPB) {
switch (viewPB.layout) {
case ViewLayoutTypePB.Grid:
case ViewLayoutPB.Grid:
return 'editor/grid';
case ViewLayoutTypePB.Board:
case ViewLayoutPB.Board:
return 'editor/board';
default:
throw Exception('Unknown layout type');

View File

@ -24,7 +24,7 @@ SelectionMenuItem boardMenuItem = SelectionMenuItem(
editorState,
menuService,
context,
ViewLayoutTypePB.Board,
ViewLayoutPB.Board,
);
},
);

View File

@ -23,17 +23,17 @@ SelectionMenuItem boardViewMenuItem(DocumentBloc documentBloc) =>
// TODO(a-wallen): Translate keywords.
keywords: ['board', 'kanban'],
handler: (editorState, menuService, context) async {
if (!documentBloc.view.hasAppId()) {
if (!documentBloc.view.hasParentViewId()) {
return;
}
final appId = documentBloc.view.appId;
final appId = documentBloc.view.parentViewId;
final service = AppBackendService();
final result = (await service.createView(
appId: appId,
name: LocaleKeys.menuAppHeader_defaultNewPageName.tr(),
layoutType: ViewLayoutTypePB.Board,
layoutType: ViewLayoutPB.Board,
))
.getLeftOrNull();

View File

@ -23,7 +23,7 @@ SelectionMenuItem gridMenuItem = SelectionMenuItem(
editorState,
menuService,
context,
ViewLayoutTypePB.Grid,
ViewLayoutPB.Grid,
);
},
);

View File

@ -22,17 +22,17 @@ SelectionMenuItem gridViewMenuItem(DocumentBloc documentBloc) =>
},
keywords: ['grid'],
handler: (editorState, menuService, context) async {
if (!documentBloc.view.hasAppId()) {
if (!documentBloc.view.hasParentViewId()) {
return;
}
final appId = documentBloc.view.appId;
final appId = documentBloc.view.parentViewId;
final service = AppBackendService();
final result = (await service.createView(
appId: appId,
name: LocaleKeys.menuAppHeader_defaultNewPageName.tr(),
layoutType: ViewLayoutTypePB.Grid,
layoutType: ViewLayoutPB.Grid,
))
.getLeftOrNull();