File tree Expand file tree Collapse file tree 5 files changed +75
-10
lines changed
frontend/app_flowy/packages/appflowy_editor_plugins Expand file tree Collapse file tree 5 files changed +75
-10
lines changed Original file line number Diff line number Diff line change 11import 'package:appflowy_editor/appflowy_editor.dart' ;
2+ import 'package:appflowy_editor_plugins/src/infra/svg.dart' ;
23import 'package:flutter/material.dart' ;
34import 'package:highlight/highlight.dart' as highlight;
45import 'package:highlight/languages/all.dart' ;
@@ -141,10 +142,11 @@ class __CodeBlockNodeWidgeState extends State<_CodeBlockNodeWidge>
141142 top: - 5 ,
142143 right: - 5 ,
143144 child: IconButton (
144- icon: Icon (
145- Icons .delete_forever_outlined ,
145+ icon: Svg (
146+ name : 'delete' ,
146147 color: widget.editorState.editorStyle.selectionMenuItemIconColor,
147- size: 16 ,
148+ width: 16 ,
149+ height: 16 ,
148150 ),
149151 onPressed: () {
150152 final transaction = widget.editorState.transaction
Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_svg/svg.dart' ;
3+
4+ class Svg extends StatelessWidget {
5+ const Svg ({
6+ Key ? key,
7+ this .name,
8+ this .width,
9+ this .height,
10+ this .color,
11+ this .number,
12+ this .padding,
13+ }) : super (key: key);
14+
15+ final String ? name;
16+ final double ? width;
17+ final double ? height;
18+ final Color ? color;
19+ final int ? number;
20+ final EdgeInsets ? padding;
21+
22+ final _defaultWidth = 20.0 ;
23+ final _defaultHeight = 20.0 ;
24+
25+ @override
26+ Widget build (BuildContext context) {
27+ return Padding (
28+ padding: padding ?? const EdgeInsets .all (0 ),
29+ child: _buildSvg (),
30+ );
31+ }
32+
33+ Widget _buildSvg () {
34+ if (name != null ) {
35+ return SvgPicture .asset (
36+ 'assets/images/$name .svg' ,
37+ color: color,
38+ fit: BoxFit .fill,
39+ height: height,
40+ width: width,
41+ package: 'appflowy_editor_plugins' ,
42+ );
43+ } else if (number != null ) {
44+ final numberText =
45+ '<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><text x="30" y="150" fill="black" font-size="160">$number .</text></svg>' ;
46+ return SvgPicture .string (
47+ numberText,
48+ width: width ?? _defaultWidth,
49+ height: height ?? _defaultHeight,
50+ );
51+ }
52+ return Container ();
53+ }
54+ }
Original file line number Diff line number Diff line change 11import 'package:appflowy_editor/appflowy_editor.dart' ;
2+ import 'package:appflowy_editor_plugins/src/infra/svg.dart' ;
23import 'package:flutter/material.dart' ;
34import 'package:flutter/services.dart' ;
45import 'package:flutter_math_fork/flutter_math.dart' ;
@@ -141,10 +142,11 @@ class _MathEquationNodeWidgetState extends State<_MathEquationNodeWidget> {
141142 top: - 5 ,
142143 right: - 5 ,
143144 child: IconButton (
144- icon: Icon (
145- Icons .delete_forever_outlined ,
145+ icon: Svg (
146+ name : 'delete' ,
146147 color: widget.editorState.editorStyle.selectionMenuItemIconColor,
147- size: 16 ,
148+ width: 16 ,
149+ height: 16 ,
148150 ),
149151 onPressed: () {
150152 final transaction = widget.editorState.transaction
Original file line number Diff line number Diff line change @@ -12,13 +12,14 @@ environment:
1212dependencies :
1313 flutter :
1414 sdk : flutter
15- appflowy_editor :
15+ appflowy_editor :
1616 path : ../appflowy_editor
17- flowy_infra_ui :
17+ flowy_infra_ui :
1818 path : ../flowy_infra_ui
1919 flutter_math_fork : ^0.6.3+1
2020 highlight : ^0.7.0
2121 shared_preferences : ^2.0.15
22+ flutter_svg : ^1.1.1+1
2223
2324dev_dependencies :
2425 flutter_test :
@@ -32,8 +33,8 @@ dev_dependencies:
3233flutter :
3334
3435 # To add assets to your package, add an assets section, like this:
35- # assets:
36- # - images/a_dot_burr.jpeg
36+ assets :
37+ - assets/ images/
3738 # - images/a_dot_ham.jpeg
3839 #
3940 # For details regarding assets in packages, see
You can’t perform that action at this time.
0 commit comments