|
@@ -1,5 +1,6 @@
|
|
|
import 'package:app_flowy/startup/startup.dart';
|
|
|
import 'package:app_flowy/workspace/application/grid/field/field_service.dart';
|
|
|
+import 'package:app_flowy/workspace/application/grid/grid_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/grid/setting/property_bloc.dart';
|
|
|
import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.dart';
|
|
|
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart';
|
|
@@ -18,10 +19,10 @@ import 'package:styled_widget/styled_widget.dart';
|
|
|
|
|
|
class GridPropertyList extends StatelessWidget with FlowyOverlayDelegate {
|
|
|
final String gridId;
|
|
|
- final List<Field> fields;
|
|
|
+ final GridFieldCache fieldCache;
|
|
|
const GridPropertyList({
|
|
|
required this.gridId,
|
|
|
- required this.fields,
|
|
|
+ required this.fieldCache,
|
|
|
Key? key,
|
|
|
}) : super(key: key);
|
|
|
|
|
@@ -43,7 +44,7 @@ class GridPropertyList extends StatelessWidget with FlowyOverlayDelegate {
|
|
|
Widget build(BuildContext context) {
|
|
|
return BlocProvider(
|
|
|
create: (context) =>
|
|
|
- getIt<GridPropertyBloc>(param1: gridId, param2: fields)..add(const GridPropertyEvent.initial()),
|
|
|
+ getIt<GridPropertyBloc>(param1: gridId, param2: fieldCache)..add(const GridPropertyEvent.initial()),
|
|
|
child: BlocBuilder<GridPropertyBloc, GridPropertyState>(
|
|
|
builder: (context, state) {
|
|
|
final cells = state.fields.map((field) {
|
|
@@ -91,17 +92,7 @@ class _GridPropertyCell extends StatelessWidget {
|
|
|
Expanded(
|
|
|
child: SizedBox(
|
|
|
height: GridSize.typeOptionItemHeight,
|
|
|
- child: FlowyButton(
|
|
|
- text: FlowyText.medium(field.name, fontSize: 12),
|
|
|
- hoverColor: theme.hover,
|
|
|
- leftIcon: svgWidget(field.fieldType.iconName(), color: theme.iconColor),
|
|
|
- onTap: () {
|
|
|
- FieldEditor(
|
|
|
- gridId: gridId,
|
|
|
- fieldContextLoader: FieldContextLoaderAdaptor(gridId: gridId, field: field),
|
|
|
- ).show(context, anchorDirection: AnchorDirection.bottomRight);
|
|
|
- },
|
|
|
- ),
|
|
|
+ child: _editFieldButton(theme, context),
|
|
|
),
|
|
|
),
|
|
|
FlowyIconButton(
|
|
@@ -115,4 +106,18 @@ class _GridPropertyCell extends StatelessWidget {
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ FlowyButton _editFieldButton(AppTheme theme, BuildContext context) {
|
|
|
+ return FlowyButton(
|
|
|
+ text: FlowyText.medium(field.name, fontSize: 12),
|
|
|
+ hoverColor: theme.hover,
|
|
|
+ leftIcon: svgWidget(field.fieldType.iconName(), color: theme.iconColor),
|
|
|
+ onTap: () {
|
|
|
+ FieldEditor(
|
|
|
+ gridId: gridId,
|
|
|
+ fieldContextLoader: FieldContextLoaderAdaptor(gridId: gridId, field: field),
|
|
|
+ ).show(context, anchorDirection: AnchorDirection.bottomRight);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|