import 'package:modelo/home/home.dart';
//import 'package:modelo/instagram_embed/instagram_embed.dart';
import 'package:modelo/notificacoes/notificacoes.dart';
//import 'package:modelo/videos/youtube_videos.dart';
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:modelo/pdfviewer/pdfviewer.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:line_icons/line_icons.dart';
//import 'package:line_icons/line_icons.dart';

class IndexController extends GetxController with SingleGetTickerProviderMixin {
  TabController? tabController;
  var tabs = <TabItem>[].obs;
  var childrenTabs = <Widget>[].obs;
  @override
  void onInit() {
    super.onInit();
    this.initTabs();
    this.tabController!.index = 1;
  }

  @override
  void onClose() {
    this.tabController!.dispose();
    super.onClose();
  }

  void initTabs() {
    //this.childrenTabs.add(YouTubeVideosScreen());
    //this.childrenTabs.add(InstagramScreen());
    this
        .childrenTabs
        .add(Tab(key: PageStorageKey('pdftab'), child: PDFViewerScreen()));
    this.childrenTabs.add(Tab(child: HomeScreen()));
    this.childrenTabs.add(Tab(child: NotificacoesScreen()));
    //this.tabs.add(TabItem(icon: Icons.video_collection, title: 'Vídeos'));
    //this.tabs.add(TabItem(icon: LineIcons.instagram, title: 'Instagram'));
    this.tabs.add(TabItem(icon: LineIcons.identificationCard, title: 'i-Card'));
    this.tabs.add(TabItem(icon: Icons.home, title: 'Home'));
    this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações'));
    this.tabController = TabController(vsync: this, length: this.tabs.length);
  }

  void tabsWithoutVideos() {
    this.childrenTabs.clear();
    this.tabs.clear();
    this.childrenTabs.add(HomeScreen());
    this.childrenTabs.add(NotificacoesScreen());
    this.tabs.add(TabItem(icon: Icons.home, title: 'Home'));
    this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações'));
    this.tabController =
        new TabController(vsync: this, length: this.tabs.length);
    Get.rawSnackbar(message: 'Vídeos temporariamente indisponível');
  }
}
