feat: adjust toggle list, callout, quote and divider on mobile (#3894)

* feat: adjust toggle list block

* feat: show block actions when tapping divider

* feat: add toggle list and callout to toolbar

* feat: refactor the emoji picker button

* fix: toggle list integration tests
This commit is contained in:
Lucas.Xu
2023-11-08 21:10:29 +08:00
committed by GitHub
parent 663f9d3423
commit afc6473582
20 changed files with 308 additions and 108 deletions

View File

@ -12,13 +12,23 @@ enum FlowyIconType {
custom;
}
class EmojiPickerResult {
const EmojiPickerResult(
this.type,
this.emoji,
);
final FlowyIconType type;
final String emoji;
}
class FlowyIconPicker extends StatefulWidget {
const FlowyIconPicker({
super.key,
required this.onSelected,
});
final void Function(FlowyIconType type, String value) onSelected;
final void Function(EmojiPickerResult result) onSelected;
@override
State<FlowyIconPicker> createState() => _FlowyIconPickerState();
@ -45,7 +55,12 @@ class _FlowyIconPickerState extends State<FlowyIconPicker>
const Spacer(),
_RemoveIconButton(
onTap: () {
widget.onSelected(FlowyIconType.icon, '');
widget.onSelected(
const EmojiPickerResult(
FlowyIconType.icon,
'',
),
);
},
),
],
@ -58,7 +73,12 @@ class _FlowyIconPickerState extends State<FlowyIconPicker>
children: [
FlowyEmojiPicker(
onEmojiSelected: (_, emoji) {
widget.onSelected(FlowyIconType.emoji, emoji);
widget.onSelected(
EmojiPickerResult(
FlowyIconType.emoji,
emoji,
),
);
},
),
],

View File

@ -1,6 +1,5 @@
import 'package:appflowy/mobile/presentation/base/app_bar_actions.dart';
import 'package:appflowy/plugins/base/icon/icon_picker.dart';
import 'package:appflowy/workspace/application/view/view_service.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@ -8,11 +7,10 @@ import 'package:go_router/go_router.dart';
class IconPickerPage extends StatefulWidget {
const IconPickerPage({
super.key,
required this.id,
required this.onSelected,
});
/// view id
final String id;
final void Function(EmojiPickerResult) onSelected;
@override
State<IconPickerPage> createState() => _IconPickerPageState();
@ -34,13 +32,7 @@ class _IconPickerPageState extends State<IconPickerPage> {
),
body: SafeArea(
child: FlowyIconPicker(
onSelected: (_, emoji) {
ViewBackendService.updateViewIcon(
viewId: widget.id,
viewIcon: emoji,
);
context.pop();
},
onSelected: widget.onSelected,
),
),
);