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.
46 lines
1.4 KiB
46 lines
1.4 KiB
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import '../controllers/app_controller.dart';
|
|
import '../../modules/home/views/home_view.dart';
|
|
import '../../modules/explore/views/explore_view.dart';
|
|
import '../../modules/profile/views/profile_view.dart';
|
|
|
|
class MainView extends GetView<AppController> {
|
|
const MainView({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Obx(() {
|
|
switch (controller.currentIndex) {
|
|
case 0:
|
|
return const HomeView();
|
|
case 1:
|
|
return const ExploreView();
|
|
case 2:
|
|
return const ProfileView();
|
|
default:
|
|
return const HomeView();
|
|
}
|
|
}),
|
|
bottomNavigationBar: Obx(() => BottomNavigationBar(
|
|
currentIndex: controller.currentIndex,
|
|
onTap: controller.changeIndex,
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.home),
|
|
label: 'home'.tr,
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.explore),
|
|
label: 'explore'.tr,
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: const Icon(Icons.person),
|
|
label: 'profile'.tr,
|
|
),
|
|
],
|
|
)),
|
|
);
|
|
}
|
|
}
|