import 'package:hmg_patient_app/core/model/hospitals/hospitals_model.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/widgets/buttons/secondary_button.dart';
import 'package:hmg_patient_app/widgets/data_display/text.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class EdOnlineAgreementPage extends StatefulWidget {
  final HospitalsModel? selectedHospital;
  final Function? changePageViewIndex;
  bool isAgree;
   EdOnlineAgreementPage({Key? key,  this.selectedHospital,  this.changePageViewIndex,required this.isAgree}) : super(key: key);

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

class _EdOnlineAgreementPageState extends State<EdOnlineAgreementPage> {


  @override
  Widget build(BuildContext context) {
    return AppScaffold(
      body: SingleChildScrollView(
        physics: BouncingScrollPhysics(),
        child: Column(
          children: [
            SizedBox(),
            InkWell(
              onTap: (){
                setState(() {
                  widget.isAgree = !widget.isAgree;
                });
              },
              child: Row(
                children: [
                  Checkbox(
                      value: widget.isAgree,
                      activeColor: Colors.red[800],
                      onChanged: (bool? newValue) {
                        setState(() {
                          widget.isAgree = !widget.isAgree;
                        });
                      }),
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.all(20.0),
                      child: Texts(
                        TranslationBase.of(context).onlineCheckInAgreement,
                        fontSize: 15,
                      ),
                    ),
                  ),
                ],
              ),
            ),
            SizedBox(),
          ],
        ),
      ),
      bottomSheet: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Container(
          height: 56,
          child: Row(
            children: [
              Expanded(
                child: Container(
                  margin: EdgeInsets.only(left: 5,right: 5),
                  child: SecondaryButton(
                    textColor: Colors.white,
                    color: Theme.of(context).primaryColor,
                    label: TranslationBase.of(context).back.toUpperCase(),
                    onTap: () => widget.changePageViewIndex!(0),
                  ),
                ),
              ),
              SizedBox(width: 10,),
              Expanded(
                child: Container(
                  margin: EdgeInsets.only(left: 5,right: 5),
                  child: SecondaryButton(
                    textColor: Colors.white,
                    color: Theme.of(context).primaryColor,
                    label: TranslationBase.of(context).next.toUpperCase(),
                    disabled: !widget.isAgree,
                    onTap: () => widget.changePageViewIndex!(2),
                  ),
                ),
              ),

            ],
          ),
        ),
      ),
    );
  }
}
