Choosing Line, Colour
This commit is contained in:
@@ -2,9 +2,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:witl/fetcher.dart';
|
import 'package:witl/fetcher.dart';
|
||||||
import 'package:witl/home_screen.dart';
|
import 'package:witl/home_screen.dart';
|
||||||
|
|
||||||
class InputData extends StatelessWidget {
|
class InputData extends StatefulWidget {
|
||||||
const InputData({super.key});
|
const InputData({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InputDataState createState() => _InputDataState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InputDataState extends State<InputData> {
|
||||||
|
late String selectedColor = 'Blue'; // Default color
|
||||||
|
late String selectedLine = '1'; // Default line
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -12,32 +20,76 @@ class InputData extends StatelessWidget {
|
|||||||
title: const Text("Data Input"),
|
title: const Text("Data Input"),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const Text("Choose Tram Line and Colour"),
|
||||||
onTap:() {
|
const SizedBox(height: 15),
|
||||||
Navigator.push(
|
const Row(
|
||||||
context,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
MaterialPageRoute(builder: (context) => const HomeScreen())
|
children: [
|
||||||
);
|
Text("Line:"),
|
||||||
},
|
SizedBox(width: 35),
|
||||||
child: Container(
|
Text("Colour:"),
|
||||||
padding: const EdgeInsets.all(20.0),
|
SizedBox(width: 25),
|
||||||
child: const Text("To Homescreen")
|
],
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
DropdownButton<String>(
|
||||||
|
value: selectedLine,
|
||||||
|
items: <String>['1', '2'].map((String value) {
|
||||||
|
return DropdownMenuItem<String>(
|
||||||
|
value: value,
|
||||||
|
child: Text(value),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (String? newLine) {
|
||||||
|
setState(() {
|
||||||
|
selectedLine = newLine ?? '1'; // Set a default value if newLine is null
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 30),
|
||||||
|
DropdownButton<String>(
|
||||||
|
value: selectedColor,
|
||||||
|
items: <String>['Blue', 'Yellow'].map((String value) {
|
||||||
|
return DropdownMenuItem<String>(
|
||||||
|
value: value,
|
||||||
|
child: Text(value),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (String? newCol) {
|
||||||
|
setState(() {
|
||||||
|
selectedColor = newCol ?? 'Blue'; // Set a default value if newCol is null
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const FetchAPI())
|
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
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("To Homescreen")),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => const FetchAPI()),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: const Text("To Fetch Data")),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -75,6 +75,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
intl:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.19.0"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ dependencies:
|
|||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
intl: ^0.19.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user