environment_monitoring_app/lib/screens/river/investigative/entry.dart
2025-08-04 15:11:24 +08:00

61 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
class EntryScreen extends StatefulWidget {
@override
State<EntryScreen> createState() => _EntryScreenState();
}
class _EntryScreenState extends State<EntryScreen> {
final _formKey = GlobalKey<FormState>();
String site = '';
String parameter = '';
String value = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("River Investigative Entry")),
body: Padding(
padding: const EdgeInsets.all(24),
child: Form(
key: _formKey,
child: ListView(
children: [
Text("Enter River Study Data", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
SizedBox(height: 24),
TextFormField(
decoration: InputDecoration(labelText: "Site"),
onChanged: (val) => site = val,
validator: (val) => val == null || val.isEmpty ? "Required" : null,
),
SizedBox(height: 16),
TextFormField(
decoration: InputDecoration(labelText: "Parameter"),
onChanged: (val) => parameter = val,
validator: (val) => val == null || val.isEmpty ? "Required" : null,
),
SizedBox(height: 16),
TextFormField(
decoration: InputDecoration(labelText: "Value"),
keyboardType: TextInputType.number,
onChanged: (val) => value = val,
validator: (val) => val == null || val.isEmpty ? "Required" : null,
),
SizedBox(height: 24),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("River data submitted")),
);
}
},
child: Text("Submit"),
),
],
),
),
),
);
}
}