import 'package:flutter/material.dart';
import 'package:fluttericon/entypo_icons.dart';
import 'package:unit2/utils/text_container.dart';

import '../../../../theme-data.dart/colors.dart';
import '../../../../utils/global.dart';
import 'components/save_settings.dart';

class QRCodeScanner extends StatelessWidget {
  const QRCodeScanner({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text(qrScannerTitle),
          centerTitle: true,
          backgroundColor: primary,
        ),
        body: SizedBox(
          height: screenHeight * 100,
          width: double.infinity,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const SizedBox(
                height: 40,
              ),
              GestureDetector(
                onTap: () {},
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    SizedBox(
                        height: 160,
                        child: Image.asset('assets/pngs/qr-scan.png')),
                    const SizedBox(
                      height: 8,
                    ),
                    Text(
                      tapToScanQR,
                      textAlign: TextAlign.center,
                      style: Theme.of(context)
                          .textTheme
                          .displayMedium!
                          .copyWith(
                              fontSize: 22,
                              color: primary,
                              fontWeight: FontWeight.bold),
                    ),
                    const SizedBox(
                      height: 8,
                    ),
                    //TODO add API data
                    "INCOMING" == "INCOMING"
                        ? SizedBox(
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Text(
                                  incoming,
                                  textAlign: TextAlign.center,
                                  style: Theme.of(context)
                                      .textTheme
                                      .displayMedium!
                                      .copyWith(
                                          fontSize: 20,
                                          color: success2,
                                          fontWeight: FontWeight.bold),
                                ),
                                const Icon(
                                  Entypo.down_bold,
                                  color: success2,
                                )
                              ],
                            ),
                          )
                        : SizedBox(
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Text(
                                  //TODO add API data
                                  "INCOMING",
                                  textAlign: TextAlign.center,
                                  style: Theme.of(context)
                                      .textTheme
                                      .displayMedium!
                                      .copyWith(
                                          fontSize: 20,
                                          color: second,
                                          fontWeight: FontWeight.bold),
                                ),
                                const Icon(
                                  Entypo.up_bold,
                                  color: second,
                                )
                              ],
                            ),
                          )
                  ],
                ),
              ),
              Container(
                padding: const EdgeInsets.only(top: 12),
                decoration: const BoxDecoration(
                    boxShadow: [
                      BoxShadow(
                        color: Colors.black38,
                        blurRadius: 30,
                        offset: Offset(-5, 0),
                      ),
                    ],
                    color: Colors.white,
                    borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(15),
                        topRight: Radius.circular(15))),
                width: double.infinity,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: const [
                    SelectedState(
                      //TODO add api data

                      title: "Provincial Government of ADN",
                      subtitle: establishment,
                    ),
                    Center(
                      child: SelectedState(
                        //TODO add api data
                        title: "Agusan Up",
                        subtitle: checkpointArea,
                      ),
                    ),
                    SelectedState(
                      //TODO add api data
                      title: "INCOMING",
                      subtitle: scanMode,
                    ),
                  ],
                ),
              )
            ],
          ),
        ));
  }
}
