use StreamSvgIcon widget

This commit is contained in:
Salvatore Giordano
2020-11-24 12:52:54 +01:00
parent b20caeee8f
commit f1b7c6f39f
110 changed files with 673 additions and 1392 deletions
+40
View File
@@ -0,0 +1,40 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class StreamSvgIcon extends StatelessWidget {
final String assetName;
final double width;
final double height;
final Color color;
const StreamSvgIcon({
Key key,
this.assetName,
this.width,
this.height,
this.color,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return kIsWeb
? Image.network(
'packages/stream_chat_flutter/svgs/$assetName',
width: width,
height: height,
color: color,
fit: BoxFit.cover,
alignment: Alignment.center,
)
: SvgPicture.asset(
'lib/svgs/$assetName',
package: 'stream_chat_flutter',
width: width,
height: height,
fit: BoxFit.cover,
color: color,
alignment: Alignment.center,
);
}
}