import 'package:flutter/material.dart'; import 'package:konectar_events/utils/constants.dart'; 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( //constraints: BoxConstraints(minWidth: lineWidget), child: IntrinsicWidth( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( title, style: TextStyle( fontSize: 14, overflow: TextOverflow.ellipsis, ), ), ], ), ), ), Container( //constraints: BoxConstraints(maxWidth: lineWidget), color: Constants.blueColor, height: 40, width: lineWidget, padding: const EdgeInsets.all(8.0), child: Align( alignment: Alignment.centerRight, child: Text( '${number.toString()}', style: TextStyle( fontSize: 16, color: Colors.white, fontWeight: FontWeight.bold, ), ), ), ), ], ), ); }); } }