Advertisement
narimetisaigopi

bottomm nav suresh

Nov 15th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:youtube_player_flutter/youtube_player_flutter.dart';
  3.  
  4. class HomeScreen extends StatefulWidget {
  5. @override
  6. _HomeScreenState createState() => _HomeScreenState();
  7. }
  8.  
  9. class _HomeScreenState extends State<HomeScreen> {
  10. YoutubePlayerController _youtubePlayerController = YoutubePlayerController(
  11. initialVideoId: "Pvd1Y0OR2Nk",
  12. flags: const YoutubePlayerFlags(autoPlay: true, mute: true));
  13. @override
  14. void initState() {
  15. super.initState();
  16. }
  17.  
  18. PageController pageController = PageController(initialPage: 0);
  19.  
  20. int currentIndex = 0;
  21.  
  22. List<Widget> list = [
  23. Text("Home 1"),
  24. Text("Home 2"),
  25. Text("Home 3"),
  26. Text("Home 4"),
  27. Text("Home 5"),
  28. ];
  29.  
  30. @override
  31. Widget build(BuildContext context) {
  32. return Scaffold(
  33. appBar: AppBar(
  34. title: Text("Youtube"),
  35. ),
  36. body: Column(
  37. children: [
  38. currentIndex == 0 ? Text("Home 1") : Container(),
  39. currentIndex == 1 ? Text("Home 2") : Container(),
  40. currentIndex == 2 ? Text("Home 3") : Container(),
  41. currentIndex == 3 ? Text("Home 4") : Container(),
  42. currentIndex == 4 ? Text("Home 5") : Container(),
  43. ],
  44. ),
  45. // body: list[currentIndex],
  46. // body: PageView(
  47. // controller: pageController,
  48. // children: [
  49. // Text("Home 1"),
  50. // Text("Home 2"),
  51. // Text("Home 3"),
  52. // Text("Home 4"),
  53. // Text("Home 5"),
  54. // ],
  55. // onPageChanged: (index) {
  56. // currentIndex = index;
  57. // setState(() {});
  58. // },
  59. // ),
  60. bottomNavigationBar: BottomNavigationBar(
  61. currentIndex: currentIndex,
  62. backgroundColor: Colors.amber,
  63. onTap: (index) {
  64. // pageController.animateToPage(index,
  65. // duration: Duration(milliseconds: 100),
  66. // curve: Curves.easeInBack);
  67. currentIndex = index;
  68. setState(() {});
  69. },
  70. items: [
  71. BottomNavigationBarItem(
  72. icon: Icon(Icons.holiday_village),
  73. backgroundColor: Colors.red,
  74. label: "Home"),
  75. BottomNavigationBarItem(
  76. icon: Icon(Icons.holiday_village),
  77. backgroundColor: Colors.red,
  78. label: "Home"),
  79. BottomNavigationBarItem(
  80. icon: Icon(Icons.holiday_village),
  81. backgroundColor: Colors.red,
  82. label: "Home"),
  83. BottomNavigationBarItem(
  84. icon: Icon(Icons.holiday_village),
  85. backgroundColor: Colors.red,
  86. label: "Home"),
  87. BottomNavigationBarItem(
  88. icon: Icon(Icons.holiday_village),
  89. backgroundColor: Colors.red,
  90. label: "Home"),
  91. ]),
  92. );
  93. }
  94. }
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement