Skip to content

Commit 520d5c2

Browse files
committed
chore: replace popover with appflowy popover
1 parent 499ee29 commit 520d5c2

File tree

3 files changed

+40
-30
lines changed

3 files changed

+40
-30
lines changed

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/url_cell/cell_editor.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
22
import 'package:app_flowy/plugins/grid/application/cell/url_cell_editor_bloc.dart';
3-
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
43
import 'package:flutter/material.dart';
54
import 'dart:async';
65

@@ -79,15 +78,12 @@ class URLEditorPopover extends StatelessWidget {
7978

8079
@override
8180
Widget build(BuildContext context) {
82-
return OverlayContainer(
83-
constraints: BoxConstraints.loose(const Size(300, 160)),
84-
child: SizedBox(
85-
width: 200,
86-
child: Padding(
87-
padding: const EdgeInsets.all(6),
88-
child: URLCellEditor(
89-
cellController: cellController,
90-
),
81+
return SizedBox(
82+
width: 200,
83+
child: Padding(
84+
padding: const EdgeInsets.all(6),
85+
child: URLCellEditor(
86+
cellController: cellController,
9187
),
9288
),
9389
);

frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/url_cell/url_cell.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:appflowy_popover/popover.dart';
66
import 'package:easy_localization/easy_localization.dart';
77
import 'package:flowy_infra/image.dart';
88
import 'package:flowy_infra/theme.dart';
9+
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
910
import 'package:flutter/material.dart';
1011
import 'package:flutter/services.dart';
1112
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -129,8 +130,9 @@ class _GridURLCellState extends GridCellState<GridURLCell> {
129130
),
130131
);
131132

132-
return Popover(
133+
return AppFlowyStylePopover(
133134
controller: _popoverController,
135+
constraints: BoxConstraints.loose(const Size(300, 160)),
134136
direction: PopoverDirection.bottomWithLeftAligned,
135137
offset: const Offset(0, 20),
136138
child: SizedBox.expand(
@@ -214,7 +216,8 @@ class _EditURLAccessoryState extends State<_EditURLAccessory>
214216
@override
215217
Widget build(BuildContext context) {
216218
final theme = context.watch<AppTheme>();
217-
return Popover(
219+
return AppFlowyStylePopover(
220+
constraints: BoxConstraints.loose(const Size(300, 160)),
218221
controller: _popoverController,
219222
direction: PopoverDirection.bottomWithLeftAligned,
220223
triggerActions: PopoverTriggerActionFlags.click,

frontend/app_flowy/lib/plugins/grid/presentation/widgets/row/row_detail.dart

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,15 @@ class _PropertyList extends StatelessWidget {
146146
});
147147
},
148148
onOpened: (controller) {
149-
return OverlayContainer(
150-
constraints: BoxConstraints.loose(const Size(240, 200)),
151-
child: FieldEditor(
152-
gridId: viewId,
153-
typeOptionLoader: NewFieldTypeOptionLoader(gridId: viewId),
154-
onDeleted: (fieldId) {
155-
controller.close();
156-
context
157-
.read<RowDetailBloc>()
158-
.add(RowDetailEvent.deleteField(fieldId));
159-
},
160-
),
149+
return FieldEditor(
150+
gridId: viewId,
151+
typeOptionLoader: NewFieldTypeOptionLoader(gridId: viewId),
152+
onDeleted: (fieldId) {
153+
controller.close();
154+
context
155+
.read<RowDetailBloc>()
156+
.add(RowDetailEvent.deleteField(fieldId));
157+
},
161158
);
162159
},
163160
),
@@ -168,28 +165,41 @@ class _PropertyList extends StatelessWidget {
168165
}
169166
}
170167

171-
class _CreateFieldButton extends StatelessWidget {
168+
class _CreateFieldButton extends StatefulWidget {
172169
final String viewId;
173170
final Widget Function(PopoverController) onOpened;
174171
final VoidCallback onClosed;
175-
final PopoverController popoverController = PopoverController();
176172

177-
_CreateFieldButton({
173+
const _CreateFieldButton({
178174
required this.viewId,
179175
required this.onOpened,
180176
required this.onClosed,
181177
Key? key,
182178
}) : super(key: key);
183179

180+
@override
181+
State<_CreateFieldButton> createState() => _CreateFieldButtonState();
182+
}
183+
184+
class _CreateFieldButtonState extends State<_CreateFieldButton> {
185+
late PopoverController popoverController;
186+
187+
@override
188+
void initState() {
189+
popoverController = PopoverController();
190+
super.initState();
191+
}
192+
184193
@override
185194
Widget build(BuildContext context) {
186195
final theme = context.read<AppTheme>();
187196

188-
return Popover(
197+
return AppFlowyStylePopover(
198+
constraints: BoxConstraints.loose(const Size(240, 200)),
189199
controller: popoverController,
190200
triggerActions: PopoverTriggerActionFlags.click,
191201
direction: PopoverDirection.topWithLeftAligned,
192-
onClose: onClosed,
202+
onClose: widget.onClosed,
193203
child: Container(
194204
height: 40,
195205
decoration: _makeBoxDecoration(context),
@@ -203,7 +213,8 @@ class _CreateFieldButton extends StatelessWidget {
203213
leftIcon: svgWidget("home/add"),
204214
),
205215
),
206-
popupBuilder: (BuildContext context) => onOpened(popoverController),
216+
popupBuilder: (BuildContext context) =>
217+
widget.onOpened(popoverController),
207218
);
208219
}
209220

0 commit comments

Comments
 (0)