1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|