You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart

106 lines
3.5 KiB
Dart

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(24.0, 0.0, 24.0, 8.0),
titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0),
title: Center(
child: Texts(
"Confirm",
textAlign: TextAlign.center,
color: Colors.black,
),
),
children: [
Column(
children: [
Divider(),
Center(
child: Texts(
"Are you sure you want to Add ${widget.amount} ${widget.unit} ?",
textAlign: TextAlign.center,
color: Colors.grey,
),
),
SizedBox(
height: 16.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.toUpperCase(),
fontWeight: FontWeight.w400,
)),
),
),
),
],
),
],
)
],
);
}
}