You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RSGDoctorApp/lib/widgets/shared/card_with_bg_widget.dart

86 lines
2.7 KiB
Dart

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';
/*
*@author: Mohammad Aljammal
*@Date:27/4/2020
*@param: line1Text, line2Text, heightPercentage, widthPercentage
*@return:
*@desc: Card Dr Schedule
*/
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: <Widget>[
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: <Widget>[
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,
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);
}
}