mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: hidden board card cannot open as page (#4090)
* fix: card open in board * style: super.key and remove unused variables * chore: more code cleanup
This commit is contained in:
parent
25e94da7e7
commit
04eea26a55
@ -418,7 +418,7 @@ class HiddenGroupPopupItemList extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
FlowyOverlay.show(
|
FlowyOverlay.show(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (_) {
|
||||||
return RowDetailPage(
|
return RowDetailPage(
|
||||||
fieldController:
|
fieldController:
|
||||||
context.read<BoardBloc>().fieldController,
|
context.read<BoardBloc>().fieldController,
|
||||||
|
@ -47,10 +47,10 @@ class _MobileChecklistCellEditScreenState
|
|||||||
child: _buildHeader(context),
|
child: _buildHeader(context),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Expanded(
|
const Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0.0),
|
padding: EdgeInsets.symmetric(horizontal: 0.0),
|
||||||
child: _buildBody(context),
|
child: _TaskList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -91,20 +91,10 @@ class _MobileChecklistCellEditScreenState
|
|||||||
].map((e) => SizedBox(height: height, child: e)).toList(),
|
].map((e) => SizedBox(height: height, child: e)).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody(BuildContext context) {
|
|
||||||
return _TaskList(
|
|
||||||
onCreateOption: (optionName) {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TaskList extends StatelessWidget {
|
class _TaskList extends StatelessWidget {
|
||||||
const _TaskList({
|
const _TaskList();
|
||||||
required this.onCreateOption,
|
|
||||||
});
|
|
||||||
|
|
||||||
final void Function(String optionName) onCreateOption;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -180,6 +170,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.only(left: 5, right: 16),
|
padding: const EdgeInsets.only(left: 5, right: 16),
|
||||||
|
height: 44,
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@ -205,10 +196,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
style: Theme.of(context)
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
.textTheme
|
|
||||||
.bodyMedium
|
|
||||||
?.copyWith(fontSize: 15),
|
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
@ -227,47 +215,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
|||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
borderRadius: BorderRadius.circular(22),
|
borderRadius: BorderRadius.circular(22),
|
||||||
onTap: () => showMobileBottomSheet(
|
onTap: _showDeleteTaskBottomSheet,
|
||||||
context,
|
|
||||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
|
||||||
builder: (_) => Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
context.read<ChecklistCellBloc>().add(
|
|
||||||
ChecklistCellEvent.deleteTask(widget.task.data),
|
|
||||||
);
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
child: Container(
|
|
||||||
height: 44,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
FlowySvg(
|
|
||||||
FlowySvgs.m_delete_m,
|
|
||||||
size: const Size.square(20),
|
|
||||||
color: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
|
||||||
const HSpace(8),
|
|
||||||
FlowyText(
|
|
||||||
LocaleKeys.button_delete.tr(),
|
|
||||||
fontSize: 15,
|
|
||||||
color: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Divider(height: 9),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: SizedBox.square(
|
child: SizedBox.square(
|
||||||
dimension: 44,
|
dimension: 44,
|
||||||
child: Center(
|
child: Center(
|
||||||
@ -298,6 +246,50 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showDeleteTaskBottomSheet() {
|
||||||
|
showMobileBottomSheet(
|
||||||
|
context,
|
||||||
|
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||||
|
builder: (_) => Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
context.read<ChecklistCellBloc>().add(
|
||||||
|
ChecklistCellEvent.deleteTask(widget.task.data),
|
||||||
|
);
|
||||||
|
context.pop();
|
||||||
|
},
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Container(
|
||||||
|
height: 44,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
FlowySvg(
|
||||||
|
FlowySvgs.m_delete_m,
|
||||||
|
size: const Size.square(20),
|
||||||
|
color: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
|
const HSpace(8),
|
||||||
|
FlowyText(
|
||||||
|
LocaleKeys.button_delete.tr(),
|
||||||
|
fontSize: 15,
|
||||||
|
color: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Divider(height: 9),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NewTaskButton extends StatelessWidget {
|
class _NewTaskButton extends StatelessWidget {
|
||||||
|
@ -148,7 +148,6 @@ class SelectOptionTagCell extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(5.0),
|
padding: const EdgeInsets.all(5.0),
|
||||||
child: SelectOptionTag(
|
child: SelectOptionTag(
|
||||||
option: option,
|
option: option,
|
||||||
fontSize: 11,
|
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
|
const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
|
||||||
),
|
),
|
||||||
|
@ -27,8 +27,7 @@ class SelectOptionCellEditor extends StatefulWidget {
|
|||||||
final SelectOptionCellController cellController;
|
final SelectOptionCellController cellController;
|
||||||
static double editorPanelWidth = 300;
|
static double editorPanelWidth = 300;
|
||||||
|
|
||||||
const SelectOptionCellEditor({required this.cellController, Key? key})
|
const SelectOptionCellEditor({super.key, required this.cellController});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SelectOptionCellEditor> createState() => _SelectOptionCellEditorState();
|
State<SelectOptionCellEditor> createState() => _SelectOptionCellEditorState();
|
||||||
@ -82,8 +81,7 @@ class _OptionList extends StatelessWidget {
|
|||||||
const _OptionList({
|
const _OptionList({
|
||||||
required this.popoverMutex,
|
required this.popoverMutex,
|
||||||
required this.tagController,
|
required this.tagController,
|
||||||
Key? key,
|
});
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -138,8 +136,7 @@ class _TextField extends StatelessWidget {
|
|||||||
const _TextField({
|
const _TextField({
|
||||||
required this.popoverMutex,
|
required this.popoverMutex,
|
||||||
required this.tagController,
|
required this.tagController,
|
||||||
Key? key,
|
});
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -290,8 +287,7 @@ class _SelectOptionCell extends StatefulWidget {
|
|||||||
required this.option,
|
required this.option,
|
||||||
required this.isSelected,
|
required this.isSelected,
|
||||||
required this.popoverMutex,
|
required this.popoverMutex,
|
||||||
Key? key,
|
});
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_SelectOptionCell> createState() => _SelectOptionCellState();
|
State<_SelectOptionCell> createState() => _SelectOptionCellState();
|
||||||
|
@ -6,7 +6,6 @@ import 'package:flutter/gestures.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:textfield_tags/textfield_tags.dart';
|
import 'package:textfield_tags/textfield_tags.dart';
|
||||||
|
|
||||||
import 'extension.dart';
|
import 'extension.dart';
|
||||||
@ -17,15 +16,16 @@ class SelectOptionTextField extends StatefulWidget {
|
|||||||
final LinkedHashMap<String, SelectOptionPB> selectedOptionMap;
|
final LinkedHashMap<String, SelectOptionPB> selectedOptionMap;
|
||||||
final double distanceToText;
|
final double distanceToText;
|
||||||
final List<String> textSeparators;
|
final List<String> textSeparators;
|
||||||
|
final TextEditingController? textController;
|
||||||
|
|
||||||
final Function(String) onSubmitted;
|
final Function(String) onSubmitted;
|
||||||
final Function(String) newText;
|
final Function(String) newText;
|
||||||
final Function(List<String>, String) onPaste;
|
final Function(List<String>, String) onPaste;
|
||||||
final Function(String) onRemove;
|
final Function(String) onRemove;
|
||||||
final VoidCallback? onClick;
|
final VoidCallback? onClick;
|
||||||
final int? maxLength;
|
|
||||||
|
|
||||||
const SelectOptionTextField({
|
const SelectOptionTextField({
|
||||||
|
super.key,
|
||||||
required this.options,
|
required this.options,
|
||||||
required this.selectedOptionMap,
|
required this.selectedOptionMap,
|
||||||
required this.distanceToText,
|
required this.distanceToText,
|
||||||
@ -35,38 +35,25 @@ class SelectOptionTextField extends StatefulWidget {
|
|||||||
required this.onRemove,
|
required this.onRemove,
|
||||||
required this.newText,
|
required this.newText,
|
||||||
required this.textSeparators,
|
required this.textSeparators,
|
||||||
|
this.textController,
|
||||||
this.onClick,
|
this.onClick,
|
||||||
this.maxLength,
|
});
|
||||||
TextEditingController? textController,
|
|
||||||
FocusNode? focusNode,
|
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SelectOptionTextField> createState() => _SelectOptionTextFieldState();
|
State<SelectOptionTextField> createState() => _SelectOptionTextFieldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
||||||
late FocusNode focusNode;
|
final FocusNode focusNode = FocusNode();
|
||||||
late TextEditingController controller;
|
late final TextEditingController controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
focusNode = FocusNode();
|
super.initState();
|
||||||
controller = TextEditingController();
|
controller = widget.textController ?? TextEditingController();
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
});
|
});
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
String? _suffixText() {
|
|
||||||
if (widget.maxLength != null) {
|
|
||||||
return ' ${controller.text.length}/${widget.maxLength}';
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -107,9 +94,6 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
maxLength: widget.maxLength,
|
|
||||||
maxLengthEnforcement:
|
|
||||||
MaxLengthEnforcement.truncateAfterCompositionEnds,
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
@ -126,8 +110,6 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
|||||||
.textTheme
|
.textTheme
|
||||||
.bodySmall!
|
.bodySmall!
|
||||||
.copyWith(color: Theme.of(context).hintColor),
|
.copyWith(color: Theme.of(context).hintColor),
|
||||||
suffixText: _suffixText(),
|
|
||||||
counterText: "",
|
|
||||||
prefixIconConstraints:
|
prefixIconConstraints:
|
||||||
BoxConstraints(maxWidth: widget.distanceToText),
|
BoxConstraints(maxWidth: widget.distanceToText),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user