import 'package:flutter/material.dart';

class EntryScreen extends StatefulWidget {
  @override
  State<EntryScreen> createState() => _EntryScreenState();
}

class _EntryScreenState extends State<EntryScreen> {
  final _formKey = GlobalKey<FormState>();
  String location = '';
  String pollutant = '';
  String concentration = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Air Investigative Entry")),
      body: Padding(
        padding: const EdgeInsets.all(24),
        child: Form(
          key: _formKey,
          child: ListView(
            children: [
              Text("Enter Air Study Data", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
              SizedBox(height: 24),
              TextFormField(
                decoration: InputDecoration(labelText: "Location"),
                onChanged: (val) => location = val,
                validator: (val) => val == null || val.isEmpty ? "Required" : null,
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(labelText: "Pollutant"),
                onChanged: (val) => pollutant = val,
                validator: (val) => val == null || val.isEmpty ? "Required" : null,
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(labelText: "Concentration (µg/m³)"),
                keyboardType: TextInputType.number,
                onChanged: (val) => concentration = 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("Air data submitted")),
                    );
                  }
                },
                child: Text("Submit"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}