44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
|
import 'package:energy/widgets/energy_input_widget.dart';
|
||
|
import 'package:energy/widgets/energy_widget.dart';
|
||
|
import 'package:energy/widgets/heat_capacity_widget.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
import 'models/energy_model.dart';
|
||
|
|
||
|
void main() => runApp(const EnergyApp());
|
||
|
|
||
|
class EnergyApp extends StatelessWidget {
|
||
|
const EnergyApp({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return ChangeNotifierProvider(
|
||
|
create: (_) => EnergyModel(),
|
||
|
child: const MaterialApp(
|
||
|
home: EnergyHomePage(),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class EnergyHomePage extends StatelessWidget {
|
||
|
const EnergyHomePage({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
final EnergyModel e = context.watch<EnergyModel>();
|
||
|
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(title: const Text('Energy Calculation')),
|
||
|
body: Column(
|
||
|
children: [
|
||
|
EnergyInputWidget(e: e),
|
||
|
EnergyWidget(energy: e.energy),
|
||
|
HeatCapacityWidget(water: e.water, iron: e.iron),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|