Skip to content

Commit 882043e

Browse files
authored
Merge pull request #1160 from AppFlowy-IO/fix/view_action_auto_width
fix: auto width for view action
2 parents bc5f0c2 + b2d2e07 commit 882043e

File tree

7 files changed

+48
-22
lines changed

7 files changed

+48
-22
lines changed

frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_setting.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ class _SettingItem extends StatelessWidget {
106106
height: 30,
107107
child: FlowyButton(
108108
isSelected: isSelected,
109-
text: FlowyText.medium(action.title(),
110-
fontSize: 12, color: theme.textColor),
109+
text: FlowyText.medium(
110+
action.title(),
111+
fontSize: 12,
112+
color: theme.textColor,
113+
),
111114
hoverColor: theme.hover,
112115
onTap: () {
113116
context

frontend/app_flowy/lib/workspace/presentation/home/menu/app/header/add_button.dart

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,20 @@ class ActionList {
6161
itemBuilder: (context, index) => items[index],
6262
anchorContext: anchorContext,
6363
anchorDirection: AnchorDirection.bottomRight,
64-
constraints: BoxConstraints.tight(const Size(120, 80)),
64+
constraints: BoxConstraints(
65+
minWidth: 120,
66+
maxWidth: 280,
67+
minHeight: items.length * (CreateItem.height),
68+
maxHeight: items.length * (CreateItem.height),
69+
),
6570
);
6671
}
6772
}
6873

6974
class CreateItem extends StatelessWidget {
75+
static const double height = 30;
76+
static const double verticalPadding = 6;
77+
7078
final PluginBuilder pluginBuilder;
7179
final Function(PluginBuilder) onSelected;
7280
const CreateItem({
@@ -85,11 +93,20 @@ class CreateItem extends StatelessWidget {
8593
child: GestureDetector(
8694
behavior: HitTestBehavior.opaque,
8795
onTap: () => onSelected(pluginBuilder),
88-
child: FlowyText.medium(
89-
pluginBuilder.menuName,
90-
color: theme.textColor,
91-
fontSize: 12,
92-
).padding(horizontal: 10, vertical: 6),
96+
child: ConstrainedBox(
97+
constraints: const BoxConstraints(
98+
minWidth: 120,
99+
minHeight: CreateItem.height,
100+
),
101+
child: Align(
102+
alignment: Alignment.centerLeft,
103+
child: FlowyText.medium(
104+
pluginBuilder.menuName,
105+
color: theme.textColor,
106+
fontSize: 12,
107+
).padding(horizontal: 10),
108+
),
109+
),
93110
),
94111
);
95112
}

frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ViewSectionItem extends StatelessWidget {
5353
_handleAction(context, action);
5454
},
5555
child: Padding(
56-
padding: const EdgeInsets.symmetric(vertical: 4),
56+
padding: const EdgeInsets.symmetric(vertical: 2),
5757
child: InkWell(
5858
onTap: () => onSelected(context.read<ViewBloc>().state.view),
5959
child: FlowyHover(
@@ -73,13 +73,18 @@ class ViewSectionItem extends StatelessWidget {
7373
BuildContext context, bool onHover, ViewState state, Color iconColor) {
7474
List<Widget> children = [
7575
SizedBox(
76-
width: 16,
77-
height: 16,
78-
child: state.view.renderThumbnail(iconColor: iconColor)),
76+
width: 16,
77+
height: 16,
78+
child: state.view.renderThumbnail(iconColor: iconColor),
79+
),
7980
const HSpace(2),
8081
Expanded(
81-
child: FlowyText.regular(state.view.name,
82-
fontSize: 12, overflow: TextOverflow.clip)),
82+
child: FlowyText.regular(
83+
state.view.name,
84+
fontSize: 12,
85+
overflow: TextOverflow.clip,
86+
),
87+
),
8388
];
8489

8590
if (onHover || state.isEditing) {

frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class FlowyVersionDescription extends StatelessWidget {
178178
),
179179
],
180180
).padding(
181-
horizontal: ActionListSizes.itemHPadding + ActionListSizes.padding,
181+
horizontal: ActionListSizes.itemHPadding + ActionListSizes.hPadding,
182182
);
183183
} else {
184184
return const CircularProgressIndicator();

frontend/app_flowy/lib/workspace/presentation/widgets/pop_up_action.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ abstract class ActionList<T extends ActionItem> {
4949
anchorContext: anchorContext ?? buildContext,
5050
anchorDirection: anchorDirection,
5151
constraints: BoxConstraints(
52-
minHeight: items.length * (itemHeight + ActionListSizes.padding * 2),
53-
maxHeight: items.length * (itemHeight + ActionListSizes.padding * 2),
52+
minHeight: items.length * (itemHeight + ActionListSizes.vPadding * 2),
53+
maxHeight: items.length * (itemHeight + ActionListSizes.vPadding * 2),
5454
maxWidth: maxWidth,
5555
minWidth: minWidth,
5656
),
@@ -69,7 +69,8 @@ abstract class ActionItem {
6969
class ActionListSizes {
7070
static double itemHPadding = 10;
7171
static double itemHeight = 20;
72-
static double padding = 6;
72+
static double vPadding = 6;
73+
static double hPadding = 10;
7374
}
7475

7576
class ActionCell<T extends ActionItem> extends StatelessWidget {
@@ -104,8 +105,8 @@ class ActionCell<T extends ActionItem> extends StatelessWidget {
104105
],
105106
),
106107
).padding(
107-
horizontal: ActionListSizes.padding,
108-
vertical: ActionListSizes.padding,
108+
horizontal: ActionListSizes.hPadding,
109+
vertical: ActionListSizes.vPadding,
109110
),
110111
),
111112
);

frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/appflowy_popover.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AppFlowyPopover extends StatelessWidget {
3030
this.offset,
3131
this.controller,
3232
this.asBarrier = false,
33-
this.margin = const EdgeInsets.all(12),
33+
this.margin = const EdgeInsets.all(6),
3434
}) : super(key: key);
3535

3636
@override

frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/list_overlay.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ListOverlay extends StatelessWidget {
6060
scrollDirection: Axis.horizontal,
6161
child: IntrinsicWidth(
6262
child: Column(
63-
mainAxisSize: MainAxisSize.min,
63+
mainAxisSize: MainAxisSize.max,
6464
children: [
6565
...children,
6666
if (footer != null)

0 commit comments

Comments
 (0)