//import 'package:modelo/home/home.dart';
import 'package:modelo/index/index_controller.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:flutter/material.dart';
import 'package:get/get.dart';

class IndexScreen extends StatefulWidget {
  @override
  _IndexScreenState createState() => _IndexScreenState();
}

class _IndexScreenState extends State<IndexScreen> {
  // TabController _tabController;

  // @override
  // void initState() {
  //   super.initState();
  //   _tabController = TabController(length: 3, vsync: this);
  //   _tabController.index = 1;
  // }

  // @override
  // void dispose() {
  //   _tabController.dispose();
  //   super.dispose();
  // }
  final IndexController c = Get.put(IndexController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Obx(() => TabBarView(
            controller: c.tabController,
            physics: NeverScrollableScrollPhysics(),
            // children: [
            //   YouTubeVideosScreen(),
            //   HomeScreen(),
            //   NotificacoesScreen()
            // ]
            children: c.childrenTabs.map((element) => element).toList(),
          )),
      bottomNavigationBar: Obx(() => ConvexAppBar(
            // items: [
            //   TabItem(icon: Icons.video_collection, title: 'Vídeos'),
            //   TabItem(icon: Icons.home, title: 'Home'),
            //   TabItem(icon: Icons.notifications, title: 'Notificações'),
            // ],
            items: c.tabs.map((element) => element).toList(),
            style: TabStyle.flip,
            backgroundColor: Theme.of(context).primaryColor,
            controller: c.tabController,
            // onTap: (int i){
            //   print(i);
            // },
          )),
    );
  }
}
