import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.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/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; import 'advance_payment_page.dart'; class MyBalancePage extends StatelessWidget { List imagesInfo = List(); ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); return BaseView( onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).myWallet, imagesInfo: imagesInfo, description: TranslationBase.of(context).infoMyBalance, showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: CustomColors.appBackgroudGreyColor, body: Column( children: [ Expanded( child: SingleChildScrollView( physics: BouncingScrollPhysics(), padding: EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.fromLTRB(14, 12, 10, 12), decoration: BoxDecoration( color: Color(0xff2B353E), borderRadius: BorderRadius.all( Radius.circular(10.0), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( "assets/images/new/services/balance_credit.svg", height: 40, width: 40, color: Colors.white, ), SizedBox(height: 6), Text( TranslationBase.of(context).totalBalance, style: TextStyle( fontSize: 16, letterSpacing: -0.96, fontWeight: FontWeight.bold, color: Colors.white, //height: 16/22 ), ), ], ), ), Container( padding: EdgeInsets.fromLTRB(14, 10, 12, 10), decoration: BoxDecoration( color: Color(0xff3f4850), borderRadius: BorderRadius.all( Radius.circular(10.0), ), ), child: Column( crossAxisAlignment: CrossAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: [ Text( double.parse(model.totalAdvanceBalanceAmount?.toString() ?? "0").toStringAsFixed(2), style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, letterSpacing: -1.44, height: 24 / 23, color: Colors.white, ), ), Text( projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, letterSpacing: -0.96, color: Colors.white, ), ), ], ), ), ], ), ), SizedBox(height: 12), ListView.separated( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (cxt, index) { PatientAdvanceBalanceAmount balanceAmount = model.patientAdvanceBalanceAmountList[index]; double amount = double.parse(balanceAmount.patientAdvanceBalanceAmount?.toString() ?? "0"); return Container( padding: EdgeInsets.fromLTRB(14, 18, 14, 18), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), ), boxShadow: [ BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, blurRadius: 27, offset: Offset(0, -3), ), ], color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Text( balanceAmount.projectDescription, style: TextStyle( fontSize: 16, letterSpacing: -0.64, fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, color: Color(0xff2E303A), ), ), ), Text( amount.toStringAsFixed(2) + " " + (projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar), style: TextStyle( fontSize: 16, letterSpacing: -0.64, fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, color: Color(0xff2E303A), ), ), ], ), ); }, separatorBuilder: (cxt, index) => SizedBox(height: 12), itemCount: model.patientAdvanceBalanceAmountList.length), ], ), ), ), DefaultButton( TranslationBase.of(context).createAdvancedPayment, () { Navigator.push(context, FadePage(page: AdvancePaymentPage())); projectViewModel.analytics.advancePayments.wallet_recharge(service_type: 'alhabib wallet'); }, ).insideContainer, ], ), ), ); } }