You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
ozgurkon-app/lib/screens/HomePage.dart

68 lines
1.9 KiB

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ozgurkon_app/screens/Live.dart';
import 'package:ozgurkon_app/screens/Chat.dart';
import 'package:ozgurkon_app/widgets/Schedule.dart';
import 'package:ozgurkon_app/screens/Settings.dart';
import 'package:ozgurkon_app/screens/Videos.dart';
class HomePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _HomeState();
}
}
class _HomeState extends State<HomePage> {
int _currentIndex = 0;
final List<Widget> _children = [
ChatPage(),
Live(),
Schedule(),
VideosListView(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('ÖzgürKon'),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Settings()),
);
})
],
),
body: _children[_currentIndex], // new
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
onTap: onTabTapped, // new
currentIndex:
_currentIndex, // this will be set when a new tab is tapped
items: [
BottomNavigationBarItem(
icon: new Icon(Icons.chat),
label: 'chat'.tr,
),
BottomNavigationBarItem(
icon: new Icon(Icons.live_tv),
label: 'live'.tr,
),
BottomNavigationBarItem(
icon: Icon(Icons.date_range), label: 'schedule'.tr),
BottomNavigationBarItem(icon: Icon(Icons.movie), label: 'videos'.tr)
],
),
);
}
void onTabTapped(int index) {
setState(() {
_currentIndex = index;
});
}
}