import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class UpdateInsuranceManually extends StatefulWidget { const UpdateInsuranceManually({Key key}) : super(key: key); @override State createState() => _UpdateInsuranceManuallyState(); } class _UpdateInsuranceManuallyState extends State { TextEditingController _nationalIDTextController = TextEditingController(); TextEditingController _cardHolderNameTextController = TextEditingController(); TextEditingController _membershipNoTextController = TextEditingController(); TextEditingController _policyNoTextController = TextEditingController(); ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); _nationalIDTextController.text = projectViewModel.user.patientIdentificationNo; return AppScaffold( isShowAppBar: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).updateInsurCards, showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: CustomColors.appBackgroudGreyColor, body: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( TranslationBase.of(context).enterInsuranceDetails, textAlign: TextAlign.center, style: TextStyle( fontSize: 16, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), SizedBox(height: 12), InkWell( onTap: () { List list = [ RadioSelectionDialogModel(TranslationBase.of(context).myAccount, 0), RadioSelectionDialogModel(TranslationBase.of(context).myFamilyFiles, 1), RadioSelectionDialogModel(TranslationBase.of(context).otherAccount, 2), ]; showDialog( context: context, builder: (cxt) => RadioSelectionDialog( listData: list, // selectedIndex: // beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)), onValueSelected: (index) { var type; if (index == 0) { // type = BeneficiaryType.MyAccount; } else if (index == 1) { // type = BeneficiaryType.MyFamilyFiles; } else { // type = BeneficiaryType.OtherAccount; } setState(() {}); }, ), ); }, child: Container( padding: EdgeInsets.all(8), width: double.infinity, height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( TranslationBase.of(context).insuranceCompany, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46, ), ), Icon(Icons.arrow_drop_down) ], ), ), ), SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).nationalIdNumber, controller: _nationalIDTextController, readOnly: true, ), SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).cardHolderName, controller: _cardHolderNameTextController, readOnly: false, ), SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).membershipNo, controller: _membershipNoTextController, readOnly: false, ), SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).insurancePolicyNo, controller: _policyNoTextController, readOnly: false, ), SizedBox(height: 12), InkWell( onTap: () { List list = [ RadioSelectionDialogModel(TranslationBase.of(context).myAccount, 0), RadioSelectionDialogModel(TranslationBase.of(context).myFamilyFiles, 1), RadioSelectionDialogModel(TranslationBase.of(context).otherAccount, 2), ]; showDialog( context: context, builder: (cxt) => RadioSelectionDialog( listData: list, // selectedIndex: // beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)), onValueSelected: (index) { var type; if (index == 0) { // type = BeneficiaryType.MyAccount; } else if (index == 1) { // type = BeneficiaryType.MyFamilyFiles; } else { // type = BeneficiaryType.OtherAccount; } setState(() {}); }, ), ); }, child: Container( padding: EdgeInsets.all(8), width: double.infinity, height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( TranslationBase.of(context).insuranceClassName, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46, ), ), Icon(Icons.arrow_drop_down) ], ), ), ), ], ), ), ), bottomSheet: Container( color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.all(18), child: DefaultButton( TranslationBase.of(context).submit, (){} ), ), ); } }