Submit Button, Navigation Changes
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:witl/fetcher.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:witl/home_screen.dart';
|
|
||||||
|
|
||||||
class InputData extends StatefulWidget {
|
class InputData extends StatefulWidget {
|
||||||
const InputData({super.key});
|
const InputData({super.key});
|
||||||
@@ -13,6 +12,9 @@ class _InputDataState extends State<InputData> {
|
|||||||
late String selectedColor = 'Blue'; // Default color
|
late String selectedColor = 'Blue'; // Default color
|
||||||
late String selectedLine = '1'; // Default line
|
late String selectedLine = '1'; // Default line
|
||||||
|
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
String formattedDate = DateFormat('kk:mm:ss \n EEE d MMM').format(DateTime.now());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -23,7 +25,9 @@ class _InputDataState extends State<InputData> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Text("Choose Tram Line and Colour"),
|
const Text("Choose Tram Line and Colour"),
|
||||||
|
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
|
|
||||||
const Row(
|
const Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -33,6 +37,7 @@ class _InputDataState extends State<InputData> {
|
|||||||
SizedBox(width: 25),
|
SizedBox(width: 25),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -67,29 +72,55 @@ class _InputDataState extends State<InputData> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
// Grab Data from Dropdowns
|
||||||
context,
|
selectedColor;
|
||||||
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
selectedLine;
|
||||||
);
|
|
||||||
|
// Grab Time
|
||||||
|
formattedDate;
|
||||||
|
|
||||||
|
// Send
|
||||||
|
//lingy plez
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
child: const Text("To Homescreen")),
|
child: const Text("Submit Arrival"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const FetchAPI()),
|
'/',
|
||||||
|
(route) => false
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
child: const Text("To Fetch Data")),
|
child: const Text("Homescreen")),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
|
context,
|
||||||
|
'/fetch',
|
||||||
|
(route) => false
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: const Text("Fetch Data")),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:witl/fetcher.dart';
|
||||||
import 'package:witl/home_screen.dart';
|
import 'package:witl/home_screen.dart';
|
||||||
|
import 'package:witl/input_data.dart';
|
||||||
|
|
||||||
void main() => runApp(const MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
@@ -13,7 +15,22 @@ class MyApp extends StatelessWidget {
|
|||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
home: const HomeScreen(),
|
|
||||||
|
// Navigashun with Routes
|
||||||
|
// Base "Home" Route
|
||||||
|
initialRoute: '/',
|
||||||
|
|
||||||
|
// Possible Routes
|
||||||
|
routes: {
|
||||||
|
// Homescreen
|
||||||
|
'/': (context) => const HomeScreen(),
|
||||||
|
|
||||||
|
// Fetching API Data
|
||||||
|
'/fetch': (context) => const FetchAPI(),
|
||||||
|
|
||||||
|
// User Input
|
||||||
|
'/input': (context) => const InputData(),
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user