import 'package:cheminova/screens/home_screen.dart'; // Importing HomePage screen
import 'package:cheminova/widgets/common_background.dart'; // Importing custom background widget
import 'package:flutter/material.dart'; // Flutter material package for UI components

// Stateful widget for the Attendance Success screen
class AttendanceSuccess extends StatefulWidget {
  const AttendanceSuccess({super.key});

  @override
  State<AttendanceSuccess> createState() => _VerifySuccessFullScreenState();
}

// State implementation for AttendanceSuccess screen
class _VerifySuccessFullScreenState extends State<AttendanceSuccess> {

  @override
  void initState() {
    super.initState();
    // Delayed navigation to HomePage after 2 seconds
    Future.delayed(const Duration(seconds: 2), () {
      Navigator.pushReplacement(
          context, MaterialPageRoute(builder: (context) => const HomePage()));
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // Using CommonBackground widget for consistent styling
      body: CommonBackground(
        child: Center(
          // Centering content
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center, // Vertically center elements
            children: [
              // Displaying confirmation message with styling
              Container(
                padding: const EdgeInsets.all(20.0),
                decoration: BoxDecoration(
                  color: const Color(0xFF243B8A), // Message box background color
                  borderRadius: BorderRadius.circular(15.0), // Rounded corners for the message box
                ),
                child: const Text(
                  'Your Attendance\nHas been\nMarked!', // Text displayed in the center of the screen
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 36,
                    color: Colors.white,
                    fontWeight: FontWeight.w400,
                    fontFamily: 'Anek',
                  ),
                ),
              ),
              const SizedBox(height: 20), // Space between the text and image (image currently commented out)
              // Image.asset('assets/check_circle.png'), // Image for success status (currently commented out)
            ],
          ),
        ),
      ),
    );
  }
}
