Skip to content

TwImage

TaildindCLI provides you a TwImage Widget that can be used to show any Image in your application. It will auto detect the source and render the actual Image widget.

Tw WidgetFlutter Widget
TwImageImage

This Widget is a smart widget that is used create Image widget without any other specific constructor. Generally we need to use Image.asset() for local images and Image.network() for network image but when you use this TwImage Widget it smartly detect if it is a local asset image or a network image and render the required Constructor for Image Widget.

Usage

  • TwImage: Widget

This is a Wrapper widget for the Image widget provided by the flutter and it provides you some extension methods specific to Image styling to style your image with ease.

Tw WidgetFlutter Widget
TwImage('images/logo.png')Image.asset('images/logo.png')
TwImage('https://example.com/logo.png')Image.network('https://example.com/logo.png')
TwImage('file://')Image.file('file://image/path/logo.png')

TwImage Widget

dart
Widget build(BuildContext contexr){
    return TwImage('images/logo.png')  
    .square(40) // Provides 40[px/pt] image with square shape
    .render();   
}

OR

dart
Widget build(BuildContext contexr){
    return TwImage('https://cdn.example.com/avatars/john-doe.png') 
    .square(40) // Provides 40[px/pt] image with square shape
    .rounded 
    .render(); 
}

Api References

TwImage includes some handy extensions and methods which can help you add styling to an Image Widget.

Mixins ExtensionsMixins Methods
ColorsColors
RoundnessRoundness
SizesNA

Released under the MIT License.