[flutter]: auto focus if the document is empty

This commit is contained in:
appflowy
2021-10-25 19:25:58 +08:00
parent db9d9bc840
commit 43d7636269
2 changed files with 2 additions and 10 deletions

View File

@ -73,7 +73,7 @@ class _DocPageState extends State<DocPage> {
controller: controller, controller: controller,
focusNode: _focusNode, focusNode: _focusNode,
scrollable: true, scrollable: true,
autoFocus: false, autoFocus: controller.document.isEmpty(),
expands: false, expands: false,
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 8.0),
readOnly: false, readOnly: false,

View File

@ -83,13 +83,6 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final iconColor = _isToggledColor && !widget.background && !_isWhite
? stringToColor(_selectionStyle.attributes['color']!.value)
: (widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color);
final iconColorBackground = _isToggledBackground && widget.background && !_isWhitebackground
? stringToColor(_selectionStyle.attributes['background']!.value)
: (widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color);
final fillColor = _isToggledColor && !widget.background && _isWhite final fillColor = _isToggledColor && !widget.background && _isWhite
? stringToColor('#ffffff') ? stringToColor('#ffffff')
@ -102,7 +95,7 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
highlightElevation: 0, highlightElevation: 0,
hoverElevation: 0, hoverElevation: 0,
size: widget.iconSize * kIconButtonFactor, size: widget.iconSize * kIconButtonFactor,
icon: Icon(widget.icon, size: widget.iconSize, color: widget.background ? iconColorBackground : iconColor), icon: Icon(widget.icon, size: widget.iconSize, color: theme.iconTheme.color),
fillColor: widget.background ? fillColorBackground : fillColor, fillColor: widget.background ? fillColorBackground : fillColor,
onPressed: _showColorPicker, onPressed: _showColorPicker,
); );
@ -168,7 +161,6 @@ class FlowyColorPicker extends StatefulWidget {
0xfff5ffdc, 0xfff5ffdc,
0xffddffd6, 0xffddffd6,
0xffdefff1, 0xffdefff1,
0xffdefff1,
]; ];
final Function(Color?) onColorChanged; final Function(Color?) onColorChanged;
final int initailColor; final int initailColor;