import 'package:flutter/material.dart'; class SideBar extends StatelessWidget { final String title; final String value; final String unit; final Function? onTap; final bool? hasDevice; const SideBar({ super.key, required this.title, required this.value, required this.unit, this.onTap, this.hasDevice = false, }); @override Widget build(BuildContext context) { return Container( margin: hasDevice! ? const EdgeInsets.only(top: 60) : const EdgeInsets.only(top: 10), child: InkWell( onTap: () => onTap?.call(), child: Container( margin: const EdgeInsets.only(top: 10), padding: const EdgeInsets.symmetric(vertical: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: const EdgeInsets.symmetric( horizontal: 30, ), child: Text( title, style: const TextStyle( fontSize: 25, ), ), ), Container( alignment: Alignment.bottomRight, padding: const EdgeInsets.only( bottom: 20, right: 30, left: 40, ), child: FittedBox( child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ RichText( text: TextSpan( text: value, style: const TextStyle( fontSize: 60, color: Colors.black, ), children: [ const TextSpan(text: ' '), TextSpan( text: unit, style: const TextStyle(fontSize: 25), ) ], ), ), ], ), ), ), ], ), ), ), ); } }