chore: fix typo: pannel -> panel

This commit is contained in:
appflowy 2022-08-09 11:59:22 +08:00
parent 6d385e811f
commit 9e090b0183
14 changed files with 138 additions and 118 deletions

View File

@ -1,8 +1,10 @@
part of 'cell_service.dart'; part of 'cell_service.dart';
typedef GridCellController = IGridCellController<String, String>; typedef GridCellController = IGridCellController<String, String>;
typedef GridSelectOptionCellController = IGridCellController<SelectOptionCellDataPB, String>; typedef GridSelectOptionCellController
typedef GridDateCellController = IGridCellController<DateCellDataPB, CalendarData>; = IGridCellController<SelectOptionCellDataPB, String>;
typedef GridDateCellController
= IGridCellController<DateCellDataPB, CalendarData>;
typedef GridURLCellController = IGridCellController<URLCellDataPB, String>; typedef GridURLCellController = IGridCellController<URLCellDataPB, String>;
class GridCellControllerBuilder { class GridCellControllerBuilder {
@ -19,7 +21,8 @@ class GridCellControllerBuilder {
_cellId = cellId; _cellId = cellId;
IGridCellController build() { IGridCellController build() {
final cellFieldNotifier = GridCellFieldNotifier(notifier: _GridFieldChangedNotifierImpl(_fieldCache)); final cellFieldNotifier = GridCellFieldNotifier(
notifier: _GridFieldChangedNotifierImpl(_fieldCache));
switch (_cellId.fieldType) { switch (_cellId.fieldType) {
case FieldType.Checkbox: case FieldType.Checkbox:
@ -142,8 +145,10 @@ class IGridCellController<T, D> extends Equatable {
_cellDataLoader = cellDataLoader, _cellDataLoader = cellDataLoader,
_cellDataPersistence = cellDataPersistence, _cellDataPersistence = cellDataPersistence,
_fieldNotifier = fieldNotifier, _fieldNotifier = fieldNotifier,
_fieldService = FieldService(gridId: cellId.gridId, fieldId: cellId.field.id), _fieldService =
_cacheKey = GridCellCacheKey(rowId: cellId.rowId, fieldId: cellId.field.id); FieldService(gridId: cellId.gridId, fieldId: cellId.field.id),
_cacheKey =
GridCellCacheKey(rowId: cellId.rowId, fieldId: cellId.field.id);
IGridCellController<T, D> clone() { IGridCellController<T, D> clone() {
return IGridCellController( return IGridCellController(
@ -164,7 +169,9 @@ class IGridCellController<T, D> extends Equatable {
FieldType get fieldType => cellId.field.fieldType; FieldType get fieldType => cellId.field.fieldType;
VoidCallback? startListening({required void Function(T?) onCellChanged, VoidCallback? onCellFieldChanged}) { VoidCallback? startListening(
{required void Function(T?) onCellChanged,
VoidCallback? onCellFieldChanged}) {
if (isListening) { if (isListening) {
Log.error("Already started. It seems like you should call clone first"); Log.error("Already started. It seems like you should call clone first");
return null; return null;
@ -226,8 +233,11 @@ class IGridCellController<T, D> extends Equatable {
/// Return the FieldTypeOptionDataPB that can be parsed into corresponding class using the [parser]. /// Return the FieldTypeOptionDataPB that can be parsed into corresponding class using the [parser].
/// [PD] is the type that the parser return. /// [PD] is the type that the parser return.
Future<Either<PD, FlowyError>> getFieldTypeOption<PD, P extends TypeOptionDataParser>(P parser) { Future<Either<PD, FlowyError>>
return _fieldService.getFieldTypeOptionData(fieldType: fieldType).then((result) { getFieldTypeOption<PD, P extends TypeOptionDataParser>(P parser) {
return _fieldService
.getFieldTypeOptionData(fieldType: fieldType)
.then((result) {
return result.fold( return result.fold(
(data) => parser.fromBuffer(data.typeOptionData), (data) => parser.fromBuffer(data.typeOptionData),
(err) => right(err), (err) => right(err),
@ -239,7 +249,9 @@ class IGridCellController<T, D> extends Equatable {
/// You can set [dedeplicate] to true (default is false) to reduce the save operation. /// You can set [dedeplicate] to true (default is false) to reduce the save operation.
/// It's useful when you call this method when user editing the [TextField]. /// It's useful when you call this method when user editing the [TextField].
/// The default debounce interval is 300 milliseconds. /// The default debounce interval is 300 milliseconds.
void saveCellData(D data, {bool deduplicate = false, void Function(Option<FlowyError>)? resultCallback}) async { void saveCellData(D data,
{bool deduplicate = false,
void Function(Option<FlowyError>)? resultCallback}) async {
if (deduplicate) { if (deduplicate) {
_loadDataOperation?.cancel(); _loadDataOperation?.cancel();
@ -288,7 +300,8 @@ class IGridCellController<T, D> extends Equatable {
} }
@override @override
List<Object> get props => [_cellsCache.get(_cacheKey) ?? "", cellId.rowId + cellId.field.id]; List<Object> get props =>
[_cellsCache.get(_cacheKey) ?? "", cellId.rowId + cellId.field.id];
} }
class _GridFieldChangedNotifierImpl extends GridFieldChangedNotifier { class _GridFieldChangedNotifierImpl extends GridFieldChangedNotifier {
@ -300,7 +313,7 @@ class _GridFieldChangedNotifierImpl extends GridFieldChangedNotifier {
@override @override
void dispose() { void dispose() {
if (_onChangesetFn != null) { if (_onChangesetFn != null) {
_cache.removeListener(onChangsetListener: _onChangesetFn!); _cache.removeListener(onChangesetListener: _onChangesetFn!);
_onChangesetFn = null; _onChangesetFn = null;
} }
} }

View File

@ -1,6 +1,6 @@
import 'dart:collection'; import 'dart:collection';
import 'package:app_flowy/plugins/grid/application/field/grid_listenr.dart'; import 'package:app_flowy/plugins/grid/application/field/grid_listener.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/dispatch/dispatch.dart'; import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/log.dart';
@ -132,7 +132,7 @@ class GridFieldCache {
void removeListener({ void removeListener({
FieldsCallback? onFieldsListener, FieldsCallback? onFieldsListener,
FieldChangesetCallback? onChangsetListener, FieldChangesetCallback? onChangesetListener,
}) { }) {
if (onFieldsListener != null) { if (onFieldsListener != null) {
final fn = _fieldsCallbackMap.remove(onFieldsListener); final fn = _fieldsCallbackMap.remove(onFieldsListener);
@ -141,8 +141,8 @@ class GridFieldCache {
} }
} }
if (onChangsetListener != null) { if (onChangesetListener != null) {
_changesetCallbackMap.remove(onChangsetListener); _changesetCallbackMap.remove(onChangesetListener);
} }
} }
@ -225,7 +225,7 @@ class GridRowCacheFieldNotifierImpl extends GridRowCacheFieldNotifier {
} }
if (_onChangesetFn != null) { if (_onChangesetFn != null) {
_cache.removeListener(onChangsetListener: _onChangesetFn!); _cache.removeListener(onChangesetListener: _onChangesetFn!);
_onChangesetFn = null; _onChangesetFn = null;
} }
} }

View File

@ -113,7 +113,6 @@ class CellEnterRegion extends StatelessWidget {
class CellContainerNotifier extends ChangeNotifier { class CellContainerNotifier extends ChangeNotifier {
final CellEditable cellEditable; final CellEditable cellEditable;
bool mouted = false;
VoidCallback? _onCellFocusListener; VoidCallback? _onCellFocusListener;
bool _isFocus = false; bool _isFocus = false;
bool _onEnter = false; bool _onEnter = false;

View File

@ -6,7 +6,7 @@ import 'package:app_flowy/plugins/doc/application/prelude.dart';
import 'package:app_flowy/plugins/grid/application/prelude.dart'; import 'package:app_flowy/plugins/grid/application/prelude.dart';
import 'package:app_flowy/workspace/application/user/prelude.dart'; import 'package:app_flowy/workspace/application/user/prelude.dart';
import 'package:app_flowy/workspace/application/workspace/prelude.dart'; import 'package:app_flowy/workspace/application/workspace/prelude.dart';
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart'; import 'package:app_flowy/workspace/application/edit_panel/edit_panel_bloc.dart';
import 'package:app_flowy/workspace/application/view/prelude.dart'; import 'package:app_flowy/workspace/application/view/prelude.dart';
import 'package:app_flowy/workspace/application/menu/prelude.dart'; import 'package:app_flowy/workspace/application/menu/prelude.dart';
import 'package:app_flowy/workspace/application/settings/prelude.dart'; import 'package:app_flowy/workspace/application/settings/prelude.dart';
@ -43,7 +43,7 @@ void _resolveUserDeps(GetIt getIt) {
getIt.registerFactory<SignUpBloc>(() => SignUpBloc(getIt<AuthService>())); getIt.registerFactory<SignUpBloc>(() => SignUpBloc(getIt<AuthService>()));
getIt.registerFactory<SplashRoute>(() => SplashRoute()); getIt.registerFactory<SplashRoute>(() => SplashRoute());
getIt.registerFactory<EditPannelBloc>(() => EditPannelBloc()); getIt.registerFactory<EditPanelBloc>(() => EditPanelBloc());
getIt.registerFactory<SplashBloc>(() => SplashBloc()); getIt.registerFactory<SplashBloc>(() => SplashBloc());
getIt.registerLazySingleton<NetworkListener>(() => NetworkListener()); getIt.registerLazySingleton<NetworkListener>(() => NetworkListener());
} }

View File

@ -1,11 +1,12 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
abstract class EditPannelContext extends Equatable { abstract class EditPanelContext extends Equatable {
final String identifier; final String identifier;
final String title; final String title;
final Widget child; final Widget child;
const EditPannelContext({required this.child, required this.identifier, required this.title}); const EditPanelContext(
{required this.child, required this.identifier, required this.title});
@override @override
List<Object> get props => [identifier]; List<Object> get props => [identifier];

View File

@ -0,0 +1,41 @@
import 'package:app_flowy/workspace/application/edit_panel/edit_context.dart';
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
part 'edit_panel_bloc.freezed.dart';
class EditPanelBloc extends Bloc<EditPanelEvent, EditPanelState> {
EditPanelBloc() : super(EditPanelState.initial()) {
on<EditPanelEvent>((event, emit) async {
await event.map(
startEdit: (e) async {
emit(state.copyWith(isEditing: true, editContext: some(e.context)));
},
endEdit: (value) async {
emit(state.copyWith(isEditing: false, editContext: none()));
},
);
});
}
}
@freezed
class EditPanelEvent with _$EditPanelEvent {
const factory EditPanelEvent.startEdit(EditPanelContext context) = _StartEdit;
const factory EditPanelEvent.endEdit(EditPanelContext context) = _EndEdit;
}
@freezed
class EditPanelState with _$EditPanelState {
const factory EditPanelState({
required bool isEditing,
required Option<EditPanelContext> editContext,
}) = _EditPanelState;
factory EditPanelState.initial() => EditPanelState(
isEditing: false,
editContext: none(),
);
}

View File

@ -1,41 +0,0 @@
import 'package:app_flowy/workspace/application/edit_pannel/edit_context.dart';
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
part 'edit_pannel_bloc.freezed.dart';
class EditPannelBloc extends Bloc<EditPannelEvent, EditPannelState> {
EditPannelBloc() : super(EditPannelState.initial()) {
on<EditPannelEvent>((event, emit) async {
await event.map(
startEdit: (e) async {
emit(state.copyWith(isEditing: true, editContext: some(e.context)));
},
endEdit: (value) async {
emit(state.copyWith(isEditing: false, editContext: none()));
},
);
});
}
}
@freezed
class EditPannelEvent with _$EditPannelEvent {
const factory EditPannelEvent.startEdit(EditPannelContext context) = _StartEdit;
const factory EditPannelEvent.endEdit(EditPannelContext context) = _EndEdit;
}
@freezed
class EditPannelState with _$EditPannelState {
const factory EditPannelState({
required bool isEditing,
required Option<EditPannelContext> editContext,
}) = _EditPannelState;
factory EditPannelState.initial() => EditPannelState(
isEditing: false,
editContext: none(),
);
}

View File

@ -1,9 +1,10 @@
import 'package:app_flowy/user/application/user_listener.dart'; import 'package:app_flowy/user/application/user_listener.dart';
import 'package:app_flowy/workspace/application/edit_pannel/edit_context.dart'; import 'package:app_flowy/workspace/application/edit_panel/edit_context.dart';
import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/log.dart';
import 'package:flowy_sdk/protobuf/flowy-error-code/code.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-error-code/code.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder/workspace.pb.dart' show CurrentWorkspaceSettingPB; import 'package:flowy_sdk/protobuf/flowy-folder/workspace.pb.dart'
show CurrentWorkspaceSettingPB;
import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
@ -24,7 +25,8 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
onAuthChanged: (result) => _authDidChanged(result), onAuthChanged: (result) => _authDidChanged(result),
onSettingUpdated: (result) { onSettingUpdated: (result) {
result.fold( result.fold(
(setting) => add(HomeEvent.didReceiveWorkspaceSetting(setting)), (setting) =>
add(HomeEvent.didReceiveWorkspaceSetting(setting)),
(r) => Log.error(r), (r) => Log.error(r),
); );
}, },
@ -33,11 +35,11 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
showLoading: (e) async { showLoading: (e) async {
emit(state.copyWith(isLoading: e.isLoading)); emit(state.copyWith(isLoading: e.isLoading));
}, },
setEditPannel: (e) async { setEditPanel: (e) async {
emit(state.copyWith(pannelContext: some(e.editContext))); emit(state.copyWith(panelContext: some(e.editContext)));
}, },
dismissEditPannel: (value) async { dismissEditPanel: (value) async {
emit(state.copyWith(pannelContext: none())); emit(state.copyWith(panelContext: none()));
}, },
forceCollapse: (e) async { forceCollapse: (e) async {
emit(state.copyWith(forceCollapse: e.forceCollapse)); emit(state.copyWith(forceCollapse: e.forceCollapse));
@ -51,8 +53,9 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
collapseMenu: (e) { collapseMenu: (e) {
emit(state.copyWith(isMenuCollapsed: !state.isMenuCollapsed)); emit(state.copyWith(isMenuCollapsed: !state.isMenuCollapsed));
}, },
editPannelResized: (e) { editPanelResized: (e) {
final newOffset = (state.resizeOffset + e.offset).clamp(-50, 200).toDouble(); final newOffset =
(state.resizeOffset + e.offset).clamp(-50, 200).toDouble();
emit(state.copyWith(resizeOffset: newOffset)); emit(state.copyWith(resizeOffset: newOffset));
}, },
); );
@ -80,12 +83,14 @@ class HomeEvent with _$HomeEvent {
const factory HomeEvent.initial() = _Initial; const factory HomeEvent.initial() = _Initial;
const factory HomeEvent.showLoading(bool isLoading) = _ShowLoading; const factory HomeEvent.showLoading(bool isLoading) = _ShowLoading;
const factory HomeEvent.forceCollapse(bool forceCollapse) = _ForceCollapse; const factory HomeEvent.forceCollapse(bool forceCollapse) = _ForceCollapse;
const factory HomeEvent.setEditPannel(EditPannelContext editContext) = _ShowEditPannel; const factory HomeEvent.setEditPanel(EditPanelContext editContext) =
const factory HomeEvent.dismissEditPannel() = _DismissEditPannel; _ShowEditPanel;
const factory HomeEvent.didReceiveWorkspaceSetting(CurrentWorkspaceSettingPB setting) = _DidReceiveWorkspaceSetting; const factory HomeEvent.dismissEditPanel() = _DismissEditPanel;
const factory HomeEvent.didReceiveWorkspaceSetting(
CurrentWorkspaceSettingPB setting) = _DidReceiveWorkspaceSetting;
const factory HomeEvent.unauthorized(String msg) = _Unauthorized; const factory HomeEvent.unauthorized(String msg) = _Unauthorized;
const factory HomeEvent.collapseMenu() = _CollapseMenu; const factory HomeEvent.collapseMenu() = _CollapseMenu;
const factory HomeEvent.editPannelResized(double offset) = _EditPannelResized; const factory HomeEvent.editPanelResized(double offset) = _EditPanelResized;
} }
@freezed @freezed
@ -93,17 +98,18 @@ class HomeState with _$HomeState {
const factory HomeState({ const factory HomeState({
required bool isLoading, required bool isLoading,
required bool forceCollapse, required bool forceCollapse,
required Option<EditPannelContext> pannelContext, required Option<EditPanelContext> panelContext,
required CurrentWorkspaceSettingPB workspaceSetting, required CurrentWorkspaceSettingPB workspaceSetting,
required bool unauthorized, required bool unauthorized,
required bool isMenuCollapsed, required bool isMenuCollapsed,
required double resizeOffset, required double resizeOffset,
}) = _HomeState; }) = _HomeState;
factory HomeState.initial(CurrentWorkspaceSettingPB workspaceSetting) => HomeState( factory HomeState.initial(CurrentWorkspaceSettingPB workspaceSetting) =>
HomeState(
isLoading: false, isLoading: false,
forceCollapse: false, forceCollapse: false,
pannelContext: none(), panelContext: none(),
workspaceSetting: workspaceSetting, workspaceSetting: workspaceSetting,
unauthorized: false, unauthorized: false,
isMenuCollapsed: false, isMenuCollapsed: false,

View File

@ -11,16 +11,17 @@ import 'home_sizes.dart';
class HomeLayout { class HomeLayout {
late double menuWidth; late double menuWidth;
late bool showMenu; late bool showMenu;
late bool showEditPannel; late bool showEditPanel;
late double editPannelWidth; late double editPanelWidth;
late double homePageLOffset; late double homePageLOffset;
late double homePageROffset; late double homePageROffset;
late Duration animDuration; late Duration animDuration;
HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint, bool forceCollapse) { HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint,
bool forceCollapse) {
final homeBlocState = context.read<HomeBloc>().state; final homeBlocState = context.read<HomeBloc>().state;
showEditPannel = homeBlocState.pannelContext.isSome(); showEditPanel = homeBlocState.panelContext.isSome();
menuWidth = Sizes.sideBarMed; menuWidth = Sizes.sideBarMed;
if (context.widthPx >= PageBreaks.desktop) { if (context.widthPx >= PageBreaks.desktop) {
@ -38,7 +39,7 @@ class HomeLayout {
homePageLOffset = showMenu ? menuWidth : 0.0; homePageLOffset = showMenu ? menuWidth : 0.0;
animDuration = .35.seconds; animDuration = .35.seconds;
editPannelWidth = HomeSizes.editPannelWidth; editPanelWidth = HomeSizes.editPanelWidth;
homePageROffset = showEditPannel ? editPannelWidth : 0; homePageROffset = showEditPanel ? editPanelWidth : 0;
} }
} }

View File

@ -1,6 +1,6 @@
import 'package:app_flowy/startup/plugin/plugin.dart'; import 'package:app_flowy/startup/plugin/plugin.dart';
import 'package:app_flowy/workspace/application/home/home_bloc.dart'; import 'package:app_flowy/workspace/application/home/home_bloc.dart';
import 'package:app_flowy/workspace/presentation/widgets/edit_pannel/pannel_animation.dart'; import 'package:app_flowy/workspace/presentation/widgets/edit_panel/panel_animation.dart';
import 'package:app_flowy/workspace/presentation/widgets/float_bubble/question_bubble.dart'; import 'package:app_flowy/workspace/presentation/widgets/float_bubble/question_bubble.dart';
import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/startup/startup.dart';
import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/log.dart';
@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import '../widgets/edit_pannel/edit_pannel.dart'; import '../widgets/edit_panel/edit_panel.dart';
import 'home_layout.dart'; import 'home_layout.dart';
import 'home_stack.dart'; import 'home_stack.dart';
@ -64,9 +64,9 @@ class _HomeScreenState extends State<HomeScreen> {
child: BlocBuilder<HomeBloc, HomeState>( child: BlocBuilder<HomeBloc, HomeState>(
buildWhen: (previous, current) => previous != current, buildWhen: (previous, current) => previous != current,
builder: (context, state) { builder: (context, state) {
final collapasedNotifier = final collapsedNotifier =
getIt<HomeStackManager>().collapsedNotifier; getIt<HomeStackManager>().collapsedNotifier;
collapasedNotifier.addPublishListener((isCollapsed) { collapsedNotifier.addPublishListener((isCollapsed) {
context context
.read<HomeBloc>() .read<HomeBloc>()
.add(HomeEvent.forceCollapse(isCollapsed)); .add(HomeEvent.forceCollapse(isCollapsed));
@ -94,7 +94,7 @@ class _HomeScreenState extends State<HomeScreen> {
state: state, state: state,
); );
final homeMenuResizer = _buildHomeMenuResizer(context: context); final homeMenuResizer = _buildHomeMenuResizer(context: context);
final editPannel = _buildEditPannel( final editPanel = _buildEditPanel(
homeState: state, homeState: state,
layout: layout, layout: layout,
context: context, context: context,
@ -104,7 +104,7 @@ class _HomeScreenState extends State<HomeScreen> {
layout: layout, layout: layout,
homeStack: homeStack, homeStack: homeStack,
homeMenu: menu, homeMenu: menu,
editPannel: editPannel, editPanel: editPanel,
bubble: bubble, bubble: bubble,
homeMenuResizer: homeMenuResizer, homeMenuResizer: homeMenuResizer,
); );
@ -142,23 +142,23 @@ class _HomeScreenState extends State<HomeScreen> {
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu)); return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
} }
Widget _buildEditPannel( Widget _buildEditPanel(
{required HomeState homeState, {required HomeState homeState,
required BuildContext context, required BuildContext context,
required HomeLayout layout}) { required HomeLayout layout}) {
final homeBloc = context.read<HomeBloc>(); final homeBloc = context.read<HomeBloc>();
return BlocBuilder<HomeBloc, HomeState>( return BlocBuilder<HomeBloc, HomeState>(
buildWhen: (previous, current) => buildWhen: (previous, current) =>
previous.pannelContext != current.pannelContext, previous.panelContext != current.panelContext,
builder: (context, state) { builder: (context, state) {
return state.pannelContext.fold( return state.panelContext.fold(
() => const SizedBox(), () => const SizedBox(),
(pannelContext) => FocusTraversalGroup( (panelContext) => FocusTraversalGroup(
child: RepaintBoundary( child: RepaintBoundary(
child: EditPannel( child: EditPanel(
pannelContext: pannelContext, panelContext: panelContext,
onEndEdit: () => onEndEdit: () =>
homeBloc.add(const HomeEvent.dismissEditPannel()), homeBloc.add(const HomeEvent.dismissEditPanel()),
), ),
), ),
), ),
@ -177,7 +177,7 @@ class _HomeScreenState extends State<HomeScreen> {
onPanUpdate: ((details) { onPanUpdate: ((details) {
context context
.read<HomeBloc>() .read<HomeBloc>()
.add(HomeEvent.editPannelResized(details.delta.dx)); .add(HomeEvent.editPanelResized(details.delta.dx));
}), }),
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
child: SizedBox( child: SizedBox(
@ -191,7 +191,7 @@ class _HomeScreenState extends State<HomeScreen> {
required HomeLayout layout, required HomeLayout layout,
required Widget homeMenu, required Widget homeMenu,
required Widget homeStack, required Widget homeStack,
required Widget editPannel, required Widget editPanel,
required Widget bubble, required Widget bubble,
required Widget homeMenuResizer, required Widget homeMenuResizer,
}) { }) {
@ -226,14 +226,14 @@ class _HomeScreenState extends State<HomeScreen> {
animate: true, animate: true,
) )
.animate(layout.animDuration, Curves.easeOut), .animate(layout.animDuration, Curves.easeOut),
editPannel editPanel
.animatedPanelX( .animatedPanelX(
duration: layout.animDuration.inMilliseconds * 0.001, duration: layout.animDuration.inMilliseconds * 0.001,
closeX: layout.editPannelWidth, closeX: layout.editPanelWidth,
isClosed: !layout.showEditPannel, isClosed: !layout.showEditPanel,
) )
.positioned( .positioned(
right: 0, top: 0, bottom: 0, width: layout.editPannelWidth), right: 0, top: 0, bottom: 0, width: layout.editPanelWidth),
], ],
); );
} }

View File

@ -1,8 +1,8 @@
class HomeSizes { class HomeSizes {
static double get menuAddButtonHeight => 60; static double get menuAddButtonHeight => 60;
static double get topBarHeight => 60; static double get topBarHeight => 60;
static double get editPannelTopBarHeight => 60; static double get editPanelTopBarHeight => 60;
static double get editPannelWidth => 400; static double get editPanelWidth => 400;
} }
class HomeInsets { class HomeInsets {

View File

@ -1,5 +1,5 @@
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart'; import 'package:app_flowy/workspace/application/edit_panel/edit_panel_bloc.dart';
import 'package:app_flowy/workspace/application/edit_pannel/edit_context.dart'; import 'package:app_flowy/workspace/application/edit_panel/edit_context.dart';
import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/presentation/home/home_sizes.dart'; import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
@ -9,12 +9,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:app_flowy/generated/locale_keys.g.dart'; import 'package:app_flowy/generated/locale_keys.g.dart';
class EditPannel extends StatelessWidget { class EditPanel extends StatelessWidget {
final EditPannelContext pannelContext; final EditPanelContext panelContext;
final VoidCallback onEndEdit; final VoidCallback onEndEdit;
const EditPannel({ const EditPanel({
Key? key, Key? key,
required this.pannelContext, required this.panelContext,
required this.onEndEdit, required this.onEndEdit,
}) : super(key: key); }) : super(key: key);
@ -23,15 +23,15 @@ class EditPannel extends StatelessWidget {
return Container( return Container(
color: Theme.of(context).colorScheme.secondary, color: Theme.of(context).colorScheme.secondary,
child: BlocProvider( child: BlocProvider(
create: (context) => getIt<EditPannelBloc>(), create: (context) => getIt<EditPanelBloc>(),
child: BlocBuilder<EditPannelBloc, EditPannelState>( child: BlocBuilder<EditPanelBloc, EditPanelState>(
builder: (context, state) { builder: (context, state) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
EditPannelTopBar(onClose: () => onEndEdit()), EditPanelTopBar(onClose: () => onEndEdit()),
Expanded( Expanded(
child: pannelContext.child, child: panelContext.child,
), ),
], ],
); );
@ -42,13 +42,13 @@ class EditPannel extends StatelessWidget {
} }
} }
class EditPannelTopBar extends StatelessWidget { class EditPanelTopBar extends StatelessWidget {
final VoidCallback onClose; final VoidCallback onClose;
const EditPannelTopBar({Key? key, required this.onClose}) : super(key: key); const EditPanelTopBar({Key? key, required this.onClose}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(
height: HomeSizes.editPannelTopBarHeight, height: HomeSizes.editPanelTopBarHeight,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(