import 'dart:ui'; import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class HomePrescriptionsPage extends StatefulWidget { @override _HomePrescriptionsPageState createState() => _HomePrescriptionsPageState(); } class _HomePrescriptionsPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); ProjectViewModel projectViewModel; @override void initState() { super.initState(); _tabController = TabController(length: 3, vsync: this); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/0.png')); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/1.png')); } @override void dispose() { super.dispose(); _tabController.dispose(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).prescriptions, description: TranslationBase.of(context).infoPrescriptions, infoList: TranslationBase.of(context).infoPrescriptionsPoints, imagesInfo: imagesInfo, showNewAppBar: true, backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, body: Column( children: [ TabBar( // isScrollable: true, controller: _tabController, indicatorWeight: 3.0, indicatorSize: TabBarIndicatorSize.tab, labelColor: Color(0xff2B353E), unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), labelStyle: TextStyle( fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), tabs: [ Text(TranslationBase.of(context).byClinic, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), Text(TranslationBase.of(context).byHospital, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), Text(TranslationBase.of(context).orderLog, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), ], ), Expanded( child: TabBarView( physics: BouncingScrollPhysics(), controller: _tabController, children: [ PrescriptionsPage( FilterType.Clinic, prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), PrescriptionsPage( FilterType.Hospital, prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), PrescriptionsHistoryPage( prescriptionsViewModel: model, showOrderLog: () async { await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ) ], ), ) ], ), ), ); } }