mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: auto width for view action
This commit is contained in:
parent
a4b08e4f46
commit
b2d2e071bd
@ -106,8 +106,11 @@ class _SettingItem extends StatelessWidget {
|
|||||||
height: 30,
|
height: 30,
|
||||||
child: FlowyButton(
|
child: FlowyButton(
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
text: FlowyText.medium(action.title(),
|
text: FlowyText.medium(
|
||||||
fontSize: 12, color: theme.textColor),
|
action.title(),
|
||||||
|
fontSize: 12,
|
||||||
|
color: theme.textColor,
|
||||||
|
),
|
||||||
hoverColor: theme.hover,
|
hoverColor: theme.hover,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context
|
context
|
||||||
|
@ -61,12 +61,20 @@ class ActionList {
|
|||||||
itemBuilder: (context, index) => items[index],
|
itemBuilder: (context, index) => items[index],
|
||||||
anchorContext: anchorContext,
|
anchorContext: anchorContext,
|
||||||
anchorDirection: AnchorDirection.bottomRight,
|
anchorDirection: AnchorDirection.bottomRight,
|
||||||
constraints: BoxConstraints.tight(const Size(120, 80)),
|
constraints: BoxConstraints(
|
||||||
|
minWidth: 120,
|
||||||
|
maxWidth: 280,
|
||||||
|
minHeight: items.length * (CreateItem.height),
|
||||||
|
maxHeight: items.length * (CreateItem.height),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CreateItem extends StatelessWidget {
|
class CreateItem extends StatelessWidget {
|
||||||
|
static const double height = 30;
|
||||||
|
static const double verticalPadding = 6;
|
||||||
|
|
||||||
final PluginBuilder pluginBuilder;
|
final PluginBuilder pluginBuilder;
|
||||||
final Function(PluginBuilder) onSelected;
|
final Function(PluginBuilder) onSelected;
|
||||||
const CreateItem({
|
const CreateItem({
|
||||||
@ -85,11 +93,20 @@ class CreateItem extends StatelessWidget {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () => onSelected(pluginBuilder),
|
onTap: () => onSelected(pluginBuilder),
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(
|
||||||
|
minWidth: 120,
|
||||||
|
minHeight: CreateItem.height,
|
||||||
|
),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
child: FlowyText.medium(
|
child: FlowyText.medium(
|
||||||
pluginBuilder.menuName,
|
pluginBuilder.menuName,
|
||||||
color: theme.textColor,
|
color: theme.textColor,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
).padding(horizontal: 10, vertical: 6),
|
).padding(horizontal: 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class ViewSectionItem extends StatelessWidget {
|
|||||||
_handleAction(context, action);
|
_handleAction(context, action);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => onSelected(context.read<ViewBloc>().state.view),
|
onTap: () => onSelected(context.read<ViewBloc>().state.view),
|
||||||
child: FlowyHover(
|
child: FlowyHover(
|
||||||
@ -75,11 +75,16 @@ class ViewSectionItem extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
child: state.view.renderThumbnail(iconColor: iconColor)),
|
child: state.view.renderThumbnail(iconColor: iconColor),
|
||||||
|
),
|
||||||
const HSpace(2),
|
const HSpace(2),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: FlowyText.regular(state.view.name,
|
child: FlowyText.regular(
|
||||||
fontSize: 12, overflow: TextOverflow.clip)),
|
state.view.name,
|
||||||
|
fontSize: 12,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (onHover || state.isEditing) {
|
if (onHover || state.isEditing) {
|
||||||
|
@ -178,7 +178,7 @@ class FlowyVersionDescription extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
).padding(
|
).padding(
|
||||||
horizontal: ActionListSizes.itemHPadding + ActionListSizes.padding,
|
horizontal: ActionListSizes.itemHPadding + ActionListSizes.hPadding,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const CircularProgressIndicator();
|
return const CircularProgressIndicator();
|
||||||
|
@ -49,8 +49,8 @@ abstract class ActionList<T extends ActionItem> {
|
|||||||
anchorContext: anchorContext ?? buildContext,
|
anchorContext: anchorContext ?? buildContext,
|
||||||
anchorDirection: anchorDirection,
|
anchorDirection: anchorDirection,
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minHeight: items.length * (itemHeight + ActionListSizes.padding * 2),
|
minHeight: items.length * (itemHeight + ActionListSizes.vPadding * 2),
|
||||||
maxHeight: items.length * (itemHeight + ActionListSizes.padding * 2),
|
maxHeight: items.length * (itemHeight + ActionListSizes.vPadding * 2),
|
||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth,
|
||||||
minWidth: minWidth,
|
minWidth: minWidth,
|
||||||
),
|
),
|
||||||
@ -69,7 +69,8 @@ abstract class ActionItem {
|
|||||||
class ActionListSizes {
|
class ActionListSizes {
|
||||||
static double itemHPadding = 10;
|
static double itemHPadding = 10;
|
||||||
static double itemHeight = 20;
|
static double itemHeight = 20;
|
||||||
static double padding = 6;
|
static double vPadding = 6;
|
||||||
|
static double hPadding = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActionCell<T extends ActionItem> extends StatelessWidget {
|
class ActionCell<T extends ActionItem> extends StatelessWidget {
|
||||||
@ -104,8 +105,8 @@ class ActionCell<T extends ActionItem> extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
).padding(
|
).padding(
|
||||||
horizontal: ActionListSizes.padding,
|
horizontal: ActionListSizes.hPadding,
|
||||||
vertical: ActionListSizes.padding,
|
vertical: ActionListSizes.vPadding,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -30,7 +30,7 @@ class AppFlowyPopover extends StatelessWidget {
|
|||||||
this.offset,
|
this.offset,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.asBarrier = false,
|
this.asBarrier = false,
|
||||||
this.margin = const EdgeInsets.all(12),
|
this.margin = const EdgeInsets.all(6),
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -60,7 +60,7 @@ class ListOverlay extends StatelessWidget {
|
|||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: IntrinsicWidth(
|
child: IntrinsicWidth(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
...children,
|
...children,
|
||||||
if (footer != null)
|
if (footer != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user