mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add src folder
This commit is contained in:
parent
3e75b1ac92
commit
d1737d35fe
@ -2,7 +2,7 @@ import 'package:app_flowy/plugins/board/application/card/board_select_option_cel
|
||||
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/cell/select_option_cell/extension.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/cell/select_option_cell/select_option_editor.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/plugins/board/application/card/card_bloc.dart';
|
||||
import 'package:app_flowy/plugins/board/application/card/card_data_controller.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/row/row_action_sheet.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
@ -4,7 +4,7 @@ import 'package:app_flowy/plugins/grid/application/field/field_controller.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/layout/sizes.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/toolbar/grid_group.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/toolbar/grid_property.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/field_controller.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -65,7 +65,7 @@ class _SettingButtonState extends State<_SettingButton> {
|
||||
return AppFlowyPopover(
|
||||
controller: popoverController,
|
||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
child: FlowyIconButton(
|
||||
hoverColor: theme.hover,
|
||||
width: 22,
|
||||
|
@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/prelude.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
import '../cell_builder.dart';
|
||||
import 'date_editor.dart';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/generated/locale_keys.g.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/cell/date_cal_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
@ -300,8 +300,7 @@ class _DateTypeOptionButton extends StatelessWidget {
|
||||
selector: (state) => state.dateTypeOptionPB,
|
||||
builder: (context, dateTypeOptionPB) {
|
||||
return AppFlowyPopover(
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
constraints: BoxConstraints.loose(const Size(140, 100)),
|
||||
child: FlowyButton(
|
||||
@ -342,8 +341,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
|
||||
List<Widget> children = [
|
||||
Popover(
|
||||
mutex: _popoverMutex,
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
popupBuilder: (BuildContext context) {
|
||||
return OverlayContainer(
|
||||
@ -359,8 +357,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
|
||||
),
|
||||
Popover(
|
||||
mutex: _popoverMutex,
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
popupBuilder: (BuildContext context) {
|
||||
return OverlayContainer(
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/prelude.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:collection';
|
||||
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/cell/select_option_editor_bloc.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
|
@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'package:app_flowy/generated/locale_keys.g.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/cell/url_cell_bloc.dart';
|
||||
import 'package:app_flowy/workspace/presentation/home/toast.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
@ -220,7 +220,7 @@ class _EditURLAccessoryState extends State<_EditURLAccessory>
|
||||
constraints: BoxConstraints.loose(const Size(300, 160)),
|
||||
controller: _popoverController,
|
||||
direction: PopoverDirection.bottomWithLeftAligned,
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
offset: const Offset(0, 20),
|
||||
child: svgWidget("editor/edit", color: theme.iconColor),
|
||||
popupBuilder: (BuildContext popoverContext) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/field_cell_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/field_service.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -33,7 +33,7 @@ class GridFieldCell extends StatelessWidget {
|
||||
final button = AppFlowyPopover(
|
||||
constraints: BoxConstraints.loose(const Size(240, 840)),
|
||||
direction: PopoverDirection.bottomWithLeftAligned,
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
offset: const Offset(0, 10),
|
||||
popupBuilder: (BuildContext context) {
|
||||
return GridFieldCellActionSheet(
|
||||
|
@ -3,7 +3,7 @@ import 'package:app_flowy/plugins/grid/presentation/widgets/header/field_editor.
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/prelude.dart';
|
||||
import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/field_editor_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
@ -244,7 +244,7 @@ class _DeleteFieldButton extends StatelessWidget {
|
||||
|
||||
Widget _wrapPopover(Widget widget) {
|
||||
return AppFlowyPopover(
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
constraints: BoxConstraints.loose(const Size(400, 240)),
|
||||
mutex: popoverMutex,
|
||||
direction: PopoverDirection.center,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_data_controller.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:dartz/dartz.dart' show Either;
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
@ -66,8 +66,7 @@ class FieldTypeOptionEditor extends StatelessWidget {
|
||||
height: GridSize.typeOptionItemHeight,
|
||||
child: AppFlowyPopover(
|
||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.click | PopoverTriggerActionFlags.hover,
|
||||
triggerActions: PopoverTriggerFlags.click | PopoverTriggerFlags.hover,
|
||||
mutex: popoverMutex,
|
||||
offset: const Offset(20, 0),
|
||||
popupBuilder: (context) {
|
||||
|
@ -4,7 +4,7 @@ import 'package:app_flowy/plugins/grid/application/field/type_option/type_option
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/prelude.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -177,7 +177,7 @@ class CreateFieldButton extends StatelessWidget {
|
||||
final theme = context.watch<AppTheme>();
|
||||
|
||||
return AppFlowyPopover(
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
direction: PopoverDirection.bottomWithRightAligned,
|
||||
constraints: BoxConstraints.loose(const Size(240, 200)),
|
||||
child: FlowyButton(
|
||||
|
@ -3,7 +3,7 @@ import 'dart:typed_data';
|
||||
import 'package:app_flowy/plugins/grid/application/field/field_controller.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_data_controller.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/checkbox_type_option.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/date_type_option.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/multi_select_type_option.pb.dart';
|
||||
|
@ -11,7 +11,7 @@ import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/date_type_option_entities.pb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import '../../../layout/sizes.dart';
|
||||
import '../field_type_option_editor.dart';
|
||||
import 'builder.dart';
|
||||
@ -64,8 +64,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
|
||||
Widget _renderDateFormatButton(BuildContext context, DateFormat dataFormat) {
|
||||
return AppFlowyPopover(
|
||||
mutex: popoverMutex,
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||
popupBuilder: (popoverContext) {
|
||||
@ -86,8 +85,7 @@ class DateTypeOptionWidget extends TypeOptionWidget {
|
||||
Widget _renderTimeFormatButton(BuildContext context, TimeFormat timeFormat) {
|
||||
return AppFlowyPopover(
|
||||
mutex: popoverMutex,
|
||||
triggerActions:
|
||||
PopoverTriggerActionFlags.hover | PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||
popupBuilder: (BuildContext popoverContext) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/multi_select_type_option.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
import '../field_type_option_editor.dart';
|
||||
import 'builder.dart';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/number_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/number_format_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -57,8 +57,8 @@ class NumberTypeOptionWidget extends TypeOptionWidget {
|
||||
builder: (context, state) {
|
||||
return AppFlowyPopover(
|
||||
mutex: popoverMutex,
|
||||
triggerActions: PopoverTriggerActionFlags.hover |
|
||||
PopoverTriggerActionFlags.click,
|
||||
triggerActions:
|
||||
PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
constraints: BoxConstraints.loose(const Size(460, 440)),
|
||||
child: FlowyButton(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/select_option_type_option_bloc.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
@ -2,7 +2,7 @@ import 'package:app_flowy/plugins/grid/application/field/type_option/single_sele
|
||||
import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../field_type_option_editor.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'builder.dart';
|
||||
import 'select_option.dart';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/plugins/grid/application/prelude.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/row/row_cache.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/row/row_data_controller.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
|
@ -15,7 +15,7 @@ import 'package:app_flowy/generated/locale_keys.g.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
import '../../layout/sizes.dart';
|
||||
import '../cell/cell_accessory.dart';
|
||||
@ -197,7 +197,7 @@ class _CreateFieldButtonState extends State<_CreateFieldButton> {
|
||||
return AppFlowyPopover(
|
||||
constraints: BoxConstraints.loose(const Size(240, 200)),
|
||||
controller: popoverController,
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
direction: PopoverDirection.topWithLeftAligned,
|
||||
onClose: widget.onClosed,
|
||||
child: Container(
|
||||
|
@ -3,7 +3,7 @@ import 'package:app_flowy/plugins/grid/presentation/widgets/header/field_editor.
|
||||
import 'package:app_flowy/startup/startup.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/setting/property_bloc.dart';
|
||||
import 'package:app_flowy/plugins/grid/presentation/widgets/header/field_type_extension.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -118,7 +118,7 @@ class _GridPropertyCell extends StatelessWidget {
|
||||
Widget _editFieldButton(AppTheme theme, BuildContext context) {
|
||||
return AppFlowyPopover(
|
||||
mutex: popoverMutex,
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
offset: const Offset(20, 0),
|
||||
constraints: BoxConstraints.loose(const Size(240, 200)),
|
||||
child: FlowyButton(
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:app_flowy/plugins/grid/application/setting/setting_bloc.dart';
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra/theme.dart';
|
||||
@ -55,7 +55,7 @@ class _SettingButton extends StatelessWidget {
|
||||
final theme = context.watch<AppTheme>();
|
||||
return AppFlowyPopover(
|
||||
constraints: BoxConstraints.loose(const Size(260, 400)),
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
offset: const Offset(0, 10),
|
||||
child: FlowyIconButton(
|
||||
width: 22,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
|
||||
class PopoverMenu extends StatefulWidget {
|
||||
const PopoverMenu({Key? key}) : super(key: key);
|
||||
@ -41,8 +41,8 @@ class _PopoverMenuState extends State<PopoverMenu> {
|
||||
decoration: null)),
|
||||
),
|
||||
Popover(
|
||||
triggerActions: PopoverTriggerActionFlags.hover |
|
||||
PopoverTriggerActionFlags.click,
|
||||
triggerActions:
|
||||
PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
mutex: popOverMutex,
|
||||
offset: const Offset(10, 0),
|
||||
popupBuilder: (BuildContext context) {
|
||||
@ -54,8 +54,8 @@ class _PopoverMenuState extends State<PopoverMenu> {
|
||||
),
|
||||
),
|
||||
Popover(
|
||||
triggerActions: PopoverTriggerActionFlags.hover |
|
||||
PopoverTriggerActionFlags.click,
|
||||
triggerActions:
|
||||
PopoverTriggerFlags.hover | PopoverTriggerFlags.click,
|
||||
mutex: popOverMutex,
|
||||
offset: const Offset(10, 0),
|
||||
popupBuilder: (BuildContext context) {
|
||||
@ -86,7 +86,7 @@ class ExampleButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Popover(
|
||||
triggerActions: PopoverTriggerActionFlags.click,
|
||||
triggerActions: PopoverTriggerFlags.click,
|
||||
offset: offset,
|
||||
direction: direction ?? PopoverDirection.rightWithTopAligned,
|
||||
child: TextButton(child: Text(label), onPressed: () {}),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import "./example_button.dart";
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
/// AppFlowyBoard library
|
||||
library appflowy_popover;
|
||||
|
||||
export 'src/mutex.dart';
|
||||
export 'src/popover.dart';
|
@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class _PopoverMask extends StatefulWidget {
|
||||
final void Function() onTap;
|
||||
final void Function()? onExit;
|
||||
final Decoration? decoration;
|
||||
|
||||
const _PopoverMask(
|
||||
{Key? key,
|
||||
required this.onTap,
|
||||
this.onExit,
|
||||
this.decoration =
|
||||
const BoxDecoration(color: Color.fromARGB(0, 244, 67, 54))})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _PopoverMaskState();
|
||||
}
|
||||
|
||||
class _PopoverMaskState extends State<_PopoverMask> {
|
||||
@override
|
||||
void initState() {
|
||||
HardwareKeyboard.instance.addHandler(_handleGlobalKeyEvent);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
bool _handleGlobalKeyEvent(KeyEvent event) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.escape) {
|
||||
if (widget.onExit != null) {
|
||||
widget.onExit!();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
void deactivate() {
|
||||
HardwareKeyboard.instance.removeHandler(_handleGlobalKeyEvent);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
child: Container(
|
||||
decoration: widget.decoration,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'popover.dart';
|
||||
|
||||
/// If multiple popovers are exclusive,
|
||||
/// pass the same mutex to them.
|
||||
class PopoverMutex {
|
||||
final ValueNotifier<PopoverState?> _stateNotifier = ValueNotifier(null);
|
||||
PopoverMutex();
|
||||
|
||||
void removePopoverStateListener(VoidCallback listener) {
|
||||
_stateNotifier.removeListener(listener);
|
||||
}
|
||||
|
||||
VoidCallback listenOnPopoverStateChanged(VoidCallback callback) {
|
||||
listenerCallback() {
|
||||
callback();
|
||||
}
|
||||
|
||||
_stateNotifier.addListener(listenerCallback);
|
||||
return listenerCallback;
|
||||
}
|
||||
|
||||
void close() {
|
||||
_stateNotifier.value?.close();
|
||||
}
|
||||
|
||||
PopoverState? get state => _stateNotifier.value;
|
||||
|
||||
set state(PopoverState? newState) {
|
||||
if (_stateNotifier.value != null && _stateNotifier.value != newState) {
|
||||
_stateNotifier.value?.close();
|
||||
}
|
||||
_stateNotifier.value = newState;
|
||||
}
|
||||
|
||||
void removeState() {
|
||||
_stateNotifier.value = null;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
_stateNotifier.dispose();
|
||||
}
|
||||
}
|
@ -1,62 +1,23 @@
|
||||
import 'package:appflowy_popover/layout.dart';
|
||||
import 'package:appflowy_popover/src/layout.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
/// If multiple popovers are exclusive,
|
||||
/// pass the same mutex to them.
|
||||
class PopoverMutex {
|
||||
final ValueNotifier<PopoverState?> _stateNotifier = ValueNotifier(null);
|
||||
PopoverMutex();
|
||||
|
||||
void removePopoverStateListener(VoidCallback listener) {
|
||||
_stateNotifier.removeListener(listener);
|
||||
}
|
||||
|
||||
VoidCallback listenOnPopoverStateChanged(VoidCallback callback) {
|
||||
listenerCallback() {
|
||||
callback();
|
||||
}
|
||||
|
||||
_stateNotifier.addListener(listenerCallback);
|
||||
return listenerCallback;
|
||||
}
|
||||
|
||||
void close() {
|
||||
_stateNotifier.value?.close();
|
||||
}
|
||||
|
||||
PopoverState? get state => _stateNotifier.value;
|
||||
|
||||
set state(PopoverState? newState) {
|
||||
if (_stateNotifier.value != null && _stateNotifier.value != newState) {
|
||||
_stateNotifier.value?.close();
|
||||
}
|
||||
_stateNotifier.value = newState;
|
||||
}
|
||||
|
||||
void _removeState() {
|
||||
_stateNotifier.value = null;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
_stateNotifier.dispose();
|
||||
}
|
||||
}
|
||||
import 'mask.dart';
|
||||
import 'mutex.dart';
|
||||
|
||||
class PopoverController {
|
||||
PopoverState? state;
|
||||
PopoverState? _state;
|
||||
|
||||
close() {
|
||||
state?.close();
|
||||
_state?.close();
|
||||
}
|
||||
|
||||
show() {
|
||||
state?.showOverlay();
|
||||
_state?.showOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
class PopoverTriggerActionFlags {
|
||||
class PopoverTriggerFlags {
|
||||
static int click = 0x01;
|
||||
static int hover = 0x02;
|
||||
}
|
||||
@ -136,11 +97,11 @@ class PopoverState extends State<Popover> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
widget.controller?.state = this;
|
||||
widget.controller?._state = this;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
showOverlay() {
|
||||
void showOverlay() {
|
||||
close();
|
||||
|
||||
if (widget.mutex != null) {
|
||||
@ -150,14 +111,14 @@ class PopoverState extends State<Popover> {
|
||||
if (_popoverWithMask == null) {
|
||||
_popoverWithMask = this;
|
||||
} else {
|
||||
hasMask = false;
|
||||
// hasMask = false;
|
||||
}
|
||||
|
||||
final newEntry = OverlayEntry(builder: (context) {
|
||||
final children = <Widget>[];
|
||||
|
||||
if (hasMask) {
|
||||
children.add(_PopoverMask(
|
||||
children.add(PopoverMask(
|
||||
decoration: widget.maskDecoration,
|
||||
onTap: () => close(),
|
||||
onExit: () => close(),
|
||||
@ -178,27 +139,29 @@ class PopoverState extends State<Popover> {
|
||||
|
||||
_overlayEntry = newEntry;
|
||||
|
||||
final OverlayState s = Overlay.of(context)!;
|
||||
|
||||
Overlay.of(context)?.insert(newEntry);
|
||||
}
|
||||
|
||||
close() {
|
||||
void close() {
|
||||
if (_overlayEntry != null) {
|
||||
_overlayEntry!.remove();
|
||||
_overlayEntry = null;
|
||||
|
||||
if (_popoverWithMask == this) {
|
||||
_popoverWithMask = null;
|
||||
}
|
||||
if (widget.onClose != null) {
|
||||
widget.onClose!();
|
||||
}
|
||||
|
||||
widget.onClose?.call();
|
||||
}
|
||||
|
||||
if (widget.mutex?.state == this) {
|
||||
widget.mutex?._removeState();
|
||||
widget.mutex?.removeState();
|
||||
}
|
||||
}
|
||||
|
||||
closeAll() {
|
||||
void closeAll() {
|
||||
_popoverWithMask?.close();
|
||||
}
|
||||
|
||||
@ -208,88 +171,32 @@ class PopoverState extends State<Popover> {
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
_handleTargetPointerDown(PointerDownEvent event) {
|
||||
if (widget.triggerActions & PopoverTriggerActionFlags.click != 0) {
|
||||
showOverlay();
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopoverTarget(
|
||||
link: popoverLink,
|
||||
child: _buildChild(context),
|
||||
);
|
||||
}
|
||||
|
||||
_handleTargetPointerEnter(PointerEnterEvent event) {
|
||||
if (widget.triggerActions & PopoverTriggerActionFlags.hover != 0) {
|
||||
showOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
_buildContent(BuildContext context) {
|
||||
Widget _buildChild(BuildContext context) {
|
||||
if (widget.triggerActions == 0) {
|
||||
return widget.child;
|
||||
}
|
||||
|
||||
return MouseRegion(
|
||||
onEnter: _handleTargetPointerEnter,
|
||||
onEnter: (PointerEnterEvent event) {
|
||||
if (widget.triggerActions & PopoverTriggerFlags.hover != 0) {
|
||||
showOverlay();
|
||||
}
|
||||
},
|
||||
child: Listener(
|
||||
onPointerDown: _handleTargetPointerDown,
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopoverTarget(
|
||||
link: popoverLink,
|
||||
child: _buildContent(context),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PopoverMask extends StatefulWidget {
|
||||
final void Function() onTap;
|
||||
final void Function()? onExit;
|
||||
final Decoration? decoration;
|
||||
|
||||
const _PopoverMask(
|
||||
{Key? key, required this.onTap, this.onExit, this.decoration})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _PopoverMaskState();
|
||||
}
|
||||
|
||||
class _PopoverMaskState extends State<_PopoverMask> {
|
||||
@override
|
||||
void initState() {
|
||||
HardwareKeyboard.instance.addHandler(_handleGlobalKeyEvent);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
bool _handleGlobalKeyEvent(KeyEvent event) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.escape) {
|
||||
if (widget.onExit != null) {
|
||||
widget.onExit!();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
void deactivate() {
|
||||
HardwareKeyboard.instance.removeHandler(_handleGlobalKeyEvent);
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
child: Container(
|
||||
// decoration: widget.decoration,
|
||||
decoration: widget.decoration ??
|
||||
const BoxDecoration(
|
||||
color: Color.fromARGB(0, 244, 67, 54),
|
||||
),
|
||||
onPointerDown: (PointerDownEvent event) {
|
||||
if (widget.triggerActions & PopoverTriggerFlags.click != 0) {
|
||||
showOverlay();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui_web.dart';
|
||||
import 'package:appflowy_popover/popover.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppFlowyPopover extends StatelessWidget {
|
||||
|
Loading…
Reference in New Issue
Block a user