feat: keep the toolbar the same height as the keyboard to optimize the editing experience (#3947)

This commit is contained in:
Lucas.Xu
2023-11-17 13:51:26 +08:00
committed by GitHub
parent 68de83c611
commit d190850f03
67 changed files with 1731 additions and 486 deletions

View File

@ -72,6 +72,7 @@ class _FlowyIconPickerState extends State<FlowyIconPicker>
child: TabBarView(
children: [
FlowyEmojiPicker(
emojiPerLine: _getEmojiPerLine(),
onEmojiSelected: (_, emoji) {
widget.onSelected(
EmojiPickerResult(
@ -116,6 +117,11 @@ class _FlowyIconPickerState extends State<FlowyIconPicker>
),
);
}
int _getEmojiPerLine() {
final width = MediaQuery.of(context).size.width;
return width ~/ 46.0; // the size of the emoji
}
}
class _RemoveIconButton extends StatelessWidget {

View File

@ -6,26 +6,23 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class IconPickerPage extends StatefulWidget {
class IconPickerPage extends StatelessWidget {
const IconPickerPage({
super.key,
this.title,
required this.onSelected,
});
final void Function(EmojiPickerResult) onSelected;
final String? title;
@override
State<IconPickerPage> createState() => _IconPickerPageState();
}
class _IconPickerPageState extends State<IconPickerPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
title: FlowyText.semibold(
LocaleKeys.titleBar_pageIcon.tr(),
title ?? LocaleKeys.titleBar_pageIcon.tr(),
fontSize: 14.0,
),
leading: AppBarBackButton(
@ -34,7 +31,7 @@ class _IconPickerPageState extends State<IconPickerPage> {
),
body: SafeArea(
child: FlowyIconPicker(
onSelected: widget.onSelected,
onSelected: onSelected,
),
),
);