From 6b62eadaa4686dadc1a8780766c544cd0d2b7342 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 24 Nov 2020 13:39:36 +0100 Subject: [PATCH] add factory constructor --- example/lib/advanced_options_page.dart | 3 +- example/lib/chips_input_text_field.dart | 17 +- example/lib/choose_user_page.dart | 3 +- example/lib/group_chat_details_screen.dart | 4 +- example/lib/main.dart | 9 +- example/lib/new_chat_screen.dart | 15 +- example/lib/new_group_chat_screen.dart | 21 +- example/pubspec.yaml | 2 +- lib/src/back_button.dart | 6 +- lib/src/channel_bottom_sheet.dart | 12 +- lib/src/channel_list_view.dart | 14 +- lib/src/channel_preview.dart | 6 +- lib/src/giphy_attachment.dart | 30 +- lib/src/media_list_view.dart | 6 +- lib/src/message_actions_modal.dart | 18 +- lib/src/message_input.dart | 65 ++-- lib/src/message_list_view.dart | 3 +- lib/src/stream_svg_icon.dart | 336 +++++++++++++++++++++ lib/src/thread_header.dart | 6 +- lib/src/user_item.dart | 6 +- lib/svgs/Icon_camera.svg | 4 +- lib/svgs/Icon_record.svg | 4 +- 22 files changed, 424 insertions(+), 166 deletions(-) diff --git a/example/lib/advanced_options_page.dart b/example/lib/advanced_options_page.dart index 57ed1f06..212a15a8 100644 --- a/example/lib/advanced_options_page.dart +++ b/example/lib/advanced_options_page.dart @@ -44,8 +44,7 @@ class _AdvancedOptionsPageState extends State { ), ), leading: IconButton( - icon: StreamSvgIcon( - assetName: 'Icon_left.svg', + icon: StreamSvgIcon.left( color: Colors.black, ), onPressed: () { diff --git a/example/lib/chips_input_text_field.dart b/example/lib/chips_input_text_field.dart index 0310de5b..19c5c761 100644 --- a/example/lib/chips_input_text_field.dart +++ b/example/lib/chips_input_text_field.dart @@ -130,14 +130,15 @@ class ChipInputTextFieldState extends State> { Align( alignment: Alignment.bottomCenter, child: IconButton( - icon: StreamSvgIcon( - assetName: _chips.isEmpty - ? 'Icon_user.svg' - : 'Icon_User_add.svg', - color: Colors.black.withOpacity(0.5), - height: 24, - width: 24, - ), + icon: _chips.isEmpty + ? StreamSvgIcon.user( + color: Colors.black.withOpacity(0.5), + size: 24, + ) + : StreamSvgIcon.userAdd( + color: Colors.black.withOpacity(0.5), + size: 24, + ), onPressed: !_pauseItemAddition ? null : resumeItemAddition, alignment: Alignment.topRight, diff --git a/example/lib/choose_user_page.dart b/example/lib/choose_user_page.dart index 0a0d67b9..f1a53773 100644 --- a/example/lib/choose_user_page.dart +++ b/example/lib/choose_user_page.dart @@ -196,8 +196,7 @@ class ChooseUserPage extends StatelessWidget { ); }, leading: CircleAvatar( - child: StreamSvgIcon( - assetName: 'settings.svg', + child: StreamSvgIcon.settings( color: Colors.black, ), backgroundColor: diff --git a/example/lib/group_chat_details_screen.dart b/example/lib/group_chat_details_screen.dart index 3de87f2d..d11f377a 100644 --- a/example/lib/group_chat_details_screen.dart +++ b/example/lib/group_chat_details_screen.dart @@ -105,9 +105,7 @@ class _GroupChatDetailsScreenState extends State { StreamNeumorphicButton( child: IconButton( padding: const EdgeInsets.all(0), - icon: StreamSvgIcon( - assetName: 'Icon_check.svg', - ), + icon: StreamSvgIcon.check(), color: Color(0xFF006CFF), onPressed: _isGroupNameEmpty ? null diff --git a/example/lib/main.dart b/example/lib/main.dart index dcb4ac27..d2be225a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -143,8 +143,7 @@ class ChannelListPage extends StatelessWidget { ), ), ListTile( - leading: StreamSvgIcon( - assetName: 'Icon_pen-write.svg', + leading: StreamSvgIcon.penWrite( color: Colors.black.withOpacity(.5), ), onTap: () { @@ -162,8 +161,7 @@ class ChannelListPage extends StatelessWidget { ), ), ListTile( - leading: StreamSvgIcon( - assetName: 'Icon_contacts.svg', + leading: StreamSvgIcon.contacts( color: Colors.black.withOpacity(.5), ), onTap: () { @@ -197,8 +195,7 @@ class ChannelListPage extends StatelessWidget { ), ); }, - leading: StreamSvgIcon( - assetName: 'Icon_user.svg', + leading: StreamSvgIcon.user( color: Colors.black.withOpacity(.5), ), title: Text( diff --git a/example/lib/new_chat_screen.dart b/example/lib/new_chat_screen.dart index aeb4298e..690e831f 100644 --- a/example/lib/new_chat_screen.dart +++ b/example/lib/new_chat_screen.dart @@ -163,8 +163,7 @@ class _NewChatScreenState extends State { ), ), Positioned( - child: StreamSvgIcon( - assetName: 'Icon_close.svg', + child: StreamSvgIcon.close( color: Colors.white, ), ), @@ -194,11 +193,9 @@ class _NewChatScreenState extends State { children: [ StreamNeumorphicButton( child: Center( - child: StreamSvgIcon( - assetName: 'Icon_contacts.svg', + child: StreamSvgIcon.contacts( color: Color(0xFF006CFF), - height: 24, - width: 24, + size: 24, ), ), ), @@ -292,10 +289,8 @@ class _NewChatScreenState extends State { children: [ Padding( padding: const EdgeInsets.all(24), - child: StreamSvgIcon( - assetName: 'Icon_search.svg', - height: 96, - width: 96, + child: StreamSvgIcon.search( + size: 96, color: Colors.grey, ), ), diff --git a/example/lib/new_group_chat_screen.dart b/example/lib/new_group_chat_screen.dart index 3d7c418a..1db848a1 100644 --- a/example/lib/new_group_chat_screen.dart +++ b/example/lib/new_group_chat_screen.dart @@ -65,8 +65,7 @@ class _NewGroupChatScreenState extends State { actions: [ if (_selectedUsers.isNotEmpty) IconButton( - icon: StreamSvgIcon( - assetName: 'Icon_right.svg', + icon: StreamSvgIcon.right( color: Color(0xFF006CFF), ), onPressed: () { @@ -101,11 +100,9 @@ class _NewGroupChatScreenState extends State { child: TextField( controller: _controller, decoration: InputDecoration( - prefixIcon: StreamSvgIcon( - assetName: 'Icon_search.svg', + prefixIcon: StreamSvgIcon.search( color: Colors.black, - height: 24, - width: 24, + size: 24, ), hintText: 'Search', hintStyle: TextStyle( @@ -163,10 +160,8 @@ class _NewGroupChatScreenState extends State { ), child: Padding( padding: const EdgeInsets.all(0.0), - child: StreamSvgIcon( - assetName: 'Icon_close.svg', - height: 24, - width: 24, + child: StreamSvgIcon.close( + size: 24, ), ), ), @@ -262,10 +257,8 @@ class _NewGroupChatScreenState extends State { children: [ Padding( padding: const EdgeInsets.all(24), - child: StreamSvgIcon( - assetName: 'Icon_search.svg', - height: 96, - width: 96, + child: StreamSvgIcon.search( + size: 96, color: Colors.grey, ), ), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 7cd6045a..6e34335d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.69+71 +version: 1.0.70+72 environment: sdk: ">=2.2.2 <3.0.0" diff --git a/lib/src/back_button.dart b/lib/src/back_button.dart index cd30c956..25c1c9da 100644 --- a/lib/src/back_button.dart +++ b/lib/src/back_button.dart @@ -33,10 +33,8 @@ class StreamBackButton extends StatelessWidget { Navigator.of(context).pop(); } }, - child: StreamSvgIcon( - assetName: 'Icon_left.svg', - height: 24, - width: 24, + child: StreamSvgIcon.left( + size: 24, color: Theme.of(context).brightness == Brightness.dark ? Colors.white : Colors.black, diff --git a/lib/src/channel_bottom_sheet.dart b/lib/src/channel_bottom_sheet.dart index c3233ff4..c0e32509 100644 --- a/lib/src/channel_bottom_sheet.dart +++ b/lib/src/channel_bottom_sheet.dart @@ -72,10 +72,8 @@ class ChannelBottomSheet extends StatelessWidget { initialData: channel.isMuted, builder: (context, snapshot) { return ListTile( - leading: StreamSvgIcon( - assetName: 'Icon_mute.svg', - height: 22, - width: 22, + leading: StreamSvgIcon.mute( + size: 22, color: StreamChatTheme.of(context).primaryIconTheme.color, ), title: Text('Mute ${channel.isGroup ? 'group' : 'user'}'), @@ -94,10 +92,8 @@ class ChannelBottomSheet extends StatelessWidget { Divider(), if (channel.isGroup && !channel.isDistinct) ListTile( - leading: StreamSvgIcon( - assetName: 'Icon_User_deselect.svg', - height: 22, - width: 22, + leading: StreamSvgIcon.userRemove( + size: 22, color: Colors.black, ), title: Text('Leave Group'), diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index 503e740d..bfd8e477 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -201,10 +201,8 @@ class _ChannelListViewState extends State children: [ Padding( padding: const EdgeInsets.all(8.0), - child: StreamSvgIcon( - assetName: 'Icon_message.svg', - height: 136, - width: 136, + child: StreamSvgIcon.message( + size: 136, color: Color(0xffDBDBDB), ), ), @@ -519,9 +517,7 @@ class _ChannelListViewState extends State ), IconSlideAction( color: backgroundColor, - iconWidget: StreamSvgIcon( - assetName: 'Icon_mute.svg', - ), + iconWidget: StreamSvgIcon.mute(), onTap: () async { if (!channel.isMuted) { await channel.mute(); @@ -533,9 +529,7 @@ class _ChannelListViewState extends State if (channel.isGroup && !channel.isDistinct) IconSlideAction( color: backgroundColor, - iconWidget: StreamSvgIcon( - assetName: 'Icon_User_deselect.svg', - ), + iconWidget: StreamSvgIcon.userRemove(), onTap: () async { final confirm = await showConfirmationDialog( context, diff --git a/lib/src/channel_preview.dart b/lib/src/channel_preview.dart index c61e469e..3c9eeace 100644 --- a/lib/src/channel_preview.dart +++ b/lib/src/channel_preview.dart @@ -153,10 +153,8 @@ class ChannelPreview extends StatelessWidget { return Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ - StreamSvgIcon( - assetName: 'Icon_mute.svg', - height: 16, - width: 16, + StreamSvgIcon.mute( + size: 16, ), Text( ' Channel is muted', diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index 0f3b9e7e..7abf7057 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -112,11 +112,9 @@ class GiphyAttachment extends StatelessWidget { ), child: Row( children: [ - StreamSvgIcon( - assetName: 'Icon_lightning-command runner.svg', + StreamSvgIcon.lightning( color: StreamChatTheme.of(context).accentColor, - height: 16.0, - width: 16.0, + size: 16.0, ), Text( 'GIPHY', @@ -146,10 +144,8 @@ class GiphyAttachment extends StatelessWidget { child: IconButton( padding: const EdgeInsets.all(0), constraints: BoxConstraints.tight(Size(32, 32)), - icon: StreamSvgIcon( - assetName: 'Icon_left.svg', - height: 24.0, - width: 24.0, + icon: StreamSvgIcon.left( + size: 24.0, ), splashRadius: 16, onPressed: () { @@ -175,10 +171,8 @@ class GiphyAttachment extends StatelessWidget { child: IconButton( padding: const EdgeInsets.all(0), constraints: BoxConstraints.tight(Size(32, 32)), - icon: StreamSvgIcon( - assetName: 'Icon_right.svg', - height: 24.0, - width: 24.0, + icon: StreamSvgIcon.right( + size: 24.0, ), splashRadius: 16, onPressed: () { @@ -257,11 +251,9 @@ class GiphyAttachment extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - StreamSvgIcon( - assetName: 'Icon_eye-off.svg', + StreamSvgIcon.eye( color: Colors.black.withOpacity(0.5), - height: 16.0, - width: 16.0, + size: 16.0, ), SizedBox( width: 8.0, @@ -331,11 +323,9 @@ class GiphyAttachment extends StatelessWidget { ), child: Row( children: [ - StreamSvgIcon( - assetName: 'Icon_lightning-command runner.svg', + StreamSvgIcon.lightning( color: Colors.white, - height: 16, - width: 16, + size: 16, ), Text( 'GIPHY', diff --git a/lib/src/media_list_view.dart b/lib/src/media_list_view.dart index c4ae4981..e8735d69 100644 --- a/lib/src/media_list_view.dart +++ b/lib/src/media_list_view.dart @@ -71,10 +71,8 @@ class _MediaListViewState extends State { child: CircleAvatar( radius: 12, backgroundColor: Colors.white, - child: StreamSvgIcon( - assetName: 'Icon_check.svg', - height: 24, - width: 24, + child: StreamSvgIcon.check( + size: 24, color: Colors.black, ), ), diff --git a/lib/src/message_actions_modal.dart b/lib/src/message_actions_modal.dart index d95b63ea..1967cd2b 100644 --- a/lib/src/message_actions_modal.dart +++ b/lib/src/message_actions_modal.dart @@ -188,8 +188,7 @@ class MessageActionsModal extends StatelessWidget { style: Theme.of(context).textTheme.headline6.copyWith(color: Colors.red), ), - leading: StreamSvgIcon( - assetName: 'Icon_delete.svg', + leading: StreamSvgIcon.delete( color: Colors.red, ), onTap: () { @@ -208,8 +207,7 @@ class MessageActionsModal extends StatelessWidget { 'Copy message', style: Theme.of(context).textTheme.headline6, ), - leading: StreamSvgIcon( - assetName: 'Icon_copy.svg', + leading: StreamSvgIcon.copy( color: StreamChatTheme.of(context).primaryIconTheme.color, ), onTap: () async { @@ -225,8 +223,7 @@ class MessageActionsModal extends StatelessWidget { 'Edit message', style: Theme.of(context).textTheme.headline6, ), - leading: StreamSvgIcon( - assetName: 'Icon_edit.svg', + leading: StreamSvgIcon.edit( color: StreamChatTheme.of(context).primaryIconTheme.color, ), onTap: () async { @@ -267,10 +264,8 @@ class MessageActionsModal extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( - icon: StreamSvgIcon( - assetName: 'Icon_edit.svg', - height: 22, - width: 22, + icon: StreamSvgIcon.edit( + size: 22, color: StreamChatTheme.of(context).primaryIconTheme.color, ), @@ -324,8 +319,7 @@ class MessageActionsModal extends StatelessWidget { 'Thread reply', style: Theme.of(context).textTheme.headline6, ), - leading: StreamSvgIcon( - assetName: 'Icon_Thread_Reply.svg', + leading: StreamSvgIcon.thread( color: StreamChatTheme.of(context).primaryIconTheme.color, ), onTap: () { diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index a7d8db5e..4b634ab7 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -284,10 +284,8 @@ class MessageInputState extends State { crossFadeState: _sendAsDm ? CrossFadeState.showFirst : CrossFadeState.showSecond, - firstChild: StreamSvgIcon( - assetName: 'Icon_check.svg', - height: 16.0, - width: 16.0, + firstChild: StreamSvgIcon.check( + size: 16.0, color: Colors.white, ), secondChild: SizedBox( @@ -331,8 +329,7 @@ class MessageInputState extends State { _actionsShrunk = false; }); }, - icon: StreamSvgIcon( - assetName: 'Icon_empty_circle_left.svg', + icon: StreamSvgIcon.emptyCircleLeft( color: StreamChatTheme.of(context).accentColor, ), ), @@ -404,8 +401,7 @@ class MessageInputState extends State { _chosenCommand?.name ?? "", style: TextStyle(color: Colors.white), ), - avatar: StreamSvgIcon( - assetName: 'Icon_lightning-command runner.svg', + avatar: StreamSvgIcon.lightning( color: Colors.white, ), ), @@ -582,9 +578,7 @@ class MessageInputState extends State { padding: const EdgeInsets.symmetric( horizontal: 8.0, ), - child: StreamSvgIcon( - assetName: - 'Icon_lightning-command runner.svg', + child: StreamSvgIcon.lightning( color: StreamChatTheme.of(context) .accentColor, ), @@ -622,12 +616,9 @@ class MessageInputState extends State { trailing: CircleAvatar( backgroundColor: StreamChatTheme.of(context).accentColor, - child: StreamSvgIcon( - assetName: - 'Icon_lightning-command runner.svg', + child: StreamSvgIcon.lightning( color: Colors.white, - height: 12.5, - width: 12.5, + size: 12.5, ), maxRadius: 12, ), @@ -661,10 +652,8 @@ class MessageInputState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ IconButton( - icon: StreamSvgIcon( - assetName: 'pictures.svg', - height: 24, - width: 24, + icon: StreamSvgIcon.pictures( + size: 24, color: _filePickerIndex == 0 ? StreamChatTheme.of(context).accentColor : Colors.black.withOpacity(0.5), @@ -676,10 +665,8 @@ class MessageInputState extends State { }, ), IconButton( - icon: StreamSvgIcon( - assetName: 'files.svg', - height: 24, - width: 24, + icon: StreamSvgIcon.files( + size: 24, color: _filePickerIndex == 1 ? StreamChatTheme.of(context).accentColor : Colors.black.withOpacity(0.5), @@ -689,10 +676,8 @@ class MessageInputState extends State { }, ), IconButton( - icon: StreamSvgIcon( - assetName: 'Icon_camera.svg', - height: 24, - width: 24, + icon: StreamSvgIcon.camera( + size: 24, color: _filePickerIndex == 2 ? StreamChatTheme.of(context).accentColor : Colors.black.withOpacity(0.5), @@ -702,10 +687,8 @@ class MessageInputState extends State { }, ), IconButton( - icon: StreamSvgIcon( - assetName: 'Icon_record.svg', - height: 24, - width: 24, + icon: StreamSvgIcon.record( + size: 24, color: _filePickerIndex == 3 ? StreamChatTheme.of(context).accentColor : Colors.black.withOpacity(0.5), @@ -1000,8 +983,7 @@ class MessageInputState extends State { fontWeight: FontWeight.bold), ), subtitle: Text('@${m.userId}'), - trailing: StreamSvgIcon( - assetName: 'mentions.svg', + trailing: StreamSvgIcon.mentions( color: StreamChatTheme.of(context) .accentColor, ), @@ -1098,8 +1080,7 @@ class MessageInputState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: StreamSvgIcon( - assetName: 'Icon_smile.svg', + child: StreamSvgIcon.smile( color: StreamChatTheme.of(context).accentColor, ), ), @@ -1234,10 +1215,8 @@ class MessageInputState extends State { }, fillColor: Colors.black.withOpacity(.5), child: Center( - child: StreamSvgIcon( - assetName: 'Icon_close.svg', - height: 24, - width: 24, + child: StreamSvgIcon.close( + size: 24, color: Colors.white, ), ), @@ -1307,8 +1286,7 @@ class MessageInputState extends State { child: Padding( padding: const EdgeInsets.only(left: 4.0, right: 8.0, top: 8.0, bottom: 8.0), - child: StreamSvgIcon( - assetName: 'Icon_lightning-command runner.svg', + child: StreamSvgIcon.lightning( color: Color(0xFF000000).withAlpha(128), ), ), @@ -1331,8 +1309,7 @@ class MessageInputState extends State { child: Padding( padding: EdgeInsets.only(left: 8.0, right: padding, top: 8.0, bottom: 8.0), - child: StreamSvgIcon( - assetName: 'Icon_attach.svg', + child: StreamSvgIcon.attach( color: _openFilePickerSection ? StreamChatTheme.of(context).accentColor : Color(0xFF000000).withAlpha(128), diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index 2954f043..1be1d0aa 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -375,8 +375,7 @@ class _MessageListViewState extends State { children: [ FloatingActionButton( backgroundColor: Colors.white, - child: StreamSvgIcon( - assetName: 'Icon_down.svg', + child: StreamSvgIcon.down( color: Colors.black, ), onPressed: () { diff --git a/lib/src/stream_svg_icon.dart b/lib/src/stream_svg_icon.dart index c0cf5d72..6d97f2b6 100644 --- a/lib/src/stream_svg_icon.dart +++ b/lib/src/stream_svg_icon.dart @@ -39,4 +39,340 @@ class StreamSvgIcon extends StatelessWidget { alignment: Alignment.center, ); } + + factory StreamSvgIcon.settings({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'settings.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.down({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_down.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.attach({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_attach.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.smile({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_smile.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.mentions({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'mentions.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.record({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_record.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.camera({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_camera.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.files({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'files.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.pictures({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'pictures.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.left({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_left.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.user({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_user.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.userAdd({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_User_add.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.check({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_check.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.penWrite({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_pen-write.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.contacts({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_contacts.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.close({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_close.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.search({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_search.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.right({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_right.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.mute({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_mute.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.userRemove({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_User_deselect.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.lightning({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_lightning-command runner.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.emptyCircleLeft({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_empty_circle_left.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.message({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_message.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.thread({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_Thread_Reply.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.edit({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_edit.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.copy({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_copy.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.delete({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_delete.svg', + color: color, + width: size, + height: size, + ); + } + + factory StreamSvgIcon.eye({ + double size, + Color color, + }) { + return StreamSvgIcon( + assetName: 'Icon_eye-off.svg', + color: color, + width: size, + height: size, + ); + } } diff --git a/lib/src/thread_header.dart b/lib/src/thread_header.dart index 9ad71a47..c6cce13e 100644 --- a/lib/src/thread_header.dart +++ b/lib/src/thread_header.dart @@ -86,10 +86,8 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget { aspectRatio: 1, child: IconButton( onPressed: onBackPressed, - icon: StreamSvgIcon( - assetName: 'Icon_close.svg', - height: 24, - width: 24, + icon: StreamSvgIcon.close( + size: 24, color: Theme.of(context).brightness == Brightness.dark ? Colors.white : Colors.black, diff --git a/lib/src/user_item.dart b/lib/src/user_item.dart index 8ddd3d99..03c275ac 100644 --- a/lib/src/user_item.dart +++ b/lib/src/user_item.dart @@ -74,10 +74,8 @@ class UserItem extends StatelessWidget { ), trailing: selected ? CircleAvatar( - child: StreamSvgIcon( - assetName: 'Icon_check.svg', - height: 20, - width: 20, + child: StreamSvgIcon.check( + size: 20, ), radius: 10, ) diff --git a/lib/svgs/Icon_camera.svg b/lib/svgs/Icon_camera.svg index 0bf3122d..a5a7d99d 100644 --- a/lib/svgs/Icon_camera.svg +++ b/lib/svgs/Icon_camera.svg @@ -1,3 +1,3 @@ - - + + diff --git a/lib/svgs/Icon_record.svg b/lib/svgs/Icon_record.svg index ff72859f..64d02895 100644 --- a/lib/svgs/Icon_record.svg +++ b/lib/svgs/Icon_record.svg @@ -1,3 +1,3 @@ - - + +