Skip to content

Commit 627b8ab

Browse files
richardshiueLucasXu0
authored andcommitted
fix(flutter_mobile): linked grid cannot be displayed in document (#7162)
1 parent 84d55b5 commit 627b8ab

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart

+18-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:appflowy/plugins/database/application/database_controller.dart';
55
import 'package:appflowy/plugins/database/application/field/field_info.dart';
66
import 'package:appflowy/plugins/database/application/row/row_service.dart';
77
import 'package:appflowy/plugins/database/grid/application/grid_bloc.dart';
8-
import 'package:appflowy/plugins/database/grid/presentation/widgets/shortcuts.dart';
98
import 'package:appflowy/plugins/database/tab_bar/tab_bar_view.dart';
109
import 'package:appflowy/shared/flowy_error_page.dart';
1110
import 'package:appflowy/startup/startup.dart';
@@ -42,6 +41,7 @@ class MobileGridTabBarBuilderImpl extends DatabaseTabBarItemBuilder {
4241
view: view,
4342
databaseController: controller,
4443
initialRowId: initialRowId,
44+
shrinkWrap: shrinkWrap,
4545
);
4646
}
4747

@@ -68,12 +68,14 @@ class MobileGridPage extends StatefulWidget {
6868
required this.databaseController,
6969
this.onDeleted,
7070
this.initialRowId,
71+
this.shrinkWrap = false,
7172
});
7273

7374
final ViewPB view;
7475
final DatabaseController databaseController;
7576
final VoidCallback? onDeleted;
7677
final String? initialRowId;
78+
final bool shrinkWrap;
7779

7880
@override
7981
State<MobileGridPage> createState() => _MobileGridPageState();
@@ -104,7 +106,10 @@ class _MobileGridPageState extends State<MobileGridPage> {
104106
finish: (result) {
105107
_openRow(context, widget.initialRowId, true);
106108
return result.successOrFail.fold(
107-
(_) => GridShortcuts(child: GridPageContent(view: widget.view)),
109+
(_) => GridPageContent(
110+
view: widget.view,
111+
shrinkWrap: widget.shrinkWrap,
112+
),
108113
(err) => Center(
109114
child: AppFlowyErrorPage(
110115
error: err,
@@ -145,9 +150,11 @@ class GridPageContent extends StatefulWidget {
145150
const GridPageContent({
146151
super.key,
147152
required this.view,
153+
this.shrinkWrap = false,
148154
});
149155

150156
final ViewPB view;
157+
final bool shrinkWrap;
151158

152159
@override
153160
State<GridPageContent> createState() => _GridPageContentState();
@@ -196,6 +203,7 @@ class _GridPageContentState extends State<GridPageContent> {
196203
children: [
197204
Column(
198205
crossAxisAlignment: CrossAxisAlignment.start,
206+
mainAxisSize: MainAxisSize.min,
199207
children: [
200208
_GridHeader(
201209
contentScrollController: contentScrollController,
@@ -207,11 +215,12 @@ class _GridPageContentState extends State<GridPageContent> {
207215
),
208216
],
209217
),
210-
Positioned(
211-
bottom: 16,
212-
right: 16,
213-
child: getGridFabs(context),
214-
),
218+
if (!widget.shrinkWrap)
219+
Positioned(
220+
bottom: 16,
221+
right: 16,
222+
child: getGridFabs(context),
223+
),
215224
],
216225
),
217226
);
@@ -256,7 +265,7 @@ class _GridRows extends StatelessWidget {
256265
buildWhen: (previous, current) => previous.fields != current.fields,
257266
builder: (context, state) {
258267
final double contentWidth = getMobileGridContentWidth(state.fields);
259-
return Expanded(
268+
return Flexible(
260269
child: _WrapScrollView(
261270
scrollController: scrollController,
262271
contentWidth: contentWidth,
@@ -305,6 +314,7 @@ class _GridRows extends StatelessWidget {
305314
return ReorderableListView.builder(
306315
scrollController: scrollController.verticalController,
307316
buildDefaultDragHandles: false,
317+
shrinkWrap: true,
308318
proxyDecorator: (child, index, animation) => Material(
309319
color: Colors.transparent,
310320
child: child,

0 commit comments

Comments
 (0)