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"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}