Skip to content

Commit b3b13e5

Browse files
authored
chore: adjust popover shadows (#7626)
1 parent ba1767e commit b3b13e5

3 files changed

Lines changed: 30 additions & 37 deletions

File tree

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/ai_writer_block_component.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class _OverlayContentState extends State<OverlayContent> {
226226
final showSuggestedActionsWithin =
227227
showSuggestedActions && markdownText.isNotEmpty;
228228

229-
final darkBorderColor = Theme.of(context).isLightMode
229+
final borderColor = Theme.of(context).isLightMode
230230
? Color(0x1F1F2329)
231231
: Color(0xFF505469);
232232

@@ -241,7 +241,7 @@ class _OverlayContentState extends State<OverlayContent> {
241241
context,
242242
color: Theme.of(context).colorScheme.surface,
243243
borderRadius: BorderRadius.all(Radius.circular(8.0)),
244-
borderColor: darkBorderColor,
244+
borderColor: borderColor,
245245
),
246246
child: SuggestionActionBar(
247247
currentCommand: command,
@@ -257,7 +257,7 @@ class _OverlayContentState extends State<OverlayContent> {
257257
decoration: _getModalDecoration(
258258
context,
259259
color: null,
260-
borderColor: darkBorderColor,
260+
borderColor: borderColor,
261261
borderRadius: BorderRadius.all(Radius.circular(12.0)),
262262
),
263263
constraints: BoxConstraints(maxHeight: 400),
@@ -341,13 +341,9 @@ class _OverlayContentState extends State<OverlayContent> {
341341
strokeAlign: BorderSide.strokeAlignOutside,
342342
),
343343
borderRadius: borderRadius,
344-
boxShadow: const [
345-
BoxShadow(
346-
offset: Offset(0, 4),
347-
blurRadius: 20,
348-
color: Color(0x1A1F2329),
349-
),
350-
],
344+
boxShadow: Theme.of(context).isLightMode
345+
? ShadowConstants.lightSmall
346+
: ShadowConstants.darkSmall,
351347
);
352348
}
353349

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/widgets/ai_writer_prompt_input_more_button.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:appflowy/ai/ai.dart';
22
import 'package:appflowy/generated/flowy_svgs.g.dart';
33
import 'package:appflowy/generated/locale_keys.g.dart';
4+
import 'package:appflowy/util/theme_extension.dart';
45
import 'package:appflowy_editor/appflowy_editor.dart';
56
import 'package:easy_localization/easy_localization.dart';
67
import 'package:flowy_infra/colorscheme/default_colorscheme.dart';
@@ -102,13 +103,9 @@ class MoreAiWriterCommands extends StatelessWidget {
102103
strokeAlign: BorderSide.strokeAlignOutside,
103104
),
104105
borderRadius: BorderRadius.all(Radius.circular(8.0)),
105-
boxShadow: const [
106-
BoxShadow(
107-
offset: Offset(0, 4),
108-
blurRadius: 20,
109-
color: Color(0x1A1F2329),
110-
),
111-
],
106+
boxShadow: Theme.of(context).isLightMode
107+
? ShadowConstants.lightSmall
108+
: ShadowConstants.darkSmall,
112109
),
113110
child: IntrinsicWidth(
114111
child: Column(

frontend/appflowy_flutter/packages/flowy_infra_ui/lib/src/flowy_overlay/appflowy_popover.dart

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ import 'package:flutter/material.dart';
44

55
export 'package:appflowy_popover/appflowy_popover.dart';
66

7+
class ShadowConstants {
8+
ShadowConstants._();
9+
10+
static const List<BoxShadow> lightSmall = [
11+
BoxShadow(offset: Offset(0, 4), blurRadius: 20, color: Color(0x1A1F2329)),
12+
];
13+
static const List<BoxShadow> lightMedium = [
14+
BoxShadow(offset: Offset(0, 4), blurRadius: 32, color: Color(0x121F2225)),
15+
];
16+
static const List<BoxShadow> darkSmall = [
17+
BoxShadow(offset: Offset(0, 2), blurRadius: 16, color: Color(0x5C000000)),
18+
];
19+
static const List<BoxShadow> darkMedium = [
20+
BoxShadow(offset: Offset(0, 4), blurRadius: 32, color: Color(0x5C000000)),
21+
];
22+
}
23+
724
class AppFlowyPopover extends StatelessWidget {
825
const AppFlowyPopover({
926
super.key,
@@ -162,26 +179,9 @@ extension PopoverDecoration on BuildContext {
162179
final borderColor = Theme.of(this).brightness == Brightness.light
163180
? ColorSchemeConstants.lightBorderColor
164181
: ColorSchemeConstants.darkBorderColor;
165-
final shadows = [
166-
const BoxShadow(
167-
color: Color(0x0A1F2329),
168-
blurRadius: 24,
169-
offset: Offset(0, 8),
170-
spreadRadius: 8,
171-
),
172-
const BoxShadow(
173-
color: Color(0x0A1F2329),
174-
blurRadius: 12,
175-
offset: Offset(0, 6),
176-
spreadRadius: 0,
177-
),
178-
const BoxShadow(
179-
color: Color(0x0F1F2329),
180-
blurRadius: 8,
181-
offset: Offset(0, 4),
182-
spreadRadius: -8,
183-
)
184-
];
182+
final shadows = Theme.of(this).brightness == Brightness.light
183+
? ShadowConstants.lightSmall
184+
: ShadowConstants.darkSmall;
185185
return ShapeDecoration(
186186
color: color ?? Theme.of(this).cardColor,
187187
shape: RoundedRectangleBorder(

0 commit comments

Comments
 (0)