mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #960 from AppFlowy-IO/fix/docker_build
chore: run command in sudo mode
This commit is contained in:
commit
bc69cb5aa9
@ -80,23 +80,7 @@ class _BoardContentState extends State<BoardContent> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocListener<BoardBloc, BoardState>(
|
return BlocListener<BoardBloc, BoardState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) => _handleEditState(state, context),
|
||||||
state.editingRow.fold(
|
|
||||||
() => null,
|
|
||||||
(editingRow) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
if (editingRow.index != null) {
|
|
||||||
} else {
|
|
||||||
scrollManager.scrollToBottom(editingRow.columnId, () {
|
|
||||||
context
|
|
||||||
.read<BoardBloc>()
|
|
||||||
.add(BoardEvent.endEditRow(editingRow.row.id));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: BlocBuilder<BoardBloc, BoardState>(
|
child: BlocBuilder<BoardBloc, BoardState>(
|
||||||
buildWhen: (previous, current) =>
|
buildWhen: (previous, current) =>
|
||||||
previous.groupIds.length != current.groupIds.length,
|
previous.groupIds.length != current.groupIds.length,
|
||||||
@ -137,6 +121,27 @@ class _BoardContentState extends State<BoardContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleEditState(BoardState state, BuildContext context) {
|
||||||
|
state.editingRow.fold(
|
||||||
|
() => null,
|
||||||
|
(editingRow) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (editingRow.index != null) {
|
||||||
|
context
|
||||||
|
.read<BoardBloc>()
|
||||||
|
.add(BoardEvent.endEditRow(editingRow.row.id));
|
||||||
|
} else {
|
||||||
|
scrollManager.scrollToBottom(editingRow.columnId, () {
|
||||||
|
context
|
||||||
|
.read<BoardBloc>()
|
||||||
|
.add(BoardEvent.endEditRow(editingRow.row.id));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
scrollController.dispose();
|
scrollController.dispose();
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
import 'board_cell.dart';
|
import 'board_cell.dart';
|
||||||
|
import 'define.dart';
|
||||||
|
|
||||||
class BoardTextCell extends StatefulWidget with EditableCell {
|
class BoardTextCell extends StatefulWidget with EditableCell {
|
||||||
final String groupId;
|
final String groupId;
|
||||||
@ -29,6 +30,7 @@ class BoardTextCell extends StatefulWidget with EditableCell {
|
|||||||
class _BoardTextCellState extends State<BoardTextCell> {
|
class _BoardTextCellState extends State<BoardTextCell> {
|
||||||
late BoardTextCellBloc _cellBloc;
|
late BoardTextCellBloc _cellBloc;
|
||||||
late TextEditingController _controller;
|
late TextEditingController _controller;
|
||||||
|
bool focusWhenInit = false;
|
||||||
SingleListenerFocusNode focusNode = SingleListenerFocusNode();
|
SingleListenerFocusNode focusNode = SingleListenerFocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -38,6 +40,7 @@ class _BoardTextCellState extends State<BoardTextCell> {
|
|||||||
_cellBloc = BoardTextCellBloc(cellController: cellController)
|
_cellBloc = BoardTextCellBloc(cellController: cellController)
|
||||||
..add(const BoardTextCellEvent.initial());
|
..add(const BoardTextCellEvent.initial());
|
||||||
_controller = TextEditingController(text: _cellBloc.state.content);
|
_controller = TextEditingController(text: _cellBloc.state.content);
|
||||||
|
focusWhenInit = widget.isFocus;
|
||||||
|
|
||||||
if (widget.isFocus) {
|
if (widget.isFocus) {
|
||||||
focusNode.requestFocus();
|
focusNode.requestFocus();
|
||||||
@ -46,6 +49,12 @@ class _BoardTextCellState extends State<BoardTextCell> {
|
|||||||
focusNode.addListener(() {
|
focusNode.addListener(() {
|
||||||
if (!focusNode.hasFocus) {
|
if (!focusNode.hasFocus) {
|
||||||
_cellBloc.add(const BoardTextCellEvent.enableEdit(false));
|
_cellBloc.add(const BoardTextCellEvent.enableEdit(false));
|
||||||
|
|
||||||
|
if (focusWhenInit) {
|
||||||
|
setState(() {
|
||||||
|
focusWhenInit = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -77,38 +86,19 @@ class _BoardTextCellState extends State<BoardTextCell> {
|
|||||||
},
|
},
|
||||||
child: BlocBuilder<BoardTextCellBloc, BoardTextCellState>(
|
child: BlocBuilder<BoardTextCellBloc, BoardTextCellState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
Widget child;
|
if (state.content.isEmpty &&
|
||||||
if (state.content.isEmpty && state.enableEdit == false) {
|
state.enableEdit == false &&
|
||||||
child = const SizedBox();
|
focusWhenInit == false) {
|
||||||
} else {
|
return const SizedBox();
|
||||||
if (state.enableEdit) {
|
|
||||||
child = TextField(
|
|
||||||
controller: _controller,
|
|
||||||
focusNode: focusNode,
|
|
||||||
onChanged: (value) => focusChanged(),
|
|
||||||
onEditingComplete: () => focusNode.unfocus(),
|
|
||||||
maxLines: 1,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
fontFamily: 'Mulish',
|
|
||||||
),
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
// Magic number 4 makes the textField take up the same space as FlowyText
|
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 4),
|
|
||||||
border: InputBorder.none,
|
|
||||||
isDense: true,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
child = FlowyText.medium(state.content, fontSize: 14);
|
|
||||||
child = Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Widget child;
|
||||||
|
if (state.enableEdit || focusWhenInit) {
|
||||||
|
child = _buildTextField();
|
||||||
|
} else {
|
||||||
|
child = _buildText(state);
|
||||||
|
}
|
||||||
return Align(alignment: Alignment.centerLeft, child: child);
|
return Align(alignment: Alignment.centerLeft, child: child);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -127,4 +117,36 @@ class _BoardTextCellState extends State<BoardTextCell> {
|
|||||||
focusNode.dispose();
|
focusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildText(BoardTextCellState state) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: BoardSizes.cardCellVPadding,
|
||||||
|
),
|
||||||
|
child: FlowyText.medium(state.content, fontSize: 14),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTextField() {
|
||||||
|
return TextField(
|
||||||
|
controller: _controller,
|
||||||
|
focusNode: focusNode,
|
||||||
|
onChanged: (value) => focusChanged(),
|
||||||
|
onEditingComplete: () => focusNode.unfocus(),
|
||||||
|
maxLines: 1,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontFamily: 'Mulish',
|
||||||
|
),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
// Magic number 4 makes the textField take up the same space as FlowyText
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: BoardSizes.cardCellVPadding + 4,
|
||||||
|
),
|
||||||
|
border: InputBorder.none,
|
||||||
|
isDense: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ RUN flutter channel stable
|
|||||||
RUN flutter config --enable-linux-desktop
|
RUN flutter config --enable-linux-desktop
|
||||||
RUN flutter doctor
|
RUN flutter doctor
|
||||||
RUN dart pub global activate protoc_plugin
|
RUN dart pub global activate protoc_plugin
|
||||||
RUN pacman -Syu --needed --noconfirm git xdg-user-dirs libkeybinder3
|
RUN sudo pacman -Syu --needed --noconfirm git xdg-user-dirs libkeybinder3
|
||||||
|
|
||||||
RUN git clone https://github.com/AppFlowy-IO/appflowy.git && \
|
RUN git clone https://github.com/AppFlowy-IO/appflowy.git && \
|
||||||
cd appflowy/frontend && \
|
cd appflowy/frontend && \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user