Application/medcify/lib/pages/main/home/drawer_widget.dart

128 lines
5.3 KiB
Dart
Raw Normal View History

2022-09-26 06:33:52 +00:00
import 'package:flutter/material.dart';
import 'package:launch_review/launch_review.dart';
import 'package:medcify/components/alert.dart';
import 'package:medcify/navigation/navigation.dart';
import 'package:medcify/storage/storage.dart';
import 'package:url_launcher/url_launcher.dart';
class DrawerWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: double.infinity,
width: MediaQuery.of(context).size.width - 60,
color: Colors.white,
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(top: 50,bottom: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListTile(
leading: const ImageIcon(AssetImage("assets/images/profile.png")),
title: const Text("Change Profile",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/changeProfile");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/timing.png")),
title: const Text("Change Timing",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/changeTiming");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/upi.png")),
title: const Text("UPI Update",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/upi");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/qr_code.png")),
title: const Text("UPI Qr Update",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/upiQr");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/plan.png")),
title: const Text("Plan",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/plan",args: true);
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/delivery.png")),
title: const Text("Delivering Pincodes",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
Navigation.instance.navigate("/deliveryPincodes");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/qr_code.png")),
title: const Text("View Qr Code",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: () async{
Navigation.instance.goBack();
Navigation.instance.navigate("/qrcode");
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/store.png")),
title: const Text("View Our Store",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: () async{
Navigation.instance.goBack();
await launch(Storage.instance.storeUrl);
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/share.png")),
title: const Text("Share Our App",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
LaunchReview.launch();
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/rating.png")),
title: const Text("Rate Our App",style: TextStyle(color: Colors.black,fontSize: 14),),
onTap: (){
Navigation.instance.goBack();
LaunchReview.launch();
},
),
ListTile(
leading: const ImageIcon(AssetImage("assets/images/logout.png"),color: Colors.red,),
title: const Text("Logout",style: TextStyle(color: Colors.red,fontSize: 14),),
onTap: () {
Navigation.instance.goBack();
AlertX.instance.showAlert(
title: "Logout",
msg: "Are you sure, Do you want to logout?",
positiveButtonText: "Yes",
positiveButtonPressed: () async{
Navigation.instance.goBack();
await Storage.instance.sharedPreferences.clear();
Navigation.instance.navigateAndRemoveUntil("/");
},
negativeButtonText: "No",
negativeButtonPressed: (){
Navigation.instance.goBack();
}
);
},
),
],
),
),
);
}
}