|
@@ -36,7 +36,9 @@ class ViewSectionItem extends StatelessWidget {
|
|
final theme = context.watch<AppTheme>();
|
|
final theme = context.watch<AppTheme>();
|
|
return MultiBlocProvider(
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
providers: [
|
|
- BlocProvider(create: (ctx) => getIt<ViewBloc>(param1: view)..add(const ViewEvent.initial())),
|
|
|
|
|
|
+ BlocProvider(
|
|
|
|
+ create: (ctx) =>
|
|
|
|
+ getIt<ViewBloc>(param1: view)..add(const ViewEvent.initial())),
|
|
],
|
|
],
|
|
child: BlocBuilder<ViewBloc, ViewState>(
|
|
child: BlocBuilder<ViewBloc, ViewState>(
|
|
builder: (context, state) {
|
|
builder: (context, state) {
|
|
@@ -46,7 +48,8 @@ class ViewSectionItem extends StatelessWidget {
|
|
onTap: () => onSelected(context.read<ViewBloc>().state.view),
|
|
onTap: () => onSelected(context.read<ViewBloc>().state.view),
|
|
child: FlowyHover(
|
|
child: FlowyHover(
|
|
style: HoverStyle(hoverColor: theme.bg3),
|
|
style: HoverStyle(hoverColor: theme.bg3),
|
|
- builder: (_, onHover) => _render(context, onHover, state, theme.iconColor),
|
|
|
|
|
|
+ builder: (_, onHover) =>
|
|
|
|
+ _render(context, onHover, state, theme.iconColor),
|
|
setSelected: () => state.isEditing || isSelected,
|
|
setSelected: () => state.isEditing || isSelected,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
@@ -56,17 +59,24 @@ class ViewSectionItem extends StatelessWidget {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- Widget _render(BuildContext context, bool onHover, ViewState state, Color iconColor) {
|
|
|
|
|
|
+ Widget _render(
|
|
|
|
+ BuildContext context, bool onHover, ViewState state, Color iconColor) {
|
|
List<Widget> children = [
|
|
List<Widget> children = [
|
|
- SizedBox(width: 16, height: 16, child: state.view.renderThumbnail(iconColor: iconColor)),
|
|
|
|
|
|
+ SizedBox(
|
|
|
|
+ width: 16,
|
|
|
|
+ height: 16,
|
|
|
|
+ child: state.view.renderThumbnail(iconColor: iconColor)),
|
|
const HSpace(2),
|
|
const HSpace(2),
|
|
- Expanded(child: FlowyText.regular(state.view.name, fontSize: 12, overflow: TextOverflow.clip)),
|
|
|
|
|
|
+ Expanded(
|
|
|
|
+ child: FlowyText.regular(state.view.name,
|
|
|
|
+ fontSize: 12, overflow: TextOverflow.clip)),
|
|
];
|
|
];
|
|
|
|
|
|
if (onHover || state.isEditing) {
|
|
if (onHover || state.isEditing) {
|
|
children.add(
|
|
children.add(
|
|
ViewDisclosureButton(
|
|
ViewDisclosureButton(
|
|
- onTap: () => context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
|
|
|
|
|
|
+ onTap: () =>
|
|
|
|
+ context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
|
|
onSelected: (action) {
|
|
onSelected: (action) {
|
|
context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
|
|
context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
|
|
_handleAction(context, action);
|
|
_handleAction(context, action);
|
|
@@ -75,16 +85,23 @@ class ViewSectionItem extends StatelessWidget {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- return SizedBox(
|
|
|
|
- height: 26,
|
|
|
|
- child: Row(children: children).padding(
|
|
|
|
- left: MenuAppSizes.expandedPadding,
|
|
|
|
- right: MenuAppSizes.headerPadding,
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
|
|
+ return ViewDisclosureRegion(
|
|
|
|
+ // context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
|
|
|
|
+ onSelected: (action) {
|
|
|
|
+ context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
|
|
|
|
+ _handleAction(context, action);
|
|
|
|
+ },
|
|
|
|
+ child: SizedBox(
|
|
|
|
+ height: 26,
|
|
|
|
+ child: Row(children: children).padding(
|
|
|
|
+ left: MenuAppSizes.expandedPadding,
|
|
|
|
+ right: MenuAppSizes.headerPadding,
|
|
|
|
+ ),
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
|
|
|
|
- void _handleAction(BuildContext context, dartz.Option<ViewDisclosureAction> action) {
|
|
|
|
|
|
+ void _handleAction(
|
|
|
|
+ BuildContext context, dartz.Option<ViewDisclosureAction> action) {
|
|
action.foldRight({}, (action, previous) {
|
|
action.foldRight({}, (action, previous) {
|
|
switch (action) {
|
|
switch (action) {
|
|
case ViewDisclosureAction.rename:
|
|
case ViewDisclosureAction.rename:
|