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: () {
|
||||
FlowyOverlay.show(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
builder: (_) {
|
||||
return RowDetailPage(
|
||||
fieldController:
|
||||
context.read<BoardBloc>().fieldController,
|
||||
|
@ -47,10 +47,10 @@ class _MobileChecklistCellEditScreenState
|
||||
child: _buildHeader(context),
|
||||
),
|
||||
const Divider(),
|
||||
Expanded(
|
||||
const Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0.0),
|
||||
child: _buildBody(context),
|
||||
padding: EdgeInsets.symmetric(horizontal: 0.0),
|
||||
child: _TaskList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -91,20 +91,10 @@ class _MobileChecklistCellEditScreenState
|
||||
].map((e) => SizedBox(height: height, child: e)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
return _TaskList(
|
||||
onCreateOption: (optionName) {},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TaskList extends StatelessWidget {
|
||||
const _TaskList({
|
||||
required this.onCreateOption,
|
||||
});
|
||||
|
||||
final void Function(String optionName) onCreateOption;
|
||||
const _TaskList();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -180,6 +170,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(left: 5, right: 16),
|
||||
height: 44,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@ -205,10 +196,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
||||
child: TextField(
|
||||
controller: _textController,
|
||||
focusNode: _focusNode,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
?.copyWith(fontSize: 15),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
maxLines: 1,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
@ -227,47 +215,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
|
||||
),
|
||||
InkWell(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
onTap: () => 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),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: _showDeleteTaskBottomSheet,
|
||||
child: SizedBox.square(
|
||||
dimension: 44,
|
||||
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 {
|
||||
|
@ -148,7 +148,6 @@ class SelectOptionTagCell extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: SelectOptionTag(
|
||||
option: option,
|
||||
fontSize: 11,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
|
||||
),
|
||||
|
@ -27,8 +27,7 @@ class SelectOptionCellEditor extends StatefulWidget {
|
||||
final SelectOptionCellController cellController;
|
||||
static double editorPanelWidth = 300;
|
||||
|
||||
const SelectOptionCellEditor({required this.cellController, Key? key})
|
||||
: super(key: key);
|
||||
const SelectOptionCellEditor({super.key, required this.cellController});
|
||||
|
||||
@override
|
||||
State<SelectOptionCellEditor> createState() => _SelectOptionCellEditorState();
|
||||
@ -82,8 +81,7 @@ class _OptionList extends StatelessWidget {
|
||||
const _OptionList({
|
||||
required this.popoverMutex,
|
||||
required this.tagController,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -138,8 +136,7 @@ class _TextField extends StatelessWidget {
|
||||
const _TextField({
|
||||
required this.popoverMutex,
|
||||
required this.tagController,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -290,8 +287,7 @@ class _SelectOptionCell extends StatefulWidget {
|
||||
required this.option,
|
||||
required this.isSelected,
|
||||
required this.popoverMutex,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
State<_SelectOptionCell> createState() => _SelectOptionCellState();
|
||||
|
@ -6,7 +6,6 @@ import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:textfield_tags/textfield_tags.dart';
|
||||
|
||||
import 'extension.dart';
|
||||
@ -17,15 +16,16 @@ class SelectOptionTextField extends StatefulWidget {
|
||||
final LinkedHashMap<String, SelectOptionPB> selectedOptionMap;
|
||||
final double distanceToText;
|
||||
final List<String> textSeparators;
|
||||
final TextEditingController? textController;
|
||||
|
||||
final Function(String) onSubmitted;
|
||||
final Function(String) newText;
|
||||
final Function(List<String>, String) onPaste;
|
||||
final Function(String) onRemove;
|
||||
final VoidCallback? onClick;
|
||||
final int? maxLength;
|
||||
|
||||
const SelectOptionTextField({
|
||||
super.key,
|
||||
required this.options,
|
||||
required this.selectedOptionMap,
|
||||
required this.distanceToText,
|
||||
@ -35,38 +35,25 @@ class SelectOptionTextField extends StatefulWidget {
|
||||
required this.onRemove,
|
||||
required this.newText,
|
||||
required this.textSeparators,
|
||||
this.textController,
|
||||
this.onClick,
|
||||
this.maxLength,
|
||||
TextEditingController? textController,
|
||||
FocusNode? focusNode,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
State<SelectOptionTextField> createState() => _SelectOptionTextFieldState();
|
||||
}
|
||||
|
||||
class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
||||
late FocusNode focusNode;
|
||||
late TextEditingController controller;
|
||||
final FocusNode focusNode = FocusNode();
|
||||
late final TextEditingController controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
focusNode = FocusNode();
|
||||
controller = TextEditingController();
|
||||
|
||||
super.initState();
|
||||
controller = widget.textController ?? TextEditingController();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
focusNode.requestFocus();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
String? _suffixText() {
|
||||
if (widget.maxLength != null) {
|
||||
return ' ${controller.text.length}/${widget.maxLength}';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -107,9 +94,6 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
maxLength: widget.maxLength,
|
||||
maxLengthEnforcement:
|
||||
MaxLengthEnforcement.truncateAfterCompositionEnds,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
@ -126,8 +110,6 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: Theme.of(context).hintColor),
|
||||
suffixText: _suffixText(),
|
||||
counterText: "",
|
||||
prefixIconConstraints:
|
||||
BoxConstraints(maxWidth: widget.distanceToText),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
|
Loading…
Reference in New Issue
Block a user