mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix typo: pannel -> panel
This commit is contained in:
parent
6d385e811f
commit
9e090b0183
@ -1,8 +1,10 @@
|
||||
part of 'cell_service.dart';
|
||||
|
||||
typedef GridCellController = IGridCellController<String, String>;
|
||||
typedef GridSelectOptionCellController = IGridCellController<SelectOptionCellDataPB, String>;
|
||||
typedef GridDateCellController = IGridCellController<DateCellDataPB, CalendarData>;
|
||||
typedef GridSelectOptionCellController
|
||||
= IGridCellController<SelectOptionCellDataPB, String>;
|
||||
typedef GridDateCellController
|
||||
= IGridCellController<DateCellDataPB, CalendarData>;
|
||||
typedef GridURLCellController = IGridCellController<URLCellDataPB, String>;
|
||||
|
||||
class GridCellControllerBuilder {
|
||||
@ -19,7 +21,8 @@ class GridCellControllerBuilder {
|
||||
_cellId = cellId;
|
||||
|
||||
IGridCellController build() {
|
||||
final cellFieldNotifier = GridCellFieldNotifier(notifier: _GridFieldChangedNotifierImpl(_fieldCache));
|
||||
final cellFieldNotifier = GridCellFieldNotifier(
|
||||
notifier: _GridFieldChangedNotifierImpl(_fieldCache));
|
||||
|
||||
switch (_cellId.fieldType) {
|
||||
case FieldType.Checkbox:
|
||||
@ -142,8 +145,10 @@ class IGridCellController<T, D> extends Equatable {
|
||||
_cellDataLoader = cellDataLoader,
|
||||
_cellDataPersistence = cellDataPersistence,
|
||||
_fieldNotifier = fieldNotifier,
|
||||
_fieldService = FieldService(gridId: cellId.gridId, fieldId: cellId.field.id),
|
||||
_cacheKey = GridCellCacheKey(rowId: cellId.rowId, fieldId: cellId.field.id);
|
||||
_fieldService =
|
||||
FieldService(gridId: cellId.gridId, fieldId: cellId.field.id),
|
||||
_cacheKey =
|
||||
GridCellCacheKey(rowId: cellId.rowId, fieldId: cellId.field.id);
|
||||
|
||||
IGridCellController<T, D> clone() {
|
||||
return IGridCellController(
|
||||
@ -164,7 +169,9 @@ class IGridCellController<T, D> extends Equatable {
|
||||
|
||||
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) {
|
||||
Log.error("Already started. It seems like you should call clone first");
|
||||
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].
|
||||
/// [PD] is the type that the parser return.
|
||||
Future<Either<PD, FlowyError>> getFieldTypeOption<PD, P extends TypeOptionDataParser>(P parser) {
|
||||
return _fieldService.getFieldTypeOptionData(fieldType: fieldType).then((result) {
|
||||
Future<Either<PD, FlowyError>>
|
||||
getFieldTypeOption<PD, P extends TypeOptionDataParser>(P parser) {
|
||||
return _fieldService
|
||||
.getFieldTypeOptionData(fieldType: fieldType)
|
||||
.then((result) {
|
||||
return result.fold(
|
||||
(data) => parser.fromBuffer(data.typeOptionData),
|
||||
(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.
|
||||
/// It's useful when you call this method when user editing the [TextField].
|
||||
/// 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) {
|
||||
_loadDataOperation?.cancel();
|
||||
|
||||
@ -288,7 +300,8 @@ class IGridCellController<T, D> extends Equatable {
|
||||
}
|
||||
|
||||
@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 {
|
||||
@ -300,7 +313,7 @@ class _GridFieldChangedNotifierImpl extends GridFieldChangedNotifier {
|
||||
@override
|
||||
void dispose() {
|
||||
if (_onChangesetFn != null) {
|
||||
_cache.removeListener(onChangsetListener: _onChangesetFn!);
|
||||
_cache.removeListener(onChangesetListener: _onChangesetFn!);
|
||||
_onChangesetFn = null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
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:flowy_sdk/dispatch/dispatch.dart';
|
||||
import 'package:flowy_sdk/log.dart';
|
||||
@ -132,7 +132,7 @@ class GridFieldCache {
|
||||
|
||||
void removeListener({
|
||||
FieldsCallback? onFieldsListener,
|
||||
FieldChangesetCallback? onChangsetListener,
|
||||
FieldChangesetCallback? onChangesetListener,
|
||||
}) {
|
||||
if (onFieldsListener != null) {
|
||||
final fn = _fieldsCallbackMap.remove(onFieldsListener);
|
||||
@ -141,8 +141,8 @@ class GridFieldCache {
|
||||
}
|
||||
}
|
||||
|
||||
if (onChangsetListener != null) {
|
||||
_changesetCallbackMap.remove(onChangsetListener);
|
||||
if (onChangesetListener != null) {
|
||||
_changesetCallbackMap.remove(onChangesetListener);
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ class GridRowCacheFieldNotifierImpl extends GridRowCacheFieldNotifier {
|
||||
}
|
||||
|
||||
if (_onChangesetFn != null) {
|
||||
_cache.removeListener(onChangsetListener: _onChangesetFn!);
|
||||
_cache.removeListener(onChangesetListener: _onChangesetFn!);
|
||||
_onChangesetFn = null;
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,6 @@ class CellEnterRegion extends StatelessWidget {
|
||||
|
||||
class CellContainerNotifier extends ChangeNotifier {
|
||||
final CellEditable cellEditable;
|
||||
bool mouted = false;
|
||||
VoidCallback? _onCellFocusListener;
|
||||
bool _isFocus = false;
|
||||
bool _onEnter = false;
|
||||
|
@ -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/workspace/application/user/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/menu/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<SplashRoute>(() => SplashRoute());
|
||||
getIt.registerFactory<EditPannelBloc>(() => EditPannelBloc());
|
||||
getIt.registerFactory<EditPanelBloc>(() => EditPanelBloc());
|
||||
getIt.registerFactory<SplashBloc>(() => SplashBloc());
|
||||
getIt.registerLazySingleton<NetworkListener>(() => NetworkListener());
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
abstract class EditPannelContext extends Equatable {
|
||||
abstract class EditPanelContext extends Equatable {
|
||||
final String identifier;
|
||||
final String title;
|
||||
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
|
||||
List<Object> get props => [identifier];
|
@ -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(),
|
||||
);
|
||||
}
|
@ -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(),
|
||||
);
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
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/protobuf/flowy-error-code/code.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:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@ -24,7 +25,8 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
onAuthChanged: (result) => _authDidChanged(result),
|
||||
onSettingUpdated: (result) {
|
||||
result.fold(
|
||||
(setting) => add(HomeEvent.didReceiveWorkspaceSetting(setting)),
|
||||
(setting) =>
|
||||
add(HomeEvent.didReceiveWorkspaceSetting(setting)),
|
||||
(r) => Log.error(r),
|
||||
);
|
||||
},
|
||||
@ -33,11 +35,11 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
showLoading: (e) async {
|
||||
emit(state.copyWith(isLoading: e.isLoading));
|
||||
},
|
||||
setEditPannel: (e) async {
|
||||
emit(state.copyWith(pannelContext: some(e.editContext)));
|
||||
setEditPanel: (e) async {
|
||||
emit(state.copyWith(panelContext: some(e.editContext)));
|
||||
},
|
||||
dismissEditPannel: (value) async {
|
||||
emit(state.copyWith(pannelContext: none()));
|
||||
dismissEditPanel: (value) async {
|
||||
emit(state.copyWith(panelContext: none()));
|
||||
},
|
||||
forceCollapse: (e) async {
|
||||
emit(state.copyWith(forceCollapse: e.forceCollapse));
|
||||
@ -51,8 +53,9 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
collapseMenu: (e) {
|
||||
emit(state.copyWith(isMenuCollapsed: !state.isMenuCollapsed));
|
||||
},
|
||||
editPannelResized: (e) {
|
||||
final newOffset = (state.resizeOffset + e.offset).clamp(-50, 200).toDouble();
|
||||
editPanelResized: (e) {
|
||||
final newOffset =
|
||||
(state.resizeOffset + e.offset).clamp(-50, 200).toDouble();
|
||||
emit(state.copyWith(resizeOffset: newOffset));
|
||||
},
|
||||
);
|
||||
@ -80,12 +83,14 @@ class HomeEvent with _$HomeEvent {
|
||||
const factory HomeEvent.initial() = _Initial;
|
||||
const factory HomeEvent.showLoading(bool isLoading) = _ShowLoading;
|
||||
const factory HomeEvent.forceCollapse(bool forceCollapse) = _ForceCollapse;
|
||||
const factory HomeEvent.setEditPannel(EditPannelContext editContext) = _ShowEditPannel;
|
||||
const factory HomeEvent.dismissEditPannel() = _DismissEditPannel;
|
||||
const factory HomeEvent.didReceiveWorkspaceSetting(CurrentWorkspaceSettingPB setting) = _DidReceiveWorkspaceSetting;
|
||||
const factory HomeEvent.setEditPanel(EditPanelContext editContext) =
|
||||
_ShowEditPanel;
|
||||
const factory HomeEvent.dismissEditPanel() = _DismissEditPanel;
|
||||
const factory HomeEvent.didReceiveWorkspaceSetting(
|
||||
CurrentWorkspaceSettingPB setting) = _DidReceiveWorkspaceSetting;
|
||||
const factory HomeEvent.unauthorized(String msg) = _Unauthorized;
|
||||
const factory HomeEvent.collapseMenu() = _CollapseMenu;
|
||||
const factory HomeEvent.editPannelResized(double offset) = _EditPannelResized;
|
||||
const factory HomeEvent.editPanelResized(double offset) = _EditPanelResized;
|
||||
}
|
||||
|
||||
@freezed
|
||||
@ -93,17 +98,18 @@ class HomeState with _$HomeState {
|
||||
const factory HomeState({
|
||||
required bool isLoading,
|
||||
required bool forceCollapse,
|
||||
required Option<EditPannelContext> pannelContext,
|
||||
required Option<EditPanelContext> panelContext,
|
||||
required CurrentWorkspaceSettingPB workspaceSetting,
|
||||
required bool unauthorized,
|
||||
required bool isMenuCollapsed,
|
||||
required double resizeOffset,
|
||||
}) = _HomeState;
|
||||
|
||||
factory HomeState.initial(CurrentWorkspaceSettingPB workspaceSetting) => HomeState(
|
||||
factory HomeState.initial(CurrentWorkspaceSettingPB workspaceSetting) =>
|
||||
HomeState(
|
||||
isLoading: false,
|
||||
forceCollapse: false,
|
||||
pannelContext: none(),
|
||||
panelContext: none(),
|
||||
workspaceSetting: workspaceSetting,
|
||||
unauthorized: false,
|
||||
isMenuCollapsed: false,
|
||||
|
@ -11,16 +11,17 @@ import 'home_sizes.dart';
|
||||
class HomeLayout {
|
||||
late double menuWidth;
|
||||
late bool showMenu;
|
||||
late bool showEditPannel;
|
||||
late double editPannelWidth;
|
||||
late bool showEditPanel;
|
||||
late double editPanelWidth;
|
||||
late double homePageLOffset;
|
||||
late double homePageROffset;
|
||||
late Duration animDuration;
|
||||
|
||||
HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint, bool forceCollapse) {
|
||||
HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint,
|
||||
bool forceCollapse) {
|
||||
final homeBlocState = context.read<HomeBloc>().state;
|
||||
|
||||
showEditPannel = homeBlocState.pannelContext.isSome();
|
||||
showEditPanel = homeBlocState.panelContext.isSome();
|
||||
|
||||
menuWidth = Sizes.sideBarMed;
|
||||
if (context.widthPx >= PageBreaks.desktop) {
|
||||
@ -38,7 +39,7 @@ class HomeLayout {
|
||||
homePageLOffset = showMenu ? menuWidth : 0.0;
|
||||
animDuration = .35.seconds;
|
||||
|
||||
editPannelWidth = HomeSizes.editPannelWidth;
|
||||
homePageROffset = showEditPannel ? editPannelWidth : 0;
|
||||
editPanelWidth = HomeSizes.editPanelWidth;
|
||||
homePageROffset = showEditPanel ? editPanelWidth : 0;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:app_flowy/startup/plugin/plugin.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/startup/startup.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: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_stack.dart';
|
||||
@ -64,9 +64,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: BlocBuilder<HomeBloc, HomeState>(
|
||||
buildWhen: (previous, current) => previous != current,
|
||||
builder: (context, state) {
|
||||
final collapasedNotifier =
|
||||
final collapsedNotifier =
|
||||
getIt<HomeStackManager>().collapsedNotifier;
|
||||
collapasedNotifier.addPublishListener((isCollapsed) {
|
||||
collapsedNotifier.addPublishListener((isCollapsed) {
|
||||
context
|
||||
.read<HomeBloc>()
|
||||
.add(HomeEvent.forceCollapse(isCollapsed));
|
||||
@ -94,7 +94,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
state: state,
|
||||
);
|
||||
final homeMenuResizer = _buildHomeMenuResizer(context: context);
|
||||
final editPannel = _buildEditPannel(
|
||||
final editPanel = _buildEditPanel(
|
||||
homeState: state,
|
||||
layout: layout,
|
||||
context: context,
|
||||
@ -104,7 +104,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
layout: layout,
|
||||
homeStack: homeStack,
|
||||
homeMenu: menu,
|
||||
editPannel: editPannel,
|
||||
editPanel: editPanel,
|
||||
bubble: bubble,
|
||||
homeMenuResizer: homeMenuResizer,
|
||||
);
|
||||
@ -142,23 +142,23 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
|
||||
}
|
||||
|
||||
Widget _buildEditPannel(
|
||||
Widget _buildEditPanel(
|
||||
{required HomeState homeState,
|
||||
required BuildContext context,
|
||||
required HomeLayout layout}) {
|
||||
final homeBloc = context.read<HomeBloc>();
|
||||
return BlocBuilder<HomeBloc, HomeState>(
|
||||
buildWhen: (previous, current) =>
|
||||
previous.pannelContext != current.pannelContext,
|
||||
previous.panelContext != current.panelContext,
|
||||
builder: (context, state) {
|
||||
return state.pannelContext.fold(
|
||||
return state.panelContext.fold(
|
||||
() => const SizedBox(),
|
||||
(pannelContext) => FocusTraversalGroup(
|
||||
(panelContext) => FocusTraversalGroup(
|
||||
child: RepaintBoundary(
|
||||
child: EditPannel(
|
||||
pannelContext: pannelContext,
|
||||
child: EditPanel(
|
||||
panelContext: panelContext,
|
||||
onEndEdit: () =>
|
||||
homeBloc.add(const HomeEvent.dismissEditPannel()),
|
||||
homeBloc.add(const HomeEvent.dismissEditPanel()),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -177,7 +177,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
onPanUpdate: ((details) {
|
||||
context
|
||||
.read<HomeBloc>()
|
||||
.add(HomeEvent.editPannelResized(details.delta.dx));
|
||||
.add(HomeEvent.editPanelResized(details.delta.dx));
|
||||
}),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: SizedBox(
|
||||
@ -191,7 +191,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
required HomeLayout layout,
|
||||
required Widget homeMenu,
|
||||
required Widget homeStack,
|
||||
required Widget editPannel,
|
||||
required Widget editPanel,
|
||||
required Widget bubble,
|
||||
required Widget homeMenuResizer,
|
||||
}) {
|
||||
@ -226,14 +226,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
animate: true,
|
||||
)
|
||||
.animate(layout.animDuration, Curves.easeOut),
|
||||
editPannel
|
||||
editPanel
|
||||
.animatedPanelX(
|
||||
duration: layout.animDuration.inMilliseconds * 0.001,
|
||||
closeX: layout.editPannelWidth,
|
||||
isClosed: !layout.showEditPannel,
|
||||
closeX: layout.editPanelWidth,
|
||||
isClosed: !layout.showEditPanel,
|
||||
)
|
||||
.positioned(
|
||||
right: 0, top: 0, bottom: 0, width: layout.editPannelWidth),
|
||||
right: 0, top: 0, bottom: 0, width: layout.editPanelWidth),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
class HomeSizes {
|
||||
static double get menuAddButtonHeight => 60;
|
||||
static double get topBarHeight => 60;
|
||||
static double get editPannelTopBarHeight => 60;
|
||||
static double get editPannelWidth => 400;
|
||||
static double get editPanelTopBarHeight => 60;
|
||||
static double get editPanelWidth => 400;
|
||||
}
|
||||
|
||||
class HomeInsets {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';
|
||||
import 'package:app_flowy/workspace/application/edit_pannel/edit_context.dart';
|
||||
import 'package:app_flowy/workspace/application/edit_panel/edit_panel_bloc.dart';
|
||||
import 'package:app_flowy/workspace/application/edit_panel/edit_context.dart';
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/workspace/presentation/home/home_sizes.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:app_flowy/generated/locale_keys.g.dart';
|
||||
|
||||
class EditPannel extends StatelessWidget {
|
||||
final EditPannelContext pannelContext;
|
||||
class EditPanel extends StatelessWidget {
|
||||
final EditPanelContext panelContext;
|
||||
final VoidCallback onEndEdit;
|
||||
const EditPannel({
|
||||
const EditPanel({
|
||||
Key? key,
|
||||
required this.pannelContext,
|
||||
required this.panelContext,
|
||||
required this.onEndEdit,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -23,15 +23,15 @@ class EditPannel extends StatelessWidget {
|
||||
return Container(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
child: BlocProvider(
|
||||
create: (context) => getIt<EditPannelBloc>(),
|
||||
child: BlocBuilder<EditPannelBloc, EditPannelState>(
|
||||
create: (context) => getIt<EditPanelBloc>(),
|
||||
child: BlocBuilder<EditPanelBloc, EditPanelState>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
EditPannelTopBar(onClose: () => onEndEdit()),
|
||||
EditPanelTopBar(onClose: () => onEndEdit()),
|
||||
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;
|
||||
const EditPannelTopBar({Key? key, required this.onClose}) : super(key: key);
|
||||
const EditPanelTopBar({Key? key, required this.onClose}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: HomeSizes.editPannelTopBarHeight,
|
||||
height: HomeSizes.editPanelTopBarHeight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
Loading…
Reference in New Issue
Block a user