chore: fix-typo (#3934)

This commit is contained in:
Richard Shiue 2023-11-14 15:41:44 +08:00 committed by GitHub
parent 75c26c807c
commit 4992f9c281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 75 additions and 74 deletions

View File

@ -1,5 +1,5 @@
import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tar_bar_add_button.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_add_button.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

View File

@ -1,4 +1,4 @@
import 'package:appflowy/plugins/database_view/tar_bar/tar_bar_add_button.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_add_button.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
import 'package:flutter_test/flutter_test.dart';

View File

@ -36,8 +36,8 @@ import 'package:appflowy/plugins/database_view/grid/presentation/widgets/sort/so
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/toolbar/filter_button.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/toolbar/grid_layout.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/toolbar/sort_button.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_header.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tar_bar_add_button.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_header.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_add_button.dart';
import 'package:appflowy/plugins/database_view/widgets/database_layout_ext.dart';
import 'package:appflowy/plugins/database_view/widgets/row/accessory/cell_accessory.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cells/cells.dart';

View File

@ -1,5 +1,5 @@
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tar_bar_add_button.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_add_button.dart';
import 'package:appflowy/workspace/application/view/prelude.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy_backend/log.dart';
@ -11,14 +11,15 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'database_controller.dart';
import 'database_view_service.dart';
part 'tar_bar_bloc.freezed.dart';
part 'tab_bar_bloc.freezed.dart';
class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
GridTabBarBloc({
class DatabaseTabBarBloc
extends Bloc<DatabaseTabBarEvent, DatabaseTabBarState> {
DatabaseTabBarBloc({
bool isInlineView = false,
required ViewPB view,
}) : super(GridTabBarState.initial(view)) {
on<GridTabBarEvent>(
}) : super(DatabaseTabBarState.initial(view)) {
on<DatabaseTabBarEvent>(
(event, emit) async {
event.when(
initial: () {
@ -31,7 +32,7 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
tabBars: [
...state.tabBars,
...childViews.map(
(newChildView) => TarBar(view: newChildView),
(newChildView) => DatabaseTabBar(view: newChildView),
),
],
tabBarControllerByViewId: _extendsTabBarController(childViews),
@ -64,7 +65,7 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
if (updatePB.createChildViews.isNotEmpty) {
final allTabBars = [
...state.tabBars,
...updatePB.createChildViews.map((e) => TarBar(view: e))
...updatePB.createChildViews.map((e) => DatabaseTabBar(view: e))
];
emit(
state.copyWith(
@ -115,7 +116,7 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
);
if (index != -1) {
final allTabBars = [...state.tabBars];
final updatedTabBar = TarBar(view: updatedView);
final updatedTabBar = DatabaseTabBar(view: updatedView);
allTabBars[index] = updatedTabBar;
emit(state.copyWith(tabBars: allTabBars));
}
@ -136,24 +137,24 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
void _listenInlineViewChanged() {
final controller = state.tabBarControllerByViewId[state.parentView.id];
controller?.onViewUpdated = (newView) {
add(GridTabBarEvent.viewDidUpdate(newView));
add(DatabaseTabBarEvent.viewDidUpdate(newView));
};
// Only listen the child view changes when the parent view is inline.
controller?.onViewChildViewChanged = (update) {
add(GridTabBarEvent.didUpdateChildViews(update));
add(DatabaseTabBarEvent.didUpdateChildViews(update));
};
}
/// Create tab bar controllers for the new views and return the updated map.
Map<String, DatabaseTarBarController> _extendsTabBarController(
Map<String, DatabaseTabBarController> _extendsTabBarController(
List<ViewPB> newViews,
) {
final tabBarControllerByViewId = {...state.tabBarControllerByViewId};
for (final view in newViews) {
final controller = DatabaseTarBarController(view: view);
final controller = DatabaseTabBarController(view: view);
controller.onViewUpdated = (newView) {
add(GridTabBarEvent.viewDidUpdate(newView));
add(DatabaseTabBarEvent.viewDidUpdate(newView));
};
tabBarControllerByViewId[view.id] = controller;
@ -191,7 +192,7 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
return;
}
viewsOrFail.fold(
(views) => add(GridTabBarEvent.didLoadChildViews(views)),
(views) => add(DatabaseTabBarEvent.didLoadChildViews(views)),
(err) => Log.error(err),
);
});
@ -199,40 +200,40 @@ class GridTabBarBloc extends Bloc<GridTabBarEvent, GridTabBarState> {
}
@freezed
class GridTabBarEvent with _$GridTabBarEvent {
const factory GridTabBarEvent.initial() = _Initial;
const factory GridTabBarEvent.didLoadChildViews(
class DatabaseTabBarEvent with _$DatabaseTabBarEvent {
const factory DatabaseTabBarEvent.initial() = _Initial;
const factory DatabaseTabBarEvent.didLoadChildViews(
List<ViewPB> childViews,
) = _DidLoadChildViews;
const factory GridTabBarEvent.selectView(String viewId) = _DidSelectView;
const factory GridTabBarEvent.createView(AddButtonAction action) =
const factory DatabaseTabBarEvent.selectView(String viewId) = _DidSelectView;
const factory DatabaseTabBarEvent.createView(AddButtonAction action) =
_CreateView;
const factory GridTabBarEvent.renameView(String viewId, String newName) =
const factory DatabaseTabBarEvent.renameView(String viewId, String newName) =
_RenameView;
const factory GridTabBarEvent.deleteView(String viewId) = _DeleteView;
const factory GridTabBarEvent.didUpdateChildViews(
const factory DatabaseTabBarEvent.deleteView(String viewId) = _DeleteView;
const factory DatabaseTabBarEvent.didUpdateChildViews(
ChildViewUpdatePB updatePB,
) = _DidUpdateChildViews;
const factory GridTabBarEvent.viewDidUpdate(ViewPB view) = _ViewDidUpdate;
const factory DatabaseTabBarEvent.viewDidUpdate(ViewPB view) = _ViewDidUpdate;
}
@freezed
class GridTabBarState with _$GridTabBarState {
const factory GridTabBarState({
class DatabaseTabBarState with _$DatabaseTabBarState {
const factory DatabaseTabBarState({
required ViewPB parentView,
required int selectedIndex,
required List<TarBar> tabBars,
required Map<String, DatabaseTarBarController> tabBarControllerByViewId,
}) = _GridTabBarState;
required List<DatabaseTabBar> tabBars,
required Map<String, DatabaseTabBarController> tabBarControllerByViewId,
}) = _DatabaseTabBarState;
factory GridTabBarState.initial(ViewPB view) {
final tabBar = TarBar(view: view);
return GridTabBarState(
factory DatabaseTabBarState.initial(ViewPB view) {
final tabBar = DatabaseTabBar(view: view);
return DatabaseTabBarState(
parentView: view,
selectedIndex: 0,
tabBars: [tabBar],
tabBarControllerByViewId: {
view.id: DatabaseTarBarController(
view.id: DatabaseTabBarController(
view: view,
)
},
@ -240,7 +241,7 @@ class GridTabBarState with _$GridTabBarState {
}
}
class TarBar extends Equatable {
class DatabaseTabBar extends Equatable {
final ViewPB view;
final DatabaseTabBarItemBuilder _builder;
@ -248,7 +249,7 @@ class TarBar extends Equatable {
DatabaseTabBarItemBuilder get builder => _builder;
ViewLayoutPB get layout => view.layout;
TarBar({
DatabaseTabBar({
required this.view,
}) : _builder = view.tarBarItem();
@ -261,14 +262,14 @@ typedef OnViewChildViewChanged = void Function(
ChildViewUpdatePB childViewUpdate,
);
class DatabaseTarBarController {
class DatabaseTabBarController {
ViewPB view;
final DatabaseController controller;
final ViewListener viewListener;
OnViewUpdated? onViewUpdated;
OnViewChildViewChanged? onViewChildViewChanged;
DatabaseTarBarController({
DatabaseTabBarController({
required this.view,
}) : controller = DatabaseController(view: view),
viewListener = ViewListener(viewId: view.id) {

View File

@ -1,6 +1,6 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/startup/plugin/plugin.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
import 'package:easy_localization/easy_localization.dart';

View File

@ -8,7 +8,7 @@ import 'package:appflowy/plugins/database_view/application/row/row_cache.dart';
import 'package:appflowy/plugins/database_view/application/row/row_controller.dart';
import 'package:appflowy/plugins/database_view/board/presentation/widgets/board_column_header.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/widgets/row/row_detail.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';

View File

@ -1,6 +1,6 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/startup/plugin/plugin.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';

View File

@ -4,7 +4,7 @@ import 'package:appflowy/plugins/database_view/application/database_controller.d
import 'package:appflowy/plugins/database_view/calendar/application/calendar_bloc.dart';
import 'package:appflowy/plugins/database_view/calendar/application/unschedule_event_bloc.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/layout/sizes.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/calendar_entities.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
import 'package:appflowy_popover/appflowy_popover.dart';

View File

@ -1,6 +1,6 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/startup/plugin/plugin.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';

View File

@ -1,7 +1,7 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/toolbar/grid_setting_bar.dart';
import 'package:appflowy/plugins/database_view/tar_bar/setting_menu.dart';
import 'package:appflowy/plugins/database_view/tab_bar/setting_menu.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cell_builder.dart';
import 'package:appflowy_backend/log.dart';
import 'package:easy_localization/easy_localization.dart';
@ -20,7 +20,7 @@ import '../../application/row/row_controller.dart';
import '../application/grid_bloc.dart';
import '../../application/database_controller.dart';
import 'grid_scroll.dart';
import '../../tar_bar/tab_bar_view.dart';
import '../../tab_bar/tab_bar_view.dart';
import 'layout/layout.dart';
import 'layout/sizes.dart';
import 'widgets/row/row.dart';

View File

@ -12,8 +12,8 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../application/tar_bar_bloc.dart';
import 'tar_bar_add_button.dart';
import '../application/tab_bar_bloc.dart';
import 'tab_bar_add_button.dart';
class TabBarHeader extends StatefulWidget {
const TabBarHeader({super.key});
@ -40,14 +40,14 @@ class _TabBarHeaderState extends State<TabBarHeader> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BlocBuilder<GridTabBarBloc, GridTabBarState>(
BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
return const Flexible(
child: DatabaseTabBar(),
);
},
),
BlocBuilder<GridTabBarBloc, GridTabBarState>(
BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
return SizedBox(
width: 200,
@ -66,7 +66,7 @@ class _TabBarHeaderState extends State<TabBarHeader> {
);
}
Widget pageSettingBarFromState(GridTabBarState state) {
Widget pageSettingBarFromState(DatabaseTabBarState state) {
if (state.tabBars.length < state.selectedIndex) {
return const SizedBox.shrink();
}
@ -92,7 +92,7 @@ class _DatabaseTabBarState extends State<DatabaseTabBar> {
@override
Widget build(BuildContext context) {
return BlocBuilder<GridTabBarBloc, GridTabBarState>(
return BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
final children = state.tabBars.indexed.map((indexed) {
final isSelected = state.selectedIndex == indexed.$1;
@ -102,8 +102,8 @@ class _DatabaseTabBarState extends State<DatabaseTabBar> {
view: tabBar.view,
isSelected: isSelected,
onTap: (selectedView) {
context.read<GridTabBarBloc>().add(
GridTabBarEvent.selectView(selectedView.id),
context.read<DatabaseTabBarBloc>().add(
DatabaseTabBarEvent.selectView(selectedView.id),
);
},
);
@ -122,8 +122,8 @@ class _DatabaseTabBarState extends State<DatabaseTabBar> {
),
AddDatabaseViewButton(
onTap: (action) async {
context.read<GridTabBarBloc>().add(
GridTabBarEvent.createView(action),
context.read<DatabaseTabBarBloc>().add(
DatabaseTabBarEvent.createView(action),
);
},
),
@ -231,8 +231,8 @@ class TabBarItemButton extends StatelessWidget {
title: LocaleKeys.menuAppHeader_renameDialog.tr(),
value: view.name,
confirm: (newValue) {
context.read<GridTabBarBloc>().add(
GridTabBarEvent.renameView(view.id, newValue),
context.read<DatabaseTabBarBloc>().add(
DatabaseTabBarEvent.renameView(view.id, newValue),
);
},
).show(context);
@ -241,8 +241,8 @@ class TabBarItemButton extends StatelessWidget {
NavigatorAlertDialog(
title: LocaleKeys.grid_deleteView.tr(),
confirm: () {
context.read<GridTabBarBloc>().add(
GridTabBarEvent.deleteView(view.id),
context.read<DatabaseTabBarBloc>().add(
DatabaseTabBarEvent.deleteView(view.id),
);
},
).show(context);

View File

@ -1,4 +1,4 @@
import 'package:appflowy/plugins/database_view/application/tar_bar_bloc.dart';
import 'package:appflowy/plugins/database_view/application/tab_bar_bloc.dart';
import 'package:appflowy/plugins/database_view/widgets/share_button.dart';
import 'package:appflowy/plugins/util.dart';
import 'package:appflowy/startup/plugin/plugin.dart';
@ -63,14 +63,14 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
@override
Widget build(BuildContext context) {
return BlocProvider<GridTabBarBloc>(
create: (context) => GridTabBarBloc(view: widget.view)
return BlocProvider<DatabaseTabBarBloc>(
create: (context) => DatabaseTabBarBloc(view: widget.view)
..add(
const GridTabBarEvent.initial(),
const DatabaseTabBarEvent.initial(),
),
child: MultiBlocListener(
listeners: [
BlocListener<GridTabBarBloc, GridTabBarState>(
BlocListener<DatabaseTabBarBloc, DatabaseTabBarState>(
listenWhen: (p, c) => p.selectedIndex != c.selectedIndex,
listener: (context, state) {
_pageController?.animateToPage(
@ -83,7 +83,7 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
],
child: Column(
children: [
BlocBuilder<GridTabBarBloc, GridTabBarState>(
BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
return ValueListenableBuilder<bool>(
valueListenable: state
@ -105,13 +105,13 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
);
},
),
BlocBuilder<GridTabBarBloc, GridTabBarState>(
BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
return pageSettingBarExtensionFromState(state);
},
),
Expanded(
child: BlocBuilder<GridTabBarBloc, GridTabBarState>(
child: BlocBuilder<DatabaseTabBarBloc, DatabaseTabBarState>(
builder: (context, state) {
return PageView(
pageSnapping: false,
@ -128,7 +128,7 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
);
}
List<Widget> pageContentFromState(GridTabBarState state) {
List<Widget> pageContentFromState(DatabaseTabBarState state) {
return state.tabBars.map((tabBar) {
final controller =
state.tabBarControllerByViewId[tabBar.viewId]!.controller;
@ -141,7 +141,7 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
}).toList();
}
Widget pageSettingBarExtensionFromState(GridTabBarState state) {
Widget pageSettingBarExtensionFromState(DatabaseTabBarState state) {
if (state.tabBars.length < state.selectedIndex) {
return const SizedBox.shrink();
}

View File

@ -2,7 +2,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/plugins/database_view/board/presentation/board_page.dart';
import 'package:appflowy/plugins/database_view/calendar/presentation/calendar_page.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart';
import 'package:appflowy/plugins/database_view/tar_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart';
import 'package:appflowy/plugins/document/document.dart';
import 'package:appflowy/startup/plugin/plugin.dart';
import 'package:appflowy/workspace/application/view/view_service.dart';