Skip to content

Commit 609bf2a

Browse files
committed
fix: #1968 UI inconsistency
1 parent 75231e6 commit 609bf2a

File tree

2 files changed

+16
-68
lines changed

2 files changed

+16
-68
lines changed

frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/auto_completion_node_widget.dart

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
99
import 'package:flowy_infra_ui/style_widget/text_field.dart';
1010
import 'package:flowy_infra_ui/widget/spacing.dart';
1111
import 'package:flutter/material.dart';
12-
import 'package:flutter/services.dart';
1312
import 'package:http/http.dart' as http;
1413
import 'package:appflowy/generated/locale_keys.g.dart';
1514
import 'package:easy_localization/easy_localization.dart';
@@ -127,26 +126,12 @@ class _AutoCompletionInputState extends State<_AutoCompletionInput> {
127126
}
128127

129128
Widget _buildInputWidget(BuildContext context) {
130-
return RawKeyboardListener(
131-
focusNode: focusNode,
132-
onKey: (RawKeyEvent event) async {
133-
if (event is! RawKeyDownEvent) return;
134-
if (event.logicalKey == LogicalKeyboardKey.enter) {
135-
if (controller.text.isNotEmpty) {
136-
textFieldFocusNode.unfocus();
137-
await _onGenerate();
138-
}
139-
} else if (event.logicalKey == LogicalKeyboardKey.escape) {
140-
await _onExit();
141-
}
142-
},
143-
child: FlowyTextField(
144-
hintText: LocaleKeys.document_plugins_autoGeneratorHintText.tr(),
145-
controller: controller,
146-
maxLines: 3,
147-
focusNode: textFieldFocusNode,
148-
autoFocus: false,
149-
),
129+
return FlowyTextField(
130+
hintText: LocaleKeys.document_plugins_autoGeneratorHintText.tr(),
131+
controller: controller,
132+
maxLines: 3,
133+
focusNode: textFieldFocusNode,
134+
autoFocus: false,
150135
);
151136
}
152137

@@ -160,12 +145,6 @@ class _AutoCompletionInputState extends State<_AutoCompletionInput> {
160145
text: '${LocaleKeys.button_generate.tr()} ',
161146
style: Theme.of(context).textTheme.bodyMedium,
162147
),
163-
TextSpan(
164-
text: '↵',
165-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
166-
color: Colors.grey,
167-
),
168-
),
169148
],
170149
),
171150
onPressed: () async => await _onGenerate(),
@@ -178,12 +157,6 @@ class _AutoCompletionInputState extends State<_AutoCompletionInput> {
178157
text: '${LocaleKeys.button_Cancel.tr()} ',
179158
style: Theme.of(context).textTheme.bodyMedium,
180159
),
181-
TextSpan(
182-
text: LocaleKeys.button_esc.tr(),
183-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
184-
color: Colors.grey,
185-
),
186-
),
187160
],
188161
),
189162
onPressed: () async => await _onExit(),

frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/openai/widgets/smart_edit_node_widget.dart

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:flowy_infra_ui/style_widget/button.dart';
88
import 'package:flowy_infra_ui/style_widget/text.dart';
99
import 'package:flowy_infra_ui/widget/spacing.dart';
1010
import 'package:flutter/material.dart';
11-
import 'package:flutter/services.dart';
1211
import 'package:appflowy/generated/locale_keys.g.dart';
1312
import 'package:easy_localization/easy_localization.dart';
1413
import 'package:http/http.dart' as http;
@@ -99,28 +98,16 @@ class _SmartEditInputState extends State<_SmartEditInput> {
9998
}
10099

101100
Widget _buildSmartEditPanel(BuildContext context) {
102-
return RawKeyboardListener(
103-
focusNode: focusNode,
104-
onKey: (RawKeyEvent event) async {
105-
if (event is! RawKeyDownEvent) return;
106-
if (event.logicalKey == LogicalKeyboardKey.enter) {
107-
await _onReplace();
108-
await _onExit();
109-
} else if (event.logicalKey == LogicalKeyboardKey.escape) {
110-
await _onExit();
111-
}
112-
},
113-
child: Column(
114-
mainAxisSize: MainAxisSize.min,
115-
crossAxisAlignment: CrossAxisAlignment.start,
116-
children: [
117-
_buildHeaderWidget(context),
118-
const Space(0, 10),
119-
_buildResultWidget(context),
120-
const Space(0, 10),
121-
_buildInputFooterWidget(context),
122-
],
123-
),
101+
return Column(
102+
mainAxisSize: MainAxisSize.min,
103+
crossAxisAlignment: CrossAxisAlignment.start,
104+
children: [
105+
_buildHeaderWidget(context),
106+
const Space(0, 10),
107+
_buildResultWidget(context),
108+
const Space(0, 10),
109+
_buildInputFooterWidget(context),
110+
],
124111
);
125112
}
126113

@@ -178,12 +165,6 @@ class _SmartEditInputState extends State<_SmartEditInput> {
178165
text: '${LocaleKeys.button_replace.tr()} ',
179166
style: Theme.of(context).textTheme.bodyMedium,
180167
),
181-
TextSpan(
182-
text: '↵',
183-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
184-
color: Colors.grey,
185-
),
186-
),
187168
],
188169
),
189170
onPressed: () {
@@ -199,12 +180,6 @@ class _SmartEditInputState extends State<_SmartEditInput> {
199180
text: '${LocaleKeys.button_Cancel.tr()} ',
200181
style: Theme.of(context).textTheme.bodyMedium,
201182
),
202-
TextSpan(
203-
text: LocaleKeys.button_esc.tr(),
204-
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
205-
color: Colors.grey,
206-
),
207-
),
208183
],
209184
),
210185
onPressed: () async => await _onExit(),

0 commit comments

Comments
 (0)