mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: edit the field by clicking on the drag icon (#3656)
* feat: edit the field by clicking on the drag icon * Added localization * Added .tr() function * fix: BlockActionButton only show when _isFieldHover is true. * fix: BlockActionButton only show when _isFieldHover is true. * fix: Worked on requested changes * fix: Fixed Location of Field Popover * fixed pubspec.lock * Updated pubspec.lock --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
parent
62f1d6eb82
commit
59851f46b7
@ -9,6 +9,7 @@ import 'package:appflowy/plugins/database_view/grid/application/row/row_detail_b
|
|||||||
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_cell.dart';
|
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_cell.dart';
|
||||||
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_editor.dart';
|
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_editor.dart';
|
||||||
import 'package:appflowy/plugins/database_view/widgets/row/cells/cells.dart';
|
import 'package:appflowy/plugins/database_view/widgets/row/cells/cells.dart';
|
||||||
|
import 'package:appflowy/plugins/document/presentation/editor_plugins/actions/block_action_button.dart';
|
||||||
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
|
import 'package:appflowy/workspace/presentation/widgets/dialogs.dart';
|
||||||
import 'package:appflowy_backend/log.dart';
|
import 'package:appflowy_backend/log.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
|
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
|
||||||
@ -112,6 +113,7 @@ class RowPropertyList extends StatelessWidget {
|
|||||||
class _PropertyCell extends StatefulWidget {
|
class _PropertyCell extends StatefulWidget {
|
||||||
final DatabaseCellContext cellContext;
|
final DatabaseCellContext cellContext;
|
||||||
final GridCellBuilder cellBuilder;
|
final GridCellBuilder cellBuilder;
|
||||||
|
|
||||||
final int index;
|
final int index;
|
||||||
const _PropertyCell({
|
const _PropertyCell({
|
||||||
required this.cellContext,
|
required this.cellContext,
|
||||||
@ -126,6 +128,8 @@ class _PropertyCell extends StatefulWidget {
|
|||||||
|
|
||||||
class _PropertyCellState extends State<_PropertyCell> {
|
class _PropertyCellState extends State<_PropertyCell> {
|
||||||
final PopoverController _popoverController = PopoverController();
|
final PopoverController _popoverController = PopoverController();
|
||||||
|
final PopoverController _fieldPopoverController = PopoverController();
|
||||||
|
|
||||||
bool _isFieldHover = false;
|
bool _isFieldHover = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -140,7 +144,23 @@ class _PropertyCellState extends State<_PropertyCell> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: _isFieldHover ? const FlowySvg(FlowySvgs.drag_element_s) : null,
|
child: AppFlowyPopover(
|
||||||
|
controller: _fieldPopoverController,
|
||||||
|
constraints: BoxConstraints.loose(const Size(240, 600)),
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
triggerActions: PopoverTriggerFlags.none,
|
||||||
|
direction: PopoverDirection.bottomWithLeftAligned,
|
||||||
|
popupBuilder: (popoverContext) => buildFieldEditor(),
|
||||||
|
child: _isFieldHover
|
||||||
|
? BlockActionButton(
|
||||||
|
onTap: () => _fieldPopoverController.show(),
|
||||||
|
svg: FlowySvgs.drag_element_s,
|
||||||
|
richMessage: TextSpan(
|
||||||
|
text: LocaleKeys.grid_rowPage_fieldDragEelementTooltip.tr(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1890,4 +1890,4 @@ packages:
|
|||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.0.0 <4.0.0"
|
dart: ">=3.0.0 <4.0.0"
|
||||||
flutter: ">=3.10.1"
|
flutter: ">=3.10.1"
|
@ -476,6 +476,7 @@
|
|||||||
},
|
},
|
||||||
"rowPage": {
|
"rowPage": {
|
||||||
"newField": "Add a new field",
|
"newField": "Add a new field",
|
||||||
|
"fieldDragEelementTooltip": "Click to open menu",
|
||||||
"showHiddenFields": {
|
"showHiddenFields": {
|
||||||
"one": "Show {} hidden field",
|
"one": "Show {} hidden field",
|
||||||
"many": "Show {} hidden fields",
|
"many": "Show {} hidden fields",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user