buildMsgCard function
Implementation
Row buildMsgCard(BuildContext context, IconData errIcon, Color errColour,
String errTitle, String errBody,
{bool isSmall = false}) {
// Call buildMsgCard with isSmall=true to use above another widget
EdgeInsets paddingMsgCardDef = const EdgeInsets.fromLTRB(60, 50, 60, 20);
EdgeInsets paddingMsgCardSmall = const EdgeInsets.fromLTRB(60, 20, 60, 20);
Map<String, Map<String, double>> msgCardHeightSettings = {
'desktop': {'smallmsg': 140, 'normalmsg': 160},
'tablet': {'smallmsg': 150, 'normalmsg': 200},
'other': {'smallmsg': 160, 'normalmsg': 220},
};
double heightMsgCard = isSmall
? (Responsive.isDesktop(context)
? msgCardHeightSettings['desktop']!['smallmsg'] as double
: Responsive.isTablet(context)
? msgCardHeightSettings['tablet']!['smallmsg'] as double
: msgCardHeightSettings['other']!['smallmsg'] as double)
: (Responsive.isDesktop(context)
? msgCardHeightSettings['desktop']!['normalmsg'] as double
: Responsive.isTablet(context)
? msgCardHeightSettings['tablet']!['normalmsg'] as double
: msgCardHeightSettings['other']!['normalmsg'] as double);
return Row(
children: [
Expanded(
flex: Responsive.isDesktop(context) ? 10 : 8,
child: Padding(
padding: isSmall ? paddingMsgCardSmall : paddingMsgCardDef,
child: Card(
elevation: 10,
shadowColor: Colors.black,
color: lighterGray,
child: SizedBox(
// height: Responsive.isDesktop(context)
// ? 160
// : Responsive.isTablet(context)
// ? 200
// : 220,
height: heightMsgCard,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
Container(
height: 60,
width: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
alignment: Alignment.center,
child: Icon(
errIcon,
color: errColour,
size: 60,
),
), //CircleAvatar
const SizedBox(
height: 10,
), //SizedBox
Text(
errTitle,
style: const TextStyle(
fontSize: 20,
color: Colors.black,
fontWeight: FontWeight.w500,
), //Textstyle
), //Text
const SizedBox(
height: 10,
), //SizedBox
Text(
errBody,
style: const TextStyle(
fontSize: 15,
color: Colors.black,
), //Textstyle
), //SizedBox
],
), //Column
), //Padding
), //SizedBox
),
),
),
],
);
}