mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-11-08 20:50:04 +00:00
Added: expanse planner app
This commit is contained in:
54
expense_planner/lib/widgets/chart_bar.dart
Normal file
54
expense_planner/lib/widgets/chart_bar.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChartBar extends StatelessWidget {
|
||||
final String label;
|
||||
final double spendingAmount;
|
||||
final double spendingPctOfTotal;
|
||||
|
||||
ChartBar(this.label, this.spendingAmount, this.spendingPctOfTotal);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 20,
|
||||
child: FittedBox(
|
||||
child: Text('\$${spendingAmount.toStringAsFixed(0)}'),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Container(
|
||||
height: 60,
|
||||
width: 10,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey, width: 1.0),
|
||||
color: Color.fromRGBO(220, 220, 220, 1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
heightFactor: spendingPctOfTotal,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(label),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user