fix: lints for popover

This commit is contained in:
Vincent Chan 2022-09-01 16:25:48 +08:00
parent 0cd384802e
commit a43259bddb
12 changed files with 20 additions and 76 deletions

View File

@ -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';

View File

@ -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),
);
}
}

View File

@ -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();

View File

@ -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(

View File

@ -22,9 +22,6 @@ class FieldEditor extends StatefulWidget {
Key? key,
}) : super(key: key);
@override
bool asBarrier() => true;
@override
State<StatefulWidget> createState() => _FieldEditorState();
}

View File

@ -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),
);
}
}

View File

@ -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;

View File

@ -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

View File

@ -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();
},
);
}

View File

@ -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);
});
}

View File

@ -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}");
}
}

View File

@ -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,