KonectarEvents/lib/widgets/chartline.dart

70 lines
2.0 KiB
Dart
Raw Normal View History

2024-09-06 06:30:31 +00:00
import 'package:flutter/material.dart';
2024-10-07 12:45:45 +00:00
import 'package:konectar_events/utils/constants.dart';
2024-09-06 06:30:31 +00:00
class ChartLine extends StatelessWidget {
const ChartLine({
Key? key,
required this.rate,
required this.title,
required this.number,
}) : assert(title != null),
assert(rate != null),
assert(rate > 0),
assert(rate <= 1),
super(key: key);
final double rate;
final String title;
final int number;
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
final lineWidget = constraints.maxWidth * rate;
return Padding(
padding: const EdgeInsets.only(bottom: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
2024-10-07 12:45:45 +00:00
//constraints: BoxConstraints(minWidth: lineWidget),
2024-09-06 06:30:31 +00:00
child: IntrinsicWidth(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
2024-10-07 12:45:45 +00:00
fontSize: 14,
2024-09-06 06:30:31 +00:00
overflow: TextOverflow.ellipsis,
),
),
],
),
),
),
Container(
2024-10-07 12:45:45 +00:00
//constraints: BoxConstraints(maxWidth: lineWidget),
color: Constants.blueColor,
2024-09-06 06:30:31 +00:00
height: 40,
width: lineWidget,
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.centerRight,
child: Text(
2024-10-07 12:45:45 +00:00
'${number.toString()}',
2024-09-06 06:30:31 +00:00
style: TextStyle(
2024-10-07 12:45:45 +00:00
fontSize: 16,
color: Colors.white,
2024-09-06 06:30:31 +00:00
fontWeight: FontWeight.bold,
),
),
),
),
],
),
);
});
}
}