20 lines
681 B
Dart
20 lines
681 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ResultModel extends ChangeNotifier {
|
|
double _joule = 0;
|
|
String _energyWater = '0';
|
|
String _energyIron = '0';
|
|
|
|
double get getJoule => _joule;
|
|
String get getWater => _energyWater;
|
|
String get getIron => _energyIron;
|
|
|
|
void changeJoule(double weight, double sSpeed, double eSpeed, double sHeight,
|
|
double eHeight) {
|
|
_joule = (((weight * 9.8 * sHeight) + ((weight * (sSpeed * sSpeed)) / 2)) - ((weight * 9.8 * eHeight) + ((weight * (eSpeed * eSpeed)) / 2))).abs();
|
|
_energyWater = (_joule / (4186 * 80)).toStringAsFixed(2);
|
|
_energyIron = (_joule / (500 * 680)).toStringAsFixed(2);
|
|
notifyListeners();
|
|
}
|
|
}
|