import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/model/TermsConditionModel/terms_condition_model.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/TermsAndConditionApi/terms_condition_api.dart';

class TermsAndConditions extends StatefulWidget {
  const TermsAndConditions({super.key});

  @override
  State<TermsAndConditions> createState() => _TermsAndConditionsState();
}

class _TermsAndConditionsState extends State<TermsAndConditions> {
  RxBool isLoading = true.obs;
  TermsAndConditionModel termsAndConditionModel = TermsAndConditionModel();

  @override
  void initState() {
    TermsAndConditionApi().getTermsAndConditionData().then((value) {
      termsAndConditionModel = TermsAndConditionModel.fromJson(value.data);
      isLoading.value = false;
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const CommonAppbar(
        titleTxt: "Terms & Conditions",
      ),
      backgroundColor: Colors.black,
      extendBody: true,
      body: Obx(
        () => Stack(
          children: [
            const CommonBlurLeft(),
            const CommonBlurRight(),
            isLoading.value
                ? const Center(
                    child: CircularProgressIndicator(
                      color: Color(0xFF9A0000),
                    ),
                  )
                : Stack(
                    children: [
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            horizontal: 16, vertical: 16),
                        child: ListView(
                          physics: const BouncingScrollPhysics(),
                          // mainAxisAlignment: MainAxisAlignment.start,
                          // crossAxisAlignment: CrossAxisAlignment.start,

                          children: [
                            //  CommonDropdownBtn(hint: "hint", items: ["hi", "hii"]),
                            SizedBox(
                              height: 10.h,
                            ),

                            text16W400(
                              termsAndConditionModel.data!.content!,
                            ),
                            SizedBox(
                              height: 10.h,
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
          ],
        ),
      ),
    );
  }
}
