mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: custom upload image menu style
This commit is contained in:
parent
a68903918c
commit
799ed2fdb9
@ -2,6 +2,7 @@ import 'package:appflowy_editor/src/core/document/node.dart';
|
|||||||
import 'package:appflowy_editor/src/editor_state.dart';
|
import 'package:appflowy_editor/src/editor_state.dart';
|
||||||
import 'package:appflowy_editor/src/infra/flowy_svg.dart';
|
import 'package:appflowy_editor/src/infra/flowy_svg.dart';
|
||||||
import 'package:appflowy_editor/src/render/selection_menu/selection_menu_service.dart';
|
import 'package:appflowy_editor/src/render/selection_menu/selection_menu_service.dart';
|
||||||
|
import 'package:appflowy_editor/src/render/style/editor_style.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
OverlayEntry? _imageUploadMenu;
|
OverlayEntry? _imageUploadMenu;
|
||||||
@ -20,6 +21,7 @@ void showImageUploadMenu(
|
|||||||
left: menuService.topLeft.dx,
|
left: menuService.topLeft.dx,
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ImageUploadMenu(
|
child: ImageUploadMenu(
|
||||||
|
editorState: editorState,
|
||||||
onSubmitted: (text) {
|
onSubmitted: (text) {
|
||||||
// _dismissImageUploadMenu();
|
// _dismissImageUploadMenu();
|
||||||
editorState.insertImageNode(text);
|
editorState.insertImageNode(text);
|
||||||
@ -53,10 +55,12 @@ class ImageUploadMenu extends StatefulWidget {
|
|||||||
Key? key,
|
Key? key,
|
||||||
required this.onSubmitted,
|
required this.onSubmitted,
|
||||||
required this.onUpload,
|
required this.onUpload,
|
||||||
|
this.editorState,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final void Function(String text) onSubmitted;
|
final void Function(String text) onSubmitted;
|
||||||
final void Function(String text) onUpload;
|
final void Function(String text) onUpload;
|
||||||
|
final EditorState? editorState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ImageUploadMenu> createState() => _ImageUploadMenuState();
|
State<ImageUploadMenu> createState() => _ImageUploadMenuState();
|
||||||
@ -66,6 +70,8 @@ class _ImageUploadMenuState extends State<ImageUploadMenu> {
|
|||||||
final _textEditingController = TextEditingController();
|
final _textEditingController = TextEditingController();
|
||||||
final _focusNode = FocusNode();
|
final _focusNode = FocusNode();
|
||||||
|
|
||||||
|
EditorStyle? get style => widget.editorState?.editorStyle;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -84,7 +90,7 @@ class _ImageUploadMenuState extends State<ImageUploadMenu> {
|
|||||||
width: 300,
|
width: 300,
|
||||||
padding: const EdgeInsets.all(24.0),
|
padding: const EdgeInsets.all(24.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: style?.selectionMenuBackgroundColor ?? Colors.white,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
blurRadius: 5,
|
blurRadius: 5,
|
||||||
@ -108,12 +114,12 @@ class _ImageUploadMenuState extends State<ImageUploadMenu> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildHeader(BuildContext context) {
|
Widget _buildHeader(BuildContext context) {
|
||||||
return const Text(
|
return Text(
|
||||||
'URL Image',
|
'URL Image',
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
color: Colors.black,
|
color: style?.selectionMenuItemTextColor ?? Colors.black,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user