123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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) {
- var padding = const EdgeInsets.only(
- right: 30,
- left: 40,
- );
- 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: 10),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- height: 90,
- alignment: Alignment.center,
- padding: padding,
- child: Text(
- title,
- style: const TextStyle(
- fontSize: 25,
- ),
- ),
- ),
- Container(
- alignment: Alignment.bottomRight,
- padding: padding,
- child: FittedBox(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- value,
- style: const TextStyle(
- fontSize: 60,
- color: Colors.black,
- ),
- ),
- Text(
- " $unit",
- style: const TextStyle(fontSize: 25),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|