Files
aurcache/frontend/lib/components/dashboard/chart_card.dart
T

67 lines
1.8 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2023-12-30 00:45:33 +01:00
import '../../constants/color_constants.dart';
2024-02-16 17:37:26 +01:00
class SideCard extends StatelessWidget {
const SideCard({
super.key,
required this.title,
2024-02-16 17:37:26 +01:00
this.color,
2023-12-30 00:45:33 +01:00
required this.textRight,
2024-02-16 17:37:26 +01:00
this.subtitle,
});
2024-02-16 17:37:26 +01:00
final Color? color;
final String title, textRight;
final String? subtitle;
@override
Widget build(BuildContext context) {
return Container(
2023-12-30 00:45:33 +01:00
margin: const EdgeInsets.only(top: defaultPadding),
padding: const EdgeInsets.all(defaultPadding),
decoration: BoxDecoration(
border: Border.all(width: 2, color: primaryColor.withOpacity(0.15)),
borderRadius: const BorderRadius.all(
Radius.circular(defaultPadding),
),
),
child: Row(
children: [
2024-02-16 17:37:26 +01:00
if (color != null)
SizedBox(
height: 20,
width: 20,
child: Container(
color: color,
)),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
2024-02-16 17:37:26 +01:00
if (subtitle != null)
Text(
subtitle!,
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(color: Colors.white70),
),
],
),
),
),
2023-12-30 00:45:33 +01:00
Text(textRight)
],
),
);
}
}