1
0
Fork 0
flutter_demo_energy/lib/widgets/energy_input_widget.dart

40 lines
824 B
Dart
Raw Normal View History

2023-04-12 08:41:41 +02:00
import 'package:flutter/material.dart';
import '../models/energy_model.dart';
class EnergyInputWidget extends StatelessWidget {
const EnergyInputWidget({
super.key,
required this.e,
});
final EnergyModel e;
@override
Widget build(BuildContext context) {
return Column(
children: [
Text("Mass ${e.mass.round()} kg"),
Slider(
value: e.mass,
max: 50000,
divisions: 1000,
label: "Mass",
onChanged: (double value) {
e.mass = value;
},
),
Text("Initial Velocity ${e.vStart.round()} m/s"),
Slider(
value: e.vStart,
max: 1000,
divisions: 1000,
onChanged: (double value) {
e.vStart = value;
},
),
],
);
}
}