TIF_E41202429/Mobile/patrolin/skripsi/lib/view/profile_page.dart

230 lines
9.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:skripsi/config/session.dart';
import 'package:skripsi/config/theme.dart';
import 'package:skripsi/controller/cUser.dart';
import 'package:skripsi/view/login_page.dart';
class ProfilePage extends StatefulWidget {
const ProfilePage({super.key});
@override
State<ProfilePage> createState() => _ProfilePageState();
}
class _ProfilePageState extends State<ProfilePage> {
final cUser = Get.put(CUser());
logout() async {
Session.clearUser();
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => const LoginPage()),
(route) => false);
Get.snackbar("Success", "Berhasil LogOut", backgroundColor: Colors.green);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: EdgeInsets.fromLTRB(10.w, 10.w, 10.w, 60.w),
child: Column(
children: [
Image.asset('assets/logo.png', height: 120.w, width: 120.w),
SizedBox(height: 8.h),
Text(
'Patrol.In',
style: robotoBesarHitam.copyWith(
decoration: TextDecoration.underline,
decorationColor: blackColor,
decorationThickness: 1),
),
SizedBox(height: 16.h),
Container(
decoration: BoxDecoration(
color: secondaryColor,
borderRadius: BorderRadius.circular(12.w),
),
child: Padding(
padding: EdgeInsets.all(12.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tentang Anda',
style: robotoSedangHitam.copyWith(
fontWeight: FontWeight.bold)),
// GestureDetector(
// onTap: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const EditProfilePage(),
// ),
// );
// },
// child: Icon(
// Icons.arrow_forward_ios,
// size: 18.w,
// ),
// )
],
),
const Divider(),
SizedBox(height: 8.w),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Nama',
style: robotoKecilHitam.copyWith(
fontWeight: FontWeight.bold)),
Text(cUser.data.name ?? '', style: robotoKecilHitam),
],
),
SizedBox(height: 16.w),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('No. Telp',
style: robotoKecilHitam.copyWith(
fontWeight: FontWeight.bold)),
Text(cUser.data.noTelp ?? 'kosong',
style: robotoKecilHitam),
],
),
// SizedBox(height: 16.w),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text('Sektor',
// style: robotoKecilHitam.copyWith(
// fontWeight: FontWeight.bold)),
// Text('Patrang', style: robotoKecilHitam),
// ],
// ),
],
),
),
),
SizedBox(height: 12.h),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: secondaryColor,
borderRadius: BorderRadius.circular(12.w),
),
child: Padding(
padding: EdgeInsets.all(10.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [
Row(
children: [
Expanded(
child: Row(
children: [
// const Icon(
// Icons.logout,
// ),
SizedBox(width: 6.w),
Text(
'Keluar',
style: robotoSedangHitam.copyWith(
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
onTap: () {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10.r),
),
),
builder: (context) {
return SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Center(
child: Text(
'Anda yakin ingin keluar?',
style:
robotoBesarHitam.copyWith(
fontSize: 18.sp,
fontWeight: FontWeight.w100,
color: Colors.grey,
),
),
),
),
ListTile(
title: Center(
child: Text(
'Keluar',
style:
robotoBesarHitam.copyWith(
fontSize: 18.sp,
color: Colors.red,
),
),
),
onTap: () {
logout();
},
),
const Divider(),
ListTile(
title: Center(
child: Text(
'Batal',
style:
robotoBesarHitam.copyWith(
fontSize: 18.sp,
fontWeight: FontWeight.w100,
color:
const Color(0xff5E5E5E),
),
),
),
onTap: () {
Navigator.pop(context);
},
),
],
),
);
},
);
},
child: Icon(
Icons.arrow_forward_ios,
size: 16.w,
),
)
],
),
],
)
],
),
),
),
],
),
),
);
}
}