Skip to content

Commit 5adf313

Browse files
authored
Merge pull request #1507 from LucasXu0/remove_svg_function
Remove svg function
2 parents fba6976 + c127fd2 commit 5adf313

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

frontend/app_flowy/lib/workspace/presentation/home/menu/app/create_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class NewAppButton extends StatelessWidget {
2020
hoverColor: Colors.transparent,
2121
fontColor: Theme.of(context).colorScheme.onSurfaceVariant,
2222
onPressed: () async => await _showCreateAppDialog(context),
23-
heading: svgWithSize("home/new_app", const Size(16, 16)),
23+
heading: svgWidget("home/new_app", size: const Size(16, 16)),
2424
padding: EdgeInsets.symmetric(horizontal: Insets.l, vertical: 20),
2525
);
2626

frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ class MenuTopBar extends StatelessWidget {
207207
return Container();
208208
}
209209
return (Theme.of(context).brightness == Brightness.dark
210-
? svgWithSize("flowy_logo_dark_mode", const Size(92, 17))
211-
: svgWithSize("flowy_logo_with_text", const Size(92, 17)));
210+
? svgWidget("flowy_logo_dark_mode", size: const Size(92, 17))
211+
: svgWidget("flowy_logo_with_text", size: const Size(92, 17)));
212212
}
213213

214214
@override

frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class _CurrentIcon extends StatelessWidget {
118118
margin: const EdgeInsets.all(5.0),
119119
decoration:
120120
BoxDecoration(border: Border.all(color: Colors.grey)),
121-
child: svgWithSize('emoji/$iconUrl', const Size(60, 60)),
121+
child: svgWidget('emoji/$iconUrl', size: const Size(60, 60)),
122122
)),
123123
])),
124124
);

frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/checkbox_text.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
8383
children: [
8484
GestureDetector(
8585
key: iconKey,
86-
child: icon,
8786
behavior: HitTestBehavior.opaque,
8887
onTap: () async {
8988
await widget.editorState.formatTextToCheckbox(
@@ -92,6 +91,7 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
9291
textNode: widget.textNode,
9392
);
9493
},
94+
child: icon,
9595
),
9696
Flexible(
9797
child: FlowyRichText(
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
import 'package:flutter/widgets.dart';
22
import 'package:flutter_svg/flutter_svg.dart';
33

4-
Widget svgWithSize(String name, Size size) {
5-
return SizedBox.fromSize(
6-
size: size,
7-
child: svgWidget(name),
8-
);
9-
}
10-
114
Widget svgWidget(String name, {Size? size, Color? color}) {
125
if (size != null) {
136
return SizedBox.fromSize(
147
size: size,
15-
child: _svgWidget(name, color: color),
8+
child: SvgPicture.asset('assets/images/$name.svg', color: color),
169
);
1710
} else {
18-
return _svgWidget(name, color: color);
11+
return SvgPicture.asset('assets/images/$name.svg', color: color);
1912
}
2013
}
21-
22-
Widget _svgWidget(String name, {Color? color}) {
23-
final Widget svg = SvgPicture.asset('assets/images/$name.svg', color: color);
24-
25-
return svg;
26-
}

0 commit comments

Comments
 (0)