import 'package:drifter/pages/terms_of_service/btn_continue_terms_of_service.dart';
import 'package:drifter/pages/terms_of_service/terms_of_service_text.dart';
import 'package:drifter/theme/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';

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

  @override
  State<TermsOfServiceScreen> createState() => _TermsOfServiceScreenState();
}

class _TermsOfServiceScreenState extends State<TermsOfServiceScreen> {
  bool isChecked = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(
            Icons.arrow_back,
            color: AppColors.topNavIconBack,
          ),
          onPressed: () => Navigator.of(context).pop(),
        ),
        elevation: 0,
        backgroundColor: AppColors.mainBackground,
      ),
      backgroundColor: AppColors.mainBackground,
      body: Padding(
        padding: const EdgeInsets.only(top: 10, right: 16, left: 16),
        child: Center(
          child: Column(children: [
            Text(
              'Terms of service',
              style: TextStyle(
                  color: Color(0xFF302F38),
                  fontSize: 20,
                  fontWeight: FontWeight.w600),
            ),
            Padding(
              padding: const EdgeInsets.only(top: 20, bottom: 14),
              child: Container(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(16),
                  color: Colors.white,
                ),
                height: 568,
                child: ListView(
                  padding: EdgeInsets.all(16),
                  children: [TermsOfServiceText.termsOfService],
                ),
              ),
            ),
            Row(
              children: [
                Checkbox(
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(4)),
                  checkColor: Colors.white,
                  activeColor: AppColors.checkboxCheckedBg,
                  value: isChecked,
                  onChanged: (bool? value) {
                    setState(() {
                      isChecked = value!;
                    });
                  },
                ),
                const Text(
                  'I agree to the Terms of Service and Privacy Policy',
                  style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
                ),
              ],
            ),
            SizedBox(
              width: double.infinity,
              height: 56,
              child: isChecked
                  ? const ActiveElevatedButton()
                  : const DisabledElevatedButton(),
            ),
          ]),
        ),
      ),
    );
  }
}