Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix(flutter-moile): edit primary field from database controls (#6591)
Richard Shiue7141e9d8cf9a
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/option_text_field.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/option_text_field.dartindex f72038e8a6..20ea4bc5f4 100644--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/option_text_field.dart+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/option_text_field.dart@@ -11,12 +11,14 @@ class OptionTextField extends StatelessWidget {const OptionTextField({super.key,required this.controller,+ required this.isPrimary,required this.fieldType,required this.onTextChanged,required this.onFieldTypeChanged,});final TextEditingController controller;+ final bool isPrimary;final FieldType fieldType;final void Function(String value) onTextChanged;final void Function(FieldType value) onFieldTypeChanged;@@ -29,6 +31,9 @@ class OptionTextField extends StatelessWidget {onTextChanged: onTextChanged,leftIcon: GestureDetector(onTap: () async {+ if (isPrimary) {+ return;+ }final fieldType = await showFieldTypeGridBottomSheet(context,title: LocaleKeys.grid_field_editProperty.tr(),diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_full_field_editor.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_full_field_editor.dartindex c7454263c1..02c8c12b80 100644--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_full_field_editor.dart+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_full_field_editor.dart@@ -225,6 +225,7 @@ class _MobileFieldEditorState extends State<MobileFieldEditor> {OptionTextField(controller: controller,fieldType: values.type,+ isPrimary: widget.isPrimary,onTextChanged: (value) {isFieldNameChanged = true;_updateOptionValues(name: value);diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_quick_field_editor.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_quick_field_editor.dartindex ca43434e4d..f2b90e9c0d 100644--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_quick_field_editor.dart+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_quick_field_editor.dart@@ -76,6 +76,7 @@ class _QuickEditFieldState extends State<QuickEditField> {const VSpace(16),OptionTextField(controller: controller,+ isPrimary: state.field.isPrimary,fieldType: state.field.fieldType,onTextChanged: (text) {contextdiff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dartindex cc0493a019..9543a4593b 100644--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart@@ -13,7 +13,6 @@ import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extenimport 'package:appflowy/workspace/application/view/view_bloc.dart';import 'package:collection/collection.dart';import 'package:easy_localization/easy_localization.dart';-import 'package:flowy_infra_ui/flowy_infra_ui.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';@@ -79,14 +78,12 @@ class _MobileDatabaseFieldListBody extends StatelessWidget {viewId: viewId,fieldController: databaseController.fieldController,fieldInfo: field,- index: index,showTopBorder: false,),).toList();return ReorderableListView.builder(- padding: EdgeInsets.zero,proxyDecorator: (_, index, anim) {final field = fields[index];return AnimatedBuilder(@@ -103,7 +100,6 @@ class _MobileDatabaseFieldListBody extends StatelessWidget {viewId: viewId,fieldController: databaseController.fieldController,fieldInfo: field,- index: index,showTopBorder: true,),),@@ -121,43 +117,32 @@ class _MobileDatabaseFieldListBody extends StatelessWidget {},header: firstCell,footer: canCreate- ? Column(- mainAxisSize: MainAxisSize.min,- children: [- _divider(),- _NewDatabaseFieldTile(viewId: viewId),- VSpace(- context.bottomSheetPadding(- ignoreViewPadding: false,- ),- ),- ],+ ? Padding(+ padding: const EdgeInsets.only(top: 20),+ child: _NewDatabaseFieldTile(viewId: viewId),)- : VSpace(- context.bottomSheetPadding(ignoreViewPadding: false),- ),+ : null,itemCount: cells.length,itemBuilder: (context, index) => cells[index],+ padding: EdgeInsets.only(+ bottom: context.bottomSheetPadding(ignoreViewPadding: false),+ ),);},),);}-- Widget _divider() => const VSpace(20);}class DatabaseFieldListTile extends StatelessWidget {const DatabaseFieldListTile({super.key,- this.index,required this.fieldInfo,required this.viewId,required this.fieldController,required this.showTopBorder,});- final int? index;final FieldInfo fieldInfo;final String viewId;final FieldController fieldController;@@ -172,6 +157,7 @@ class DatabaseFieldListTile extends StatelessWidget {fieldInfo: fieldInfo,dimension: 20,),+ onTap: () => showEditFieldScreen(context, viewId, fieldInfo),showTopBorder: showTopBorder,);} else {diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dartindex cdc984e4b7..8dba996d05 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart@@ -1,7 +1,6 @@import 'package:flutter/material.dart';import 'package:provider/provider.dart';-import '../accessory/cell_shortcuts.dart';import '../../cell/editable_cell_builder.dart';import 'cell_container.dart';@@ -24,7 +23,7 @@ class MobileCellContainer extends StatelessWidget {child: Selector<CellContainerNotifier, bool>(selector: (context, notifier) => notifier.isFocus,builder: (providerContext, isFocus, _) {- Widget container = Center(child: GridCellShortcuts(child: child));+ Widget container = Center(child: child);if (isPrimary) {container = IgnorePointer(child: container);