Skip to content

Commit d7783a6

Browse files
committed
chore: remove duplicated svg function
1 parent fba6976 commit d7783a6

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
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
);
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)