import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class DoctorCard extends StatelessWidget { final String name; final String subName; final double rat; final String date; final String profileUrl; final String billNo; final Function onTap; final Function onEmailTap; final bool isInOutPatient; DoctorCard( {this.name, this.subName, this.rat, this.date, this.profileUrl, this.billNo, this.onTap, this.onEmailTap, this.isInOutPatient}); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.all(10), decoration: BoxDecoration( border: Border.all( width: 0.5, color: Theme.of(context).primaryColor, ), borderRadius: BorderRadius.all( Radius.circular(8.0), ), color: Colors.white ), child: InkWell( onTap: onTap, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( width: 20, height: date == null ? 100 : 130, decoration: BoxDecoration( color: !isInOutPatient? Colors.red[900]: Theme.of(context).primaryColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(8), bottomLeft: Radius.circular(8))), child: RotatedBox( quarterTurns: 3, child: Center( child: Text( !isInOutPatient? 'In Patient'.toUpperCase():'OutPatient'.toUpperCase(), style: TextStyle(color: Colors.white), ), )), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(10.0), child: Row( children: [ Expanded( flex: 1, child: LargeAvatar( name: name, url: profileUrl, ), ), Expanded( flex: 4, child: Container( margin: EdgeInsets.all(10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( name, bold: true, ), Texts( subName, variant: 'caption3', ), if (billNo != null) Row( children: [ Texts( 'Bill No: ', variant: 'caption3', ), Texts( billNo, variant: 'caption3', ) ], ), if (rat != null) StarRating( totalAverage: rat, forceStars: true), ], ), ), ), if(onEmailTap!=null) InkWell( onTap: onEmailTap, child: Icon( Icons.email, color: Colors.red, ), ) ], ), ), if (date != null) Divider( height: 8, color: Colors.grey[400], ), if (date != null) Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( 'assets/images/Icon-awesome-calendar.png', width: 30, height: 30, ), Expanded( child: Texts( date, variant: 'bodyText', ), ) ], ) ], ), ) ], ), ], ), ), ); } }