You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
4 years ago
|
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class IconText extends StatelessWidget{
|
||
|
|
||
|
final String leftImage;
|
||
|
final String rightImage;
|
||
|
final IconData leftIcon;
|
||
|
final IconData rightIcon;
|
||
|
final String text;
|
||
|
final TextStyle textStyle;
|
||
|
final double iconSize;
|
||
|
final Color iconColor;
|
||
|
|
||
|
IconText(this.text, {this.leftIcon,this.rightIcon,this.leftImage, this.rightImage, this.iconSize = 16, this.iconColor = Colors.black, this.textStyle});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
var widgets = <Widget>[];
|
||
|
if(leftIcon != null || (leftImage != null && leftImage != "")) {
|
||
|
if(leftIcon != null) {
|
||
|
widgets.add(Icon(leftIcon, size: iconSize, color: iconColor,));
|
||
|
} else if(leftImage != null && leftImage != "") {
|
||
|
widgets.add(Image.asset(leftImage, width: iconSize, height: iconSize,));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
widgets.add(SizedBox(width: 2,));
|
||
|
widgets.add(Text(text, style: textStyle,));
|
||
|
widgets.add(SizedBox(width: 2,));
|
||
|
|
||
|
if(rightIcon != null || rightImage != null && rightImage != "") {
|
||
|
if(rightIcon != null) {
|
||
|
widgets.add(Icon(rightIcon, size: iconSize, color: iconColor,));
|
||
|
} else if(rightImage != null && rightImage != "") {
|
||
|
widgets.add(Image.asset(rightImage, width: iconSize, height: iconSize,));
|
||
|
}
|
||
|
}
|
||
|
return Container(
|
||
|
child: Row(
|
||
|
children: widgets,
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|