Birth Notification UI Implemented
parent
b64ba9211e
commit
7280e2a1d7
@ -0,0 +1,273 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/insurance/AttachInsuranceCardImageDialog.dart';
|
||||
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class BirthNotification extends StatefulWidget {
|
||||
const BirthNotification({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BirthNotification> createState() => _BirthNotificationState();
|
||||
}
|
||||
|
||||
class _BirthNotificationState extends State<BirthNotification> {
|
||||
TextEditingController motherMRN = new TextEditingController();
|
||||
TextEditingController motherName = new TextEditingController();
|
||||
TextEditingController fatherName = new TextEditingController();
|
||||
TextEditingController babyName = new TextEditingController();
|
||||
TextEditingController contactNumber = new TextEditingController();
|
||||
|
||||
ProjectViewModel projectViewModel;
|
||||
|
||||
List<String> images = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
projectViewModel = Provider.of(context);
|
||||
motherMRN.text = projectViewModel.user.patientID.toString();
|
||||
motherName.text = projectViewModel.user.firstName + " " + projectViewModel.user.lastName;
|
||||
contactNumber.text = projectViewModel.user.mobileNumber;
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
isShowDecPage: false,
|
||||
showNewAppBarTitle: true,
|
||||
showNewAppBar: true,
|
||||
appBarTitle: TranslationBase.of(context).birthNotificationTitle + " " + TranslationBase.of(context).birthNotificationSubTitle,
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
decoration: containerRadius(Colors.white, 12),
|
||||
margin: EdgeInsets.all(21.0),
|
||||
padding: const EdgeInsets.all(21.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
TranslationBase.of(context).enterDetailBelow + " :",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.64,
|
||||
),
|
||||
),
|
||||
mHeight(16),
|
||||
inputWidget(TranslationBase.of(context).mothersMRN, "", motherMRN, isEnable: false),
|
||||
mHeight(16),
|
||||
inputWidget(TranslationBase.of(context).mothersName, "", motherName, isEnable: false),
|
||||
mHeight(16),
|
||||
inputWidget(TranslationBase.of(context).fathersName, "", fatherName),
|
||||
mHeight(16),
|
||||
inputWidget(TranslationBase.of(context).babysName, "", babyName),
|
||||
mHeight(16),
|
||||
inputWidget(TranslationBase.of(context).contactNumber, "", contactNumber),
|
||||
mHeight(16),
|
||||
DefaultButton(
|
||||
TranslationBase.of(context).scanID,
|
||||
() {
|
||||
confirmAttachInsuranceCardImageDialogDialog(
|
||||
context: context, name: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, fileNo: projectViewModel.user.patientID.toString());
|
||||
},
|
||||
color: CustomColors.accentColor,
|
||||
disabledColor: CustomColors.grey2,
|
||||
),
|
||||
if (images.isNotEmpty) mHeight(16),
|
||||
if (images.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Image.memory(
|
||||
base64Decode(images[0]),
|
||||
width: 80.0,
|
||||
height: 80.0,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
Text(
|
||||
"image 1.png",
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.64,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
images.clear();
|
||||
});
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete_sharp,
|
||||
color: Colors.red[300],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
mHeight(16),
|
||||
Text(
|
||||
"● " + TranslationBase.of(context).birthNotificationNotes1,
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.64,
|
||||
),
|
||||
),
|
||||
mHeight(16),
|
||||
Text(
|
||||
"● " + TranslationBase.of(context).birthNotificationNotes2,
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.64,
|
||||
),
|
||||
),
|
||||
mHeight(16),
|
||||
Text(
|
||||
"● " + TranslationBase.of(context).birthNotificationNotes3,
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.64,
|
||||
),
|
||||
),
|
||||
mHeight(16.0),
|
||||
DefaultButton(
|
||||
TranslationBase.of(context).submit,
|
||||
() {},
|
||||
color: CustomColors.accentColor,
|
||||
disabledColor: CustomColors.grey2,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo}) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (cxt) => AttachInsuranceCardImageDialog(
|
||||
fileNo: fileNo,
|
||||
name: name,
|
||||
image: (file, image) async {
|
||||
images.clear();
|
||||
images.add(image);
|
||||
setState(() {});
|
||||
// GifLoaderDialogUtils.showMyDialog(context);
|
||||
// await model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID, image: image);
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// if (model.state == ViewState.ErrorLocal || model.state == ViewState.Error) {
|
||||
// AppToast.showErrorToast(message: model.error);
|
||||
// } else {
|
||||
// AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent);
|
||||
// }
|
||||
// Navigator.pop(context);
|
||||
},
|
||||
isBirthNotification: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Color(0xffefefef),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: hasSelection ? () {} : null,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_labelText,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.44,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
enabled: isEnable,
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
keyboardType: TextInputType.name,
|
||||
controller: _controller,
|
||||
onChanged: (value) => {},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
height: 21 / 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xff2B353E),
|
||||
letterSpacing: -0.44,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
hintText: _hintText,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
height: 21 / 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Color(0xff575757),
|
||||
letterSpacing: -0.56,
|
||||
),
|
||||
prefixIconConstraints: BoxConstraints(minWidth: 50),
|
||||
prefixIcon: prefix == null
|
||||
? null
|
||||
: Text(
|
||||
"+" + prefix,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
height: 21 / 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xff2E303A),
|
||||
letterSpacing: -0.56,
|
||||
),
|
||||
),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
border: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue