import 'package:flutter/material.dart';

class FAQPage extends StatefulWidget {
  static String routeName = "faqPage";

  @override
  _FAQPageState createState() => _FAQPageState();
}

class _FAQPageState extends State<FAQPage> {
  final List<Item> _data = generateItems();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                for (Item item in _data)
                  ExpansionTile(
                    title: Text(
                      item.headerValue,
                      style: TextStyle(
                        color: Colors.black,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    children: [
                      Padding(
                        padding: const EdgeInsets.symmetric(horizontal: 16.0),
                        child: Text(
                          item.expandedValue,
                          style: TextStyle(
                            color: Colors.black,
                          ),
                        ),
                      ),
                    ],
                  ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

class Item {
  Item({
    required this.expandedValue,
    required this.headerValue,
  });

  String expandedValue;
  String headerValue;
}

List<Item> generateItems() {
  return <Item>[
    Item(
      headerValue: 'How do I know if my Agipad is on?',
      expandedValue: 'You will know when the Agipad is on when...',
    ),
    Item(
      headerValue: 'Can the Agipad be shared with other Skillcourt Apps?',
      expandedValue: 'Answer to Question 2',
    ),
    Item(
      headerValue: 'Question 3',
      expandedValue: 'Answer to Question 3',
    ),
    Item(
      headerValue: 'Question 4',
      expandedValue: 'Answer to Question 4',
    ),
    Item(
      headerValue: 'Question 5',
      expandedValue: 'Answer to Question 5',
    ),
  ];
}
