import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

// ignore: must_be_immutable
class ConfirmAddAmountDialog extends StatefulWidget {
  final int amount;
  final String unit;
  final H2OViewModel model;


  ConfirmAddAmountDialog(
      {Key key, this.model,this.amount,this.unit ="ml"});

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

class _ConfirmAddAmountDialogState extends State<ConfirmAddAmountDialog> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SimpleDialog(
      contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0),
      title: Center(
        child: Texts(
          "Confirm",
          color: Colors.black,
        ),
      ),
      children: [
        Column(
          children: [
            Divider(),
            Center(
              child: Texts(
                "Are you sure you want to Add ${widget.amount} ${widget.unit} ?",
                color: Colors.grey,
              ),
            ),
            SizedBox(
              height: 5.0,
            ),
            Row(
              // mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Expanded(
                  flex: 1,
                  child: InkWell(
                    onTap: () {
                      Navigator.pop(context);
                    },
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Container(
                        child: Center(
                          child: Texts(
                            TranslationBase.of(context).cancel.toUpperCase(),
                            color: Colors.red,
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
                Container(
                  width: 1,
                  height: 30,
                  color: Colors.grey[500],
                ),
                Expanded(
                  flex: 1,
                  child: InkWell(
                    onTap: () async{
                      InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount );
                      await widget.model.insertUserActivity(insertUserActivityRequestModel);
                      Navigator.pop(context);
                    },
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: Center(
                          child: Texts(
                            TranslationBase.of(context).ok,
                            fontWeight: FontWeight.w400,
                          )),
                    ),
                  ),
                ),
              ],
            )
          ],
        )
      ],
    );
  }
}



