import 'package:flutter/material.dart';

class RiverTriennialSampling extends StatefulWidget {
  @override
  State<RiverTriennialSampling> createState() => _RiverTriennialSamplingState();
}

class _RiverTriennialSamplingState extends State<RiverTriennialSampling> {
  final _formKey = GlobalKey<FormState>();
  String site = '';
  String parameter = '';
  String value = '';
  String year = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("River Triennial Sampling")),
      body: Padding(
        padding: const EdgeInsets.all(24),
        child: Form(
          key: _formKey,
          child: ListView(
            children: [
              Text("Enter Triennial Sampling 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: 16),
              TextFormField(
                decoration: InputDecoration(labelText: "Year"),
                keyboardType: TextInputType.number,
                onChanged: (val) => year = 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("Triennial sampling data submitted")),
                    );
                  }
                },
                child: Text("Submit"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}