Skip to content

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.

fix: lints for popover

Vincent Chana43259bddb46
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_toolbar.dart b/frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_toolbar.dart
index 914ced60d7..0753c380b5 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_toolbar.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/toolbar/board_toolbar.dart
@@ -2,7 +2,6 @@ import 'package:app_flowy/plugins/grid/application/field/field_cache.dart';
import 'package:appflowy_popover/popover.dart';
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
-import 'package:flowy_infra_ui/flowy_infra_ui_web.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
index 92b0a3233d..9c57e7ed3b 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
@@ -65,11 +65,11 @@ class _DateCellEditor extends State<DateCellEditor> {
}
return OverlayContainer(
+ constraints: BoxConstraints.loose(const Size(320, 500)),
child: _CellCalendarWidget(
cellContext: widget.cellController,
dateTypeOptionPB: _dateTypeOptionPB!,
),
- constraints: BoxConstraints.loose(const Size(320, 500)),
);
}
}
@@ -349,7 +349,6 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
mutex: _popoverMutex,
triggerActions:
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
- child: const DateFormatButton(),
offset: const Offset(20, 0),
popupBuilder: (BuildContext context) {
return OverlayContainer(
@@ -361,12 +360,12 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
),
);
},
+ child: const DateFormatButton(),
),
Popover(
mutex: _popoverMutex,
triggerActions:
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
- child: TimeFormatButton(timeFormat: widget.dateTypeOptionPB.timeFormat),
offset: const Offset(20, 0),
popupBuilder: (BuildContext context) {
return OverlayContainer(
@@ -378,6 +377,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
),
);
},
+ child: TimeFormatButton(timeFormat: widget.dateTypeOptionPB.timeFormat),
),
];
@@ -396,23 +396,4 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
),
);
}
-
- void _showOverlay(BuildContext context, Widget child) {
- if (overlayIdentifier != null) {
- FlowyOverlay.of(context).remove(overlayIdentifier!);
- }
-
- overlayIdentifier = child.toString();
- FlowyOverlay.of(context).insertWithAnchor(
- widget: OverlayContainer(
- constraints: BoxConstraints.loose(const Size(460, 440)),
- child: child,
- ),
- identifier: overlayIdentifier!,
- anchorContext: context,
- anchorDirection: AnchorDirection.rightWithCenterAligned,
- style: FlowyOverlayStyle(blur: false),
- anchorOffset: const Offset(20, 0),
- );
- }
}
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_cell.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_cell.dart
index c09c5e93db..df7ddb0d9e 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_cell.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_cell.dart
@@ -196,8 +196,9 @@ class _SelectOptionWrapState extends State<SelectOptionWrap> {
children: [
Popover(
controller: _popover,
- child: child,
offset: const Offset(0, 20),
+ direction: PopoverDirection.bottomWithLeftAligned,
+ // triggerActions: PopoverTriggerActionFlags.c,
popupBuilder: (BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
widget.onFocus?.call(true);
@@ -220,6 +221,7 @@ class _SelectOptionWrapState extends State<SelectOptionWrap> {
onClose: () {
widget.onFocus?.call(false);
},
+ child: child,
),
InkWell(onTap: () {
_popover.show();
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart
index c2c4d9efdf..4436e61fb6 100755
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_cell.dart
@@ -22,7 +22,7 @@ class GridFieldCell extends StatelessWidget {
}) : super(key: key);
@override
- Widget build(BuildContext gridCellContext) {
+ Widget build(BuildContext context) {
return BlocProvider(
create: (context) {
return FieldCellBloc(cellContext: cellContext);
@@ -32,16 +32,16 @@ class GridFieldCell extends StatelessWidget {
final button = Popover(
direction: PopoverDirection.bottomWithLeftAligned,
triggerActions: PopoverTriggerActionFlags.click,
- child: FieldCellButton(
- field: cellContext.field,
- onTap: () {},
- ),
offset: const Offset(0, 10),
popupBuilder: (BuildContext context) {
return GridFieldCellActionSheet(
cellContext: cellContext,
);
},
+ child: FieldCellButton(
+ field: cellContext.field,
+ onTap: () {},
+ ),
);
const line = Positioned(
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_editor.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_editor.dart
index 0abb26022b..83a6a27fda 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_editor.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/field_editor.dart
@@ -22,9 +22,6 @@ class FieldEditor extends StatefulWidget {
Key? key,
}) : super(key: key);
- @override
- bool asBarrier() => true;
-
@override
State<StatefulWidget> createState() => _FieldEditorState();
}
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart
index f061ce726f..ae3dcf8682 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart
@@ -66,7 +66,6 @@ class DateTypeOptionWidget extends TypeOptionWidget {
mutex: popoverMutex,
triggerActions:
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
- child: const DateFormatButton(),
offset: const Offset(20, 0),
popupBuilder: (popoverContext) {
return OverlayContainer(
@@ -82,6 +81,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
),
);
},
+ child: const DateFormatButton(),
);
}
@@ -90,7 +90,6 @@ class DateTypeOptionWidget extends TypeOptionWidget {
mutex: popoverMutex,
triggerActions:
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
- child: TimeFormatButton(timeFormat: timeFormat),
offset: const Offset(20, 0),
popupBuilder: (BuildContext popoverContext) {
return OverlayContainer(
@@ -105,6 +104,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
}),
);
},
+ child: TimeFormatButton(timeFormat: timeFormat),
);
}
}
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_setting.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_setting.dart
index d9a5daa041..ca7209d50d 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_setting.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_setting.dart
@@ -13,7 +13,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
import '../../../application/field/field_cache.dart';
import '../../layout/sizes.dart';
-import 'grid_property.dart';
class GridSettingContext {
final String gridId;
diff --git a/frontend/app_flowy/packages/appflowy_popover/README.md b/frontend/app_flowy/packages/appflowy_popover/README.md
index ce545e5339..9d974e2253 100644
--- a/frontend/app_flowy/packages/appflowy_popover/README.md
+++ b/frontend/app_flowy/packages/appflowy_popover/README.md
@@ -13,8 +13,7 @@ and the Flutter guide for
# AppFlowy Popover
-TODO: Put a short description of the package here that helps potential users
-know whether this package might be useful for them.
+A Popover can be used to display some content on top of another.
## Features
diff --git a/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart b/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
index 36f57f57fa..e2eee64067 100644
--- a/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
+++ b/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:appflowy_popover/popover.dart';
class PopoverMenu extends StatefulWidget {
+ const PopoverMenu({Key? key}) : super(key: key);
+
@override
State<StatefulWidget> createState() => _PopoverMenuState();
}
@@ -23,7 +25,7 @@ class _PopoverMenuState extends State<PopoverMenu> {
mutex: popOverMutex,
offset: const Offset(10, 0),
popupBuilder: (BuildContext context) {
- return PopoverMenu();
+ return const PopoverMenu();
},
child: TextButton(
onPressed: () {},
@@ -36,7 +38,7 @@ class _PopoverMenuState extends State<PopoverMenu> {
mutex: popOverMutex,
offset: const Offset(10, 0),
popupBuilder: (BuildContext context) {
- return PopoverMenu();
+ return const PopoverMenu();
},
child: TextButton(
onPressed: () {},
@@ -68,7 +70,7 @@ class ExampleButton extends StatelessWidget {
direction: direction ?? PopoverDirection.rightWithTopAligned,
child: TextButton(child: Text(label), onPressed: () {}),
popupBuilder: (BuildContext context) {
- return PopoverMenu();
+ return const PopoverMenu();
},
);
}
diff --git a/frontend/app_flowy/packages/appflowy_popover/example/test/widget_test.dart b/frontend/app_flowy/packages/appflowy_popover/example/test/widget_test.dart
deleted file mode 100644
index 092d222f7e..0000000000
--- a/frontend/app_flowy/packages/appflowy_popover/example/test/widget_test.dart
+++ /dev/null
@@ -1,30 +0,0 @@
-// This is a basic Flutter widget test.
-//
-// To perform an interaction with a widget in your test, use the WidgetTester
-// utility in the flutter_test package. For example, you can send tap and scroll
-// gestures. You can also use WidgetTester to find child widgets in the widget
-// tree, read text, and verify that the values of widget properties are correct.
-
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:example/main.dart';
-
-void main() {
- testWidgets('Counter increments smoke test', (WidgetTester tester) async {
- // Build our app and trigger a frame.
- await tester.pumpWidget(const MyApp());
-
- // Verify that our counter starts at 0.
- expect(find.text('0'), findsOneWidget);
- expect(find.text('1'), findsNothing);
-
- // Tap the '+' icon and trigger a frame.
- await tester.tap(find.byIcon(Icons.add));
- await tester.pump();
-
- // Verify that our counter has incremented.
- expect(find.text('0'), findsNothing);
- expect(find.text('1'), findsOneWidget);
- });
-}
diff --git a/frontend/app_flowy/packages/appflowy_popover/lib/follower.dart b/frontend/app_flowy/packages/appflowy_popover/lib/follower.dart
index 5e337e51b5..ff54eaac61 100644
--- a/frontend/app_flowy/packages/appflowy_popover/lib/follower.dart
+++ b/frontend/app_flowy/packages/appflowy_popover/lib/follower.dart
@@ -56,8 +56,6 @@ class PopoverRenderFollowerLayer extends RenderFollowerLayer {
void paint(PaintingContext context, Offset offset) {
super.paint(context, offset);
- final global = localToGlobal(offset);
-
if (link.leader == null) {
return;
}
@@ -68,9 +66,6 @@ class PopoverRenderFollowerLayer extends RenderFollowerLayer {
}
debugPrint(
"right: ${link.leader!.offset.dx + link.leaderSize!.width + size.width}, screen with: ${screenSize.width}");
- // debugPrint(
- // "offset: $offset, global: $global, link: ${link.leader?.offset}, link size: ${link.leaderSize}");
- // debugPrint("follower size: ${this.size}, screen size: ${this.screenSize}");
}
}
diff --git a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover.dart b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover.dart
index 361486d00b..d1a52e50d9 100644
--- a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover.dart
+++ b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_popover.dart
@@ -15,7 +15,7 @@ class FlowyPopover extends StatefulWidget {
final EdgeInsets padding;
final BoxConstraints? constraints;
- FlowyPopover({
+ const FlowyPopover({
Key? key,
required this.builder,
required this.anchorRect,