

import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart';
import 'package:flutter/material.dart';

import 'new_e_referral_step_three_page.dart';
import 'new_e_referral_step_two_page.dart';

class StartIndexForNewEReferral extends StatefulWidget {

  StartIndexForNewEReferral();

  @override
  _StartIndexForNewEReferralState createState() =>
      _StartIndexForNewEReferralState();
}

class _StartIndexForNewEReferralState extends State<StartIndexForNewEReferral>
    with TickerProviderStateMixin {
  PageController _controller;
  int _currentIndex = 1;
  int pageSelected = 2;


  CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel();

  @override
  void initState() {
    super.initState();
    _controller = new PageController();
  }

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

  changePageViewIndex(pageIndex) {
    _controller.jumpToPage(pageIndex);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: SingleChildScrollView(
          child: Container(
            height: MediaQuery.of(context).size.height,
            child: PageView(
              physics: NeverScrollableScrollPhysics(),
              controller: _controller,
              onPageChanged: (index) {
                setState(() {
                  _currentIndex = index;
                });
              },
              scrollDirection: Axis.horizontal,
              children: <Widget>[
                NewEReferralStepOnePage(
                  changePageViewIndex: changePageViewIndex,
                  createEReferralRequestModel: createEReferralRequestModel,
                ),
                NewEReferralStepTowPage(
                  changePageViewIndex: changePageViewIndex,
                  createEReferralRequestModel: createEReferralRequestModel,

                ),
                NewEReferralStepThreePage(
                  changePageViewIndex: changePageViewIndex,
                  createEReferralRequestModel: createEReferralRequestModel,

                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
