import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'insurance_card_update_details.dart'; import 'insurance_page.dart'; class InsuranceUpdate extends StatefulWidget { @override _InsuranceUpdateState createState() => _InsuranceUpdateState(); } class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); } void dispose() { super.dispose(); _tabController.dispose(); } Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getInsuranceUpdated(), builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( appBarTitle: TranslationBase.of(context).insurCards, description: TranslationBase.of(context).infoInsurCards, infoList: TranslationBase.of(context).infoPrescriptionsPoints, imagesInfo: imagesInfo, isShowAppBar: true, isShowDecPage: true, baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( preferredSize: Size.fromHeight(70.0), child: Stack( children: [ Center( child: Container( height: 60.0, margin: EdgeInsets.only(top: 10.0), width: MediaQuery.of(context).size.width * 1.9, decoration: BoxDecoration( border: Border( bottom: BorderSide( color: Theme.of(context).dividerColor, width: 5.7, ), ), color: Colors.white, ), child: Center( child: TabBar( controller: _tabController, isScrollable: true, indicatorWeight: 4.0, indicatorColor: Theme.of(context).primaryColor, labelColor: Theme.of(context).primaryColor, labelPadding: EdgeInsets.symmetric( horizontal: 13.0, vertical: 2.0), unselectedLabelColor: Colors.grey, tabs: [ Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( child: Texts(TranslationBase.of(context) .updateInsuranceSubtitle), ), ), Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( child: Texts(TranslationBase.of(context).history), ), ), ], ), ), ), ) ], ), ), body: Column( children: [ Expanded( child: TabBarView( physics: BouncingScrollPhysics(), controller: _tabController, children: [ InsurancePage(model:model), Container( child: ListView.builder( itemCount: model.insuranceUpdate == null ? 0 : model.insuranceUpdate.length, itemBuilder: (BuildContext context, int index) { return Container( margin: EdgeInsets.all(10.0), child: Card( margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), child: Container( width: MediaQuery.of(context).size.width, padding: EdgeInsets.all(10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ Flex( direction: Axis.horizontal, children: [ Expanded( flex: 3, child: Container( margin: EdgeInsets.only( top: 2.0, left: 10.0, right: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( model.user.firstName + " " + model.user.lastName, fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black, ), SizedBox( height: 8, ), Texts( TranslationBase.of(context) .fileno + ": " + model .insuranceUpdate[ index] .patientID .toString(), fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black, ), SizedBox( height: 8, ), Texts( model.insuranceUpdate[index] .createdOn, fontSize: 14, fontWeight: FontWeight.w500, color: Colors.black, ), ], ), ), ), Expanded( flex: 1, child: Container( margin: EdgeInsets.only(top: 20.0), child: Column( children: [ Image.asset( "assets/images/new-design/confirm_button.png", width: 30.0, height: 30.0), Container( margin: EdgeInsets.only( top: 13.5, left: 2.0), child: Texts( model.insuranceUpdate[index] .statusDescription, textAlign: TextAlign.center, fontSize: 12, color: Colors.black, ), ), ], ), ), ) ], ), ], ), ), ), ); }), ), ], )) ], ), ), ), ); } }