fix: chat messaage color doesn't update when switching theme (#5815)

This commit is contained in:
Lucas.Xu 2024-07-26 10:08:00 +08:00 committed by GitHub
parent 29fb4af40a
commit 043cd3f3bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 12 deletions

View File

@ -52,15 +52,6 @@ class _AppFlowyEditorMarkdown extends StatefulWidget {
class _AppFlowyEditorMarkdownState extends State<_AppFlowyEditorMarkdown> { class _AppFlowyEditorMarkdownState extends State<_AppFlowyEditorMarkdown> {
late EditorState editorState; late EditorState editorState;
late final styleCustomizer = EditorStyleCustomizer(
context: context,
padding: EdgeInsets.zero,
);
late final editorStyle = styleCustomizer.style().copyWith(
// hide the cursor
cursorColor: Colors.transparent,
cursorWidth: 0,
);
late EditorScrollController scrollController; late EditorScrollController scrollController;
@override @override
@ -99,6 +90,17 @@ class _AppFlowyEditorMarkdownState extends State<_AppFlowyEditorMarkdown> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// don't lazy load the styleCustomizer and blockBuilders,
// it needs the context to get the theme.
final styleCustomizer = EditorStyleCustomizer(
context: context,
padding: EdgeInsets.zero,
);
final editorStyle = styleCustomizer.style().copyWith(
// hide the cursor
cursorColor: Colors.transparent,
cursorWidth: 0,
);
final blockBuilders = getEditorBuilderMap( final blockBuilders = getEditorBuilderMap(
context: context, context: context,
editorState: editorState, editorState: editorState,

View File

@ -1,8 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart';
import 'package:appflowy/core/helpers/url_launcher.dart'; import 'package:appflowy/core/helpers/url_launcher.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
@ -16,6 +14,7 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/snap_bar.dart'; import 'package:flowy_infra_ui/style_widget/snap_bar.dart';
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart'; import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:path/path.dart'; import 'package:path/path.dart';
@ -104,7 +103,7 @@ class InteractiveImageToolbar extends StatelessWidget {
), ),
AppFlowyPopover( AppFlowyPopover(
offset: const Offset(0, -8), offset: const Offset(0, -8),
decoration: const BoxDecoration(color: Colors.transparent), decorationColor: Colors.transparent,
direction: PopoverDirection.topWithCenterAligned, direction: PopoverDirection.topWithCenterAligned,
constraints: const BoxConstraints(maxHeight: 50), constraints: const BoxConstraints(maxHeight: 50),
popupBuilder: (context) => _renderToolbarItems( popupBuilder: (context) => _renderToolbarItems(