import 'dart:ui';

import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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 EReferralPage extends StatefulWidget {
  @override
  _EReferralPageState createState() => _EReferralPageState();
}

class _EReferralPageState extends State<EReferralPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);
    return BaseView<EReferralViewModel>(
      onModelReady: (model) => model.getAllCities(),
      builder: (_, model, widget) => AppScaffold(
        isShowAppBar: true,
        showNewAppBar: true,
        showNewAppBarTitle: true,
        appBarTitle: TranslationBase.of(context).ereferral,
        description: TranslationBase.of(context).eReferralInfo,
        imagesInfo: [
          ImagesInfo(
            imageAr:
                'https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/ar/1.png',
            imageEn:
                'https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png',
          )
        ],
        body: Column(
          children: [
            TabBar(
              isScrollable: false,
              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(
                fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
                fontSize: 16,
                fontWeight: FontWeight.w600,
                letterSpacing: -0.48,
              ),
              unselectedLabelStyle: TextStyle(
                fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
                fontSize: 16,
                fontWeight: FontWeight.w600,
                letterSpacing: -0.48,
              ),
              tabs: [
                Text(TranslationBase.of(context).newReferral),
                Text(TranslationBase.of(context).searchForReferrals),
              ],
            ),
            Expanded(
              child: TabBarView(
                physics: BouncingScrollPhysics(),

                controller: _tabController,
                children: <Widget>[
                  StartIndexForNewEReferral(),
                  SearchForReferralsPage()
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
