INSERTION WORKS LESGOO
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:witl/arrival_post.dart';
|
||||
|
||||
class InputData extends StatefulWidget {
|
||||
const InputData({super.key});
|
||||
@@ -10,7 +11,7 @@ class InputData extends StatefulWidget {
|
||||
|
||||
class _InputDataState extends State<InputData> {
|
||||
late String selectedColor = 'Blue'; // Default color
|
||||
late String selectedLine = '1'; // Default line
|
||||
late int selectedLine = 1; // Default line
|
||||
late String selectedDirection = 'Raml'; // Default Station Direction
|
||||
|
||||
// Date and Time Info, FULLY
|
||||
@@ -45,17 +46,17 @@ class _InputDataState extends State<InputData> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
DropdownButton<String>(
|
||||
DropdownButton<int>(
|
||||
value: selectedLine,
|
||||
items: <String>['1', '2'].map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
items: <int>[1, 2].map((int value) {
|
||||
return DropdownMenuItem<int>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
child: Text(value.toString()),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String? newLine) {
|
||||
onChanged: (int? newLine) {
|
||||
setState(() {
|
||||
selectedLine = newLine ?? '1'; // Set a default value if newLine is null
|
||||
selectedLine = newLine ?? 1; // Set a default value if newLine is null
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -112,8 +113,11 @@ class _InputDataState extends State<InputData> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
// Grab Data from Dropdowns
|
||||
selectedColor; //
|
||||
selectedLine;
|
||||
selectedColor; //
|
||||
|
||||
if (selectedColor == 'Yellow') {
|
||||
selectedLine + 2;
|
||||
}
|
||||
|
||||
// Conforming by db standard of boolean
|
||||
bool payloadDirection;
|
||||
@@ -132,6 +136,7 @@ class _InputDataState extends State<InputData> {
|
||||
|
||||
// Send
|
||||
//lingy plez
|
||||
insertArrival('${now.hour}:${now.minute}:${now.second}', now.weekday, selectedLine, payloadDirection);
|
||||
|
||||
//prompting of submission
|
||||
showAlertDialog(context, selectedLine, selectedColor, selectedDirection, userFormattedString);
|
||||
@@ -177,7 +182,7 @@ class _InputDataState extends State<InputData> {
|
||||
}
|
||||
}
|
||||
|
||||
showAlertDialog(BuildContext context, String chosenLine, String chosenColour, String chosenDir, String submissionDate) {
|
||||
showAlertDialog(BuildContext context, int chosenLine, String chosenColour, String chosenDir, String submissionDate) {
|
||||
|
||||
// set up the button
|
||||
Widget okButton = TextButton(
|
||||
|
||||
Reference in New Issue
Block a user