-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add svg support to flutter (#498)
* feat: Add svg support for flutter_gen and add `CatalystSvgPicture` wrapper. * feat: Add Catalyst SVG logo version.
- Loading branch information
Showing
8 changed files
with
218 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
catalyst_voices/packages/catalyst_voices_assets/assets/images/catalyst_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-3.61 KB
catalyst_voices/packages/catalyst_voices_assets/assets/images/logo.webp
Binary file not shown.
65 changes: 61 additions & 4 deletions
65
catalyst_voices/packages/catalyst_voices_assets/lib/generated/assets.gen.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
catalyst_voices/packages/catalyst_voices_assets/lib/src/catalyst_svg_picture.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
|
||
/// [CatalystSvgPicture] extends [SvgPicture] to have an asset constructor | ||
/// tat sets the package property to `catalyst_voices_assets` by default. | ||
/// This allows to use the asset without having to specify the package name | ||
/// every time. | ||
/// For more information, see [SvgPicture.asset]. | ||
final class CatalystSvgPicture extends SvgPicture { | ||
CatalystSvgPicture.asset( | ||
String name, { | ||
AssetBundle? bundle, | ||
String? semanticsLabel, | ||
bool excludeFromSemantics = false, | ||
double? width, | ||
double? height, | ||
BoxFit fit = BoxFit.contain, | ||
Alignment alignment = Alignment.center, | ||
bool matchTextDirection = false, | ||
String package = 'catalyst_voices_assets', | ||
bool allowDrawingOutsideViewBox = false, | ||
Widget Function(BuildContext)? placeholderBuilder, | ||
Clip clipBehavior = Clip.hardEdge, | ||
SvgTheme? theme, | ||
ColorFilter? colorFilter, | ||
}) : super.asset( | ||
name, | ||
bundle: bundle, | ||
semanticsLabel: semanticsLabel, | ||
excludeFromSemantics: excludeFromSemantics, | ||
width: width, | ||
height: height, | ||
fit: fit, | ||
alignment: alignment, | ||
matchTextDirection: matchTextDirection, | ||
package: package, | ||
allowDrawingOutsideViewBox: allowDrawingOutsideViewBox, | ||
placeholderBuilder: placeholderBuilder, | ||
clipBehavior: clipBehavior, | ||
theme: theme, | ||
colorFilter: colorFilter, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters