normal static method
Widget
normal(
- String? s, {
- TextAlign textAlign = TextAlign.left,
- Color? colorOpt = Colors.black,
- TextDecoration? textDecoration = TextDecoration.none,
- double dimenOpt = 0,
- String? fontFamily,
- EdgeInsets? margin,
- EdgeInsets? padding = EdgeInsets.zero,
- Decoration? decoration_background,
- double? width,
- double? height,
- TemplateSize? templateSize = TemplateSize.wrap,
- VoidCallback? onPressed,
- Alignment? align = Alignment.topLeft,
- bool? selectedTextAllow,
- LevelDS? dsLevel,
- int? maxLines,
Implementation
static Widget normal(String? s , {
TextAlign textAlign = TextAlign.left,
Color? colorOpt = Colors.black ,
TextDecoration? textDecoration = TextDecoration.none,
double dimenOpt = 0,
String? fontFamily,
EdgeInsets? margin,
EdgeInsets? padding = EdgeInsets.zero,
Decoration? decoration_background, // must before use this use also width fixed and height
double? width,
double? height,
TemplateSize? templateSize = TemplateSize.wrap,
VoidCallback? onPressed,
Alignment? align = Alignment.topLeft,
bool? selectedTextAllow ,
//level
LevelDS? dsLevel,
//lines
int? maxLines
}) {
//default
dsLevel ??= LevelDS.l2;
//default not selected
/**
* to avoid RAM Lost
*/
selectedTextAllow ??= false;
//fix null
s ??= "";
//set default dimen
var myDimen = DSDimen.text_level_1;
if ( dimenOpt != 0 ) {
myDimen = dimenOpt;
}
//color
Color myColor = DSColor.text_h1;
if ( colorOpt != null ) {
myColor = colorOpt;
}
//style
var myStyle = TextStyle(
fontSize: myDimen,
color: myColor,
fontFamily: fontFamily,
height: 1.0, //space between lines
decoration: textDecoration,
decorationColor: myColor,
);
//view
Widget viewChild = _chooseChildWhenPressed(s, textAlign, myStyle, maxLines, onPressed , selectedTextAllow, dsLevel);
//get fixed size
Size? fixedSize = DesignSystemTools.getFixedSize(width, height, dimenOpt);
//size
Widget? container = null;
if ( fixedSize != null ) {
container = ContainerTemplate.fixedSize( viewChild, fixedSize, margin, padding, decoration_background, align) ;
// Log.i( "fixed size");
} else if ( templateSize == TemplateSize.match ) {
container = ContainerTemplate.matchParent( viewChild, margin : margin, padding : padding, decoration : decoration_background, align : align) ;
} else {
container = ContainerTemplate.wrapContent( viewChild,
margin: margin, padding : padding,
decoration: decoration_background,
align : align) ;
}
return container;
}