mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: auto size filter menu (#1552)
Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
@ -62,7 +62,7 @@ class GridCreateFilterBloc
|
|||||||
final List<FieldInfo> allFields = List.from(fields);
|
final List<FieldInfo> allFields = List.from(fields);
|
||||||
final keyword = filterText.toLowerCase();
|
final keyword = filterText.toLowerCase();
|
||||||
allFields.retainWhere((field) {
|
allFields.retainWhere((field) {
|
||||||
if (field.canCreateFilter) {
|
if (!field.canCreateFilter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,21 +54,26 @@ class GridFilterMenu extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildFilterItems(String viewId, GridFilterMenuState state) {
|
Widget buildFilterItems(String viewId, GridFilterMenuState state) {
|
||||||
final List<Widget> children = state.filters
|
final List<Widget> children = [];
|
||||||
|
children.addAll(
|
||||||
|
state.filters
|
||||||
.map((filterInfo) => FilterMenuItem(filterInfo: filterInfo))
|
.map((filterInfo) => FilterMenuItem(filterInfo: filterInfo))
|
||||||
.toList();
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (state.creatableFields.isNotEmpty) {
|
||||||
|
children.add(AddFilterButton(viewId: viewId));
|
||||||
|
}
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
SingleChildScrollView(
|
Expanded(
|
||||||
controller: ScrollController(),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: 4,
|
spacing: 6,
|
||||||
|
runSpacing: 4,
|
||||||
children: children,
|
children: children,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const HSpace(4),
|
|
||||||
if (state.creatableFields.isNotEmpty) AddFilterButton(viewId: viewId),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class FlowyButton extends StatelessWidget {
|
|||||||
required this.text,
|
required this.text,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.onHover,
|
this.onHover,
|
||||||
this.margin = const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
this.margin = const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||||||
this.leftIcon,
|
this.leftIcon,
|
||||||
this.rightIcon,
|
this.rightIcon,
|
||||||
this.hoverColor,
|
this.hoverColor,
|
||||||
@ -63,9 +63,9 @@ class FlowyButton extends StatelessWidget {
|
|||||||
children.add(Expanded(child: text));
|
children.add(Expanded(child: text));
|
||||||
|
|
||||||
if (rightIcon != null) {
|
if (rightIcon != null) {
|
||||||
children.add(const HSpace(6));
|
children.add(const HSpace(10));
|
||||||
children.add(
|
// No need to define the size of rightIcon. Just use its intrinsic width
|
||||||
SizedBox.fromSize(size: const Size.square(16), child: rightIcon!));
|
children.add(rightIcon!);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget child = Row(
|
Widget child = Row(
|
||||||
|
Reference in New Issue
Block a user