import 'dart:ui';

import 'package:doctor_app_flutter/screens/patients/profile/referral/referred-patient-screen.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'my-referral-inpatient-screen.dart';

class PatientReferralScreen extends StatefulWidget {
  @override
  _PatientReferralScreen createState() => _PatientReferralScreen();
}

class _PatientReferralScreen extends State<PatientReferralScreen>
    with SingleTickerProviderStateMixin {
  TabController _tabController;
  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

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

  @override
  @override
  Widget build(BuildContext context) {
    return AppScaffold(
        isShowAppBar: true,
        appBarTitle: TranslationBase.of(context).patientsreferral,
        body: Scaffold(
          extendBodyBehindAppBar: true,
          // backgroundColor: Colors.white,
          appBar: PreferredSize(
            preferredSize: Size.fromHeight(60.0),
            child: Center(
              child: Container(
                height: 60.0,
                // margin: EdgeInsets.only(top: 10.0),
                width: MediaQuery.of(context).size.width * 1, // 0.92,
                decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(
                          color: Theme.of(context).dividerColor,
                          width: 1), //width: 0.7
                    ),
                    color: Colors.white),
                child: Center(
                  child: TabBar(
                    isScrollable: true,
                    controller: _tabController,
                    indicatorColor: Colors.red[800],
                    indicatorWeight: 5.0,
                    indicatorSize: TabBarIndicatorSize.tab,
                    labelColor: Theme.of(context).primaryColor,
                    labelPadding:
                        EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
                    unselectedLabelColor: Colors.grey[800],
                    tabs: [
                      Container(
                        width: MediaQuery.of(context).size.width * 0.30,
                        child: Center(
                          child:
                              AppText(TranslationBase.of(context).referral),
                        ),
                      ),
                      Container(
                        width: MediaQuery.of(context).size.width * 0.30,
                        child: Center(
                          child: AppText(
                              TranslationBase.of(context).myReferredPatient),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          ),
          body: Column(
            children: <Widget>[
              Expanded(
                child: TabBarView(
                  physics: BouncingScrollPhysics(),
                  controller: _tabController,
                  children: <Widget>[
                    MyReferralInPatientScreen(),
                    ReferredPatientScreen(),
                    // MyReferredPatient(),
                  ],
                ),
              )
            ],
          ),
        ));
  }
}
