Skip to content

Commit 0b3c904

Browse files
authored
feat: add block menu (#4222)
* feat: add block menu * fix: android add block issue
1 parent 1e16168 commit 0b3c904

20 files changed

+395
-8
lines changed

frontend/appflowy_flutter/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 33
29+
compileSdkVersion 34
3030
ndkVersion "24.0.8215888"
3131

3232
compileOptions {

frontend/appflowy_flutter/lib/mobile/presentation/mobile_bottom_navigation_bar.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class MobileBottomNavigationBar extends StatelessWidget {
1919
final style = Theme.of(context);
2020

2121
return Scaffold(
22-
backgroundColor: Colors.red,
2322
body: navigationShell,
2423
bottomNavigationBar: BottomNavigationBar(
2524
showSelectedLabels: false,

frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DocumentBloc extends Bloc<DocumentEvent, DocumentState> {
5959
await _viewListener.stop();
6060
await _subscription?.cancel();
6161
await _documentService.closeDocument(view: view);
62-
state.editorState?.selection = null;
62+
state.editorState?.service.keyboardService?.closeKeyboard();
6363
state.editorState?.dispose();
6464
return super.close();
6565
}

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import 'package:collection/collection.dart';
2222
import 'package:flowy_infra/theme_extension.dart';
2323
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
2424
import 'package:flutter/material.dart';
25+
import 'package:flutter/services.dart';
2526
import 'package:flutter_bloc/flutter_bloc.dart';
2627

2728
final List<CommandShortcutEvent> commandShortcutEvents = [
@@ -215,6 +216,8 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
215216

216217
@override
217218
void dispose() {
219+
SystemChannels.textInput.invokeMethod('TextInput.hide');
220+
218221
if (widget.scrollController == null) {
219222
effectiveScrollController.dispose();
220223
}

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_add_block_toolbar_item.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ bool _unSelectable(
228228
return false;
229229
}
230230

231-
extension on EditorState {
231+
extension EditorStateAddBlock on EditorState {
232232
Future<void> insertBlockOrReplaceCurrentBlock(
233233
Selection selection,
234234
Node insertedNode,
@@ -257,7 +257,8 @@ extension on EditorState {
257257
..deleteNode(node)
258258
..afterSelection = Selection.collapsed(
259259
Position(path: path, offset: 0),
260-
);
260+
)
261+
..selectionExtraInfo = null;
261262
}
262263
await apply(transaction);
263264
service.keyboardService?.enableKeyBoard(selection);
@@ -319,10 +320,10 @@ extension on EditorState {
319320
paragraphNode(),
320321
);
321322
}
323+
transaction.selectionExtraInfo = {};
322324
transaction.afterSelection = Selection.collapsed(
323325
Position(path: insertedPath.next),
324326
);
325327
await apply(transaction);
326-
service.keyboardService?.enableKeyBoard(selection);
327328
}
328329
}

0 commit comments

Comments
 (0)