Files
rog_app/lib/pages/drawer/drawer_page.dart
2022-09-14 19:51:50 +05:30

109 lines
3.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
class DrawerPage extends StatelessWidget {
DrawerPage({ Key? key }) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Drawer(
// Add a ListView to the drawer. This ensures the user can scroll
// through the options in the drawer if there isn't enough vertical
// space to fit everything.
child: Column(
children: [
Container(
height: 100,
color: Colors.amber,
child: Obx(() =>
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child:
indexController.currentUser.length == 0 ?
Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),))
:
Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),),
),
)
),
),
Obx(() =>
indexController.currentUser.length == 0 ?
ListTile(
leading: const Icon(Icons.login),
title: Text("login".tr),
onTap: (){
Get.toNamed(AppPages.LOGIN);
},
) :
ListTile(
leading: const Icon(Icons.login),
title: Text("logout".tr),
onTap: (){
indexController.currentUser.clear();
Get.toNamed(AppPages.TRAVEL);
},
)
),
indexController.currentUser.length > 0 ?
ListTile(
leading: const Icon(Icons.password),
title: Text("change_password".tr),
onTap: (){},
) :
Container(width: 0, height: 0,),
indexController.currentUser.length == 0 ?
ListTile(
leading: const Icon(Icons.person),
title: Text("sign_up".tr),
onTap: (){
Get.toNamed(AppPages.REGISTER);
},
) :
Container(width: 0, height: 0,),
// ListTile(
// leading: const Icon(Icons.person),
// title: Text("profile".tr),
// onTap: (){},
// ),
// ListTile(
// leading: const Icon(Icons.route),
// title: Text("recommended_route".tr),
// onTap: (){},
// ),
// ListTile(
// leading: const Icon(Icons.favorite_rounded),
// title: Text("point_rank".tr),
// onTap: (){},
// ),
indexController.currentUser.length > 0 ?
ListTile(
leading: const Icon(Icons.featured_video),
title: Text("rog_web".tr),
onTap: (){},
) :
Container(width: 0, height: 0,),
// ListTile(
// leading: const Icon(Icons.router),
// title: Text("my_route".tr),
// onTap: (){},
// ),
// ListTile(
// leading: const Icon(Icons.history_sharp),
// title: Text("visit_history".tr),
// onTap: (){},
// ),
],
),
),
);
}
}