import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart';
import 'package:diplomaticquarterapp/uitl/location_util.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';

class Search extends StatefulWidget {
  final int type;
  final List clnicIds;
  Search({this.type = 0, this.clnicIds});
  @override
  _SearchState createState() => _SearchState();
}

class _SearchState extends State<Search> with TickerProviderStateMixin {
  TabController _tabController;

  @override
  void initState() {
    _tabController =
        new TabController(length: 2, vsync: this, initialIndex: widget.type);

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    AppGlobal.context = context;
    return Scaffold(
      appBar: AppBar(
        bottom: TabBar(
          tabs: [
            Tab(text: TranslationBase.of(context).clinicName),
            Tab(
              text: TranslationBase.of(context).doctorName,
            )
          ],
          controller: _tabController,
        ),
        title: Text(TranslationBase.of(context).bookAppo,
            style: TextStyle(color: Colors.white)),
        leading: Builder(
          builder: (BuildContext context) {
            return ArrowBack();
          },
        ),
      ),
      body: TabBarView(
          physics: NeverScrollableScrollPhysics(),
          children: [
            SearchByClinic(
              clnicIds: widget.clnicIds,
            ),
            SearchByDoctor()
          ],
          controller: _tabController),
    );
  }
}
