import 'dart:ui';

import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/pharmaciesLivechat_page.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 'hospitalsLivechat_page.dart';

class LiveChatPage extends StatefulWidget {
  @override
  _LiveChatPageState createState() => _LiveChatPageState();
}

class _LiveChatPageState extends State<LiveChatPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;
  List<ImagesInfo> imagesInfo = List();

  @override
  void initState() {
    super.initState();
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/0.png'));
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/1.png'));
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/2.png'));

    _tabController = TabController(length: 2, vsync: this);
  }

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

  @override
  @override
  Widget build(BuildContext context) {
    return AppScaffold(
      isShowAppBar: true,
      imagesInfo: imagesInfo,
      title: TranslationBase.of(context).liveChat,
      description: TranslationBase.of(context).infoChat,
      appBarTitle: TranslationBase.of(context).service,
      body: Scaffold(
        extendBodyBehindAppBar: true,
        appBar: PreferredSize(
          preferredSize: Size.fromHeight(65.0),
          child: Stack(
            children: <Widget>[
              Positioned(
                bottom: 1,
                left: 0,
                right: 0,
                child: BackdropFilter(
                  filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
                  child: Container(
                    color: Theme.of(context)
                        .scaffoldBackgroundColor
                        .withOpacity(0.8),
                    height: 70.0,
                  ),
                ),
              ),
              Center(
                child: Container(
                  height: 60.0,
                  margin: EdgeInsets.only(top: 10.0),
                  width: MediaQuery.of(context).size.width * 0.92, // 0.9,
                  decoration: BoxDecoration(
                      border: Border(
                        bottom: BorderSide(
                            color: Theme.of(context).dividerColor,
                            width: 0.9), //width: 0.7
                      ),
                      color: Colors.white),
                  child: Center(
                    child: TabBar(
                      isScrollable: true,
                      controller: _tabController,
                      indicatorWeight: 5.0,
                      indicatorSize: TabBarIndicatorSize.tab,
                      indicatorColor: Theme.of(context).primaryColor,
                      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: Texts(TranslationBase.of(context).hospitals),
                          ),
                        ),
                        Container(
                          width: MediaQuery.of(context).size.width * 0.30,
                          child: Center(
                            child: Texts(TranslationBase.of(context).pharmacies),
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
        body: Column(
          children: <Widget>[
            Expanded(
              child: TabBarView(
                physics: BouncingScrollPhysics(),
                controller: _tabController,
                children: <Widget>[
                  HospitalsLiveChatPage(), //SendFeedbackPage(),
                  PhamaciesLiveChatPage()
                  //StatusFeedbackPage()
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
