import 'package:appcardsstarter/home/home.dart';
import 'package:appcardsstarter/notificacoes/notificacoes.dart';
import 'package:appcardsstarter/videos/youtube_videos.dart';
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:flutter/material.dart';

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

class _IndexScreenState extends State<IndexScreen> with SingleTickerProviderStateMixin{
  TabController _tabController;

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

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

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