import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class CardWithBgWidget extends StatelessWidget { String line1Text; String line2Text; double heightPercentage; double widthPercentage; CardWithBgWidget( {this.line1Text = '', this.line2Text = '', this.heightPercentage, this.widthPercentage}); @override Widget build(BuildContext context) { return Stack( children: [ RoundedContainer( child:Container( height: SizeConfig.screenHeight * heightPercentage, width: SizeConfig.screenWidth * widthPercentage, ), raduis: 10, backgroundColor: Hexcolor('#58434F'), showBorder: true, borderColor: Hexcolor('#707070'), borderWidth: 0.5, ), Positioned( left: 10, child: RoundedContainer( child:Container( padding: const EdgeInsets.all(15.0), height: SizeConfig.screenHeight * heightPercentage, width: SizeConfig.screenWidth * widthPercentage, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(line1Text, style: textStyle(2.5)) , SizedBox( height: 8, ), !line2Text.contains('and')? Text(line2Text, style: textStyle(2.5)) : Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(line2Text.substring(0,line2Text.indexOf('a')), style: textStyle(2.5)) , Text(line2Text.substring(line2Text.indexOf('d')+2,), style: textStyle(2.5)) , ], ), ], ), ), elevation: 0, // raduis: 0, showBorder: true, borderColor: Hexcolor('#707070'), customCornerRaduis: true, bottomLeft: 0, topLeft: 0, bottomRight: 10, topRight: 10, borderWidth: 0.5), ), ], ); } TextStyle textStyle(size, [FontWeight weight]) { return TextStyle( fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); } }