normal static method

Widget normal(
  1. String? s, {
  2. TextAlign textAlign = TextAlign.left,
  3. Color? colorOpt = Colors.black,
  4. TextDecoration? textDecoration = TextDecoration.none,
  5. double dimenOpt = 0,
  6. String? fontFamily,
  7. EdgeInsets? margin,
  8. EdgeInsets? padding = EdgeInsets.zero,
  9. Decoration? decoration_background,
  10. double? width,
  11. double? height,
  12. TemplateSize? templateSize = TemplateSize.wrap,
  13. VoidCallback? onPressed,
  14. Alignment? align = Alignment.topLeft,
  15. bool? selectedTextAllow,
  16. LevelDS? dsLevel,
  17. 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;

}