import 'package:flutter/material.dart'; import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart'; import '../../main.dart'; class MIHBody extends StatefulWidget { final bool borderOn; final List bodyItems; const MIHBody({ super.key, required this.borderOn, required this.bodyItems, }); @override State createState() => _MIHBodyState(); } class _MIHBodyState extends State { //double paddingSize = 10; double getHorizontalPaddingSize(Size screenSize) { if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") { if (widget.borderOn) { return 10; } else { return 0; } } else { // mobile if (widget.borderOn) { return 10; } else { return 0; } } } double getVerticalPaddingSize(Size screenSize) { // mobile if (widget.borderOn) { return 10; } else { return 0; } } Decoration? getBoader() { if (widget.borderOn) { return BoxDecoration( color: MihColors.getPrimaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), borderRadius: BorderRadius.circular(25.0), border: Border.all( color: MihColors.getSecondaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), width: 3.0), ); } else { return null; } } @override void dispose() { super.dispose(); } @override void initState() { super.initState(); } @override Widget build(BuildContext context) { Size screenSize = MediaQuery.sizeOf(context); return Padding( padding: EdgeInsets.only( left: getHorizontalPaddingSize(screenSize), right: getHorizontalPaddingSize(screenSize), bottom: getVerticalPaddingSize(screenSize), top: 0, ), child: Container( padding: EdgeInsets.only( left: 10, right: 10, bottom: 10, top: getVerticalPaddingSize(screenSize), ), width: screenSize.width, height: screenSize.height, decoration: getBoader(), child: ScrollConfiguration( behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: widget.bodyItems, ), ), ), ), ); } }