cpd_2022_energy/lib/widgets/output_card_widget.dart

19 lines
702 B
Dart

import 'package:cpd_2022_energy/provider/energy_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class OutputCardWidget extends StatelessWidget {
const OutputCardWidget({super.key});
@override
Widget build(BuildContext context) {
return Consumer<EnergyModel>(
builder: (context, model, child) => Card(
child: Column(children: <Widget>[
Text("Energy in Kilo Joule: ${model.totalEnergy.toStringAsFixed(2)}"),
Text('Water in Liter: ${model.boilingWaterAmount.toStringAsFixed(2)}'),
Text('Iron in Kilogram: ${model.annealingIronAmount.toStringAsFixed(2)}'),
])));
}
}