mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: highlight cell when edit
This commit is contained in:
parent
5d9763ff7f
commit
5db5fd118e
@ -1,5 +1,6 @@
|
|||||||
import 'package:app_flowy/startup/startup.dart';
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
||||||
|
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/cell_container.dart';
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
@ -7,7 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:table_calendar/table_calendar.dart';
|
import 'package:table_calendar/table_calendar.dart';
|
||||||
import 'package:window_size/window_size.dart';
|
import 'package:window_size/window_size.dart';
|
||||||
|
|
||||||
class DateCell extends StatefulWidget {
|
class DateCell extends GridCell {
|
||||||
final CellData cellData;
|
final CellData cellData;
|
||||||
|
|
||||||
const DateCell({
|
const DateCell({
|
||||||
@ -37,10 +38,16 @@ class _DateCellState extends State<DateCell> {
|
|||||||
return SizedBox.expand(
|
return SizedBox.expand(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () => _CellCalendar.show(
|
onTap: () {
|
||||||
|
widget.setFocus(context, true);
|
||||||
|
_CellCalendar.show(
|
||||||
context,
|
context,
|
||||||
onSelected: (day) => context.read<DateCellBloc>().add(DateCellEvent.selectDay(day)),
|
onSelected: (day) {
|
||||||
),
|
widget.setFocus(context, false);
|
||||||
|
context.read<DateCellBloc>().add(DateCellEvent.selectDay(day));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
child: MouseRegion(
|
child: MouseRegion(
|
||||||
opaque: false,
|
opaque: false,
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
|
@ -6,7 +6,7 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/c
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
class NumberCell extends StatefulWidget {
|
class NumberCell extends GridCell {
|
||||||
final CellData cellData;
|
final CellData cellData;
|
||||||
|
|
||||||
const NumberCell({
|
const NumberCell({
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import 'package:app_flowy/startup/startup.dart';
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
||||||
|
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/cell_container.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import 'extension.dart';
|
import 'extension.dart';
|
||||||
import 'selection_editor.dart';
|
import 'selection_editor.dart';
|
||||||
|
|
||||||
class SingleSelectCell extends StatefulWidget {
|
class SingleSelectCell extends GridCell {
|
||||||
final CellData cellData;
|
final CellData cellData;
|
||||||
|
|
||||||
const SingleSelectCell({
|
const SingleSelectCell({
|
||||||
@ -37,7 +38,14 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
|
|||||||
return SizedBox.expand(
|
return SizedBox.expand(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
SelectOptionCellEditor.show(context, state.cellData, state.options, state.selectedOptions);
|
widget.setFocus(context, true);
|
||||||
|
SelectOptionCellEditor.show(
|
||||||
|
context,
|
||||||
|
state.cellData,
|
||||||
|
state.options,
|
||||||
|
state.selectedOptions,
|
||||||
|
() => widget.setFocus(context, false),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Row(children: children),
|
child: Row(children: children),
|
||||||
),
|
),
|
||||||
@ -55,7 +63,7 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
class MultiSelectCell extends StatefulWidget {
|
class MultiSelectCell extends GridCell {
|
||||||
final CellData cellData;
|
final CellData cellData;
|
||||||
|
|
||||||
const MultiSelectCell({
|
const MultiSelectCell({
|
||||||
@ -86,11 +94,13 @@ class _MultiSelectCellState extends State<MultiSelectCell> {
|
|||||||
return SizedBox.expand(
|
return SizedBox.expand(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
widget.setFocus(context, true);
|
||||||
SelectOptionCellEditor.show(
|
SelectOptionCellEditor.show(
|
||||||
context,
|
context,
|
||||||
state.cellData,
|
state.cellData,
|
||||||
state.options,
|
state.options,
|
||||||
state.selectedOptions,
|
state.selectedOptions,
|
||||||
|
() => widget.setFocus(context, false),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Row(children: children),
|
child: Row(children: children),
|
||||||
|
@ -28,11 +28,13 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
|||||||
final CellData cellData;
|
final CellData cellData;
|
||||||
final List<SelectOption> options;
|
final List<SelectOption> options;
|
||||||
final List<SelectOption> selectedOptions;
|
final List<SelectOption> selectedOptions;
|
||||||
|
final VoidCallback onDismissed;
|
||||||
|
|
||||||
const SelectOptionCellEditor({
|
const SelectOptionCellEditor({
|
||||||
required this.cellData,
|
required this.cellData,
|
||||||
required this.options,
|
required this.options,
|
||||||
required this.selectedOptions,
|
required this.selectedOptions,
|
||||||
|
required this.onDismissed,
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -67,12 +69,14 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
|||||||
CellData cellData,
|
CellData cellData,
|
||||||
List<SelectOption> options,
|
List<SelectOption> options,
|
||||||
List<SelectOption> selectedOptions,
|
List<SelectOption> selectedOptions,
|
||||||
|
VoidCallback onDismissed,
|
||||||
) {
|
) {
|
||||||
SelectOptionCellEditor.remove(context);
|
SelectOptionCellEditor.remove(context);
|
||||||
final editor = SelectOptionCellEditor(
|
final editor = SelectOptionCellEditor(
|
||||||
cellData: cellData,
|
cellData: cellData,
|
||||||
options: options,
|
options: options,
|
||||||
selectedOptions: selectedOptions,
|
selectedOptions: selectedOptions,
|
||||||
|
onDismissed: onDismissed,
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -98,6 +102,9 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool asBarrier() => true;
|
bool asBarrier() => true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didRemove() => onDismissed();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _OptionList extends StatelessWidget {
|
class _OptionList extends StatelessWidget {
|
||||||
|
Loading…
Reference in New Issue
Block a user