environment_monitoring_app/lib/screens/marine/manual/pre_sampling.dart
2025-08-04 15:11:24 +08:00

60 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
class MarinePreSampling extends StatefulWidget {
@override
State<MarinePreSampling> createState() => _MarinePreSamplingState();
}
class _MarinePreSamplingState extends State<MarinePreSampling> {
final _formKey = GlobalKey<FormState>();
String site = '';
String weather = '';
String tide = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Marine Pre-Sampling")),
body: Padding(
padding: const EdgeInsets.all(24),
child: Form(
key: _formKey,
child: ListView(
children: [
Text("Enter Pre-Sampling Conditions", 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: "Weather"),
onChanged: (val) => weather = val,
validator: (val) => val == null || val.isEmpty ? "Required" : null,
),
SizedBox(height: 16),
TextFormField(
decoration: InputDecoration(labelText: "Tide Condition"),
onChanged: (val) => tide = 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("Pre-sampling data submitted")),
);
}
},
child: Text("Submit"),
),
],
),
),
),
);
}
}