Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_smmf_one/core/common/app_theme.dart';
- import 'package:flutter_smmf_one/core/widgets/custom_app_bar.dart';
- import 'package:flutter_smmf_one/core/widgets/custom_button.dart';
- import 'package:flutter_smmf_one/core/widgets/gap/gap.dart';
- import 'package:flutter_smmf_one/core/widgets/rotated_image.dart';
- import 'package:flutter_smmf_one/data/datasources/db/database_helper.dart';
- import 'package:flutter_smmf_one/presentation/controllers/home_controller.dart';
- import 'package:get/get.dart';
- final _homeController = Get.put(HomeController(), permanent: true);
- class ProfilePage extends StatelessWidget {
- ProfilePage({super.key}) {
- _homeController.getLoggedInUser();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: const CustomAppBar(
- titleText: 'Profile',
- ),
- body: SingleChildScrollView(
- padding: EdgeInsets.symmetric(
- horizontal: defaultMargin,
- ),
- child: Obx(() {
- final loggedInUser = _homeController.loggedInUser;
- if (loggedInUser[DatabaseHelper.columnID] != null) {
- _homeController.getLatestAttendance(
- loggedInUser[DatabaseHelper.columnID],
- );
- }
- final latestAttendance = _homeController.latestAttendance;
- return Column(
- children: [
- Gap(12.h),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- RotatedImage(
- width: 150.w,
- height: 150.h,
- imagePath:
- loggedInUser[DatabaseHelper.columnPhotoMasterPath] ??
- '',
- mirrorHorizontal: true,
- ),
- ],
- ),
- Gap(20.h),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- CustomButton.buttonRounded(
- onTap: () => Get.toNamed(
- '/edit-profile',
- arguments: {
- 'phone': loggedInUser[DatabaseHelper.columnPhone] ?? '',
- 'isEdit':
- loggedInUser[DatabaseHelper.columnProvinceName] !=
- null
- ? true
- : false,
- },
- ),
- padding: EdgeInsets.symmetric(
- horizontal: 16.w,
- vertical: 8.h,
- ),
- text: 'Edit Profile',
- ),
- Gap(12.w),
- CustomButton.buttonRounded(
- onTap: () => Get.toNamed(
- '/register-photo',
- arguments: {
- 'isRegister': false,
- },
- ),
- padding: EdgeInsets.symmetric(
- horizontal: 16.w,
- vertical: 8.h,
- ),
- text: 'Absence',
- ),
- Gap(12.w),
- CustomButton.buttonRounded(
- onTap: () => Get.toNamed(
- '/attendance-list',
- arguments: loggedInUser[DatabaseHelper.columnID],
- ),
- padding: EdgeInsets.symmetric(
- horizontal: 16.w,
- vertical: 8.h,
- ),
- text: 'Attendance',
- ),
- ],
- ),
- Gap(24.h),
- Row(
- children: [
- Icon(
- Icons.phone,
- color: colorRed,
- size: 32.h,
- ),
- Gap(12.w),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Handphone',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnPhone] ?? '',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- ],
- ),
- ],
- ),
- Gap(6.h),
- Divider(
- thickness: 1.h,
- color: colorGrey,
- ),
- Gap(6.h),
- Row(
- children: [
- Icon(
- Icons.group,
- color: colorRed,
- size: 32.h,
- ),
- Gap(12.w),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'NIK',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnNik] ?? '',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- ],
- ),
- ],
- ),
- Gap(6.h),
- Divider(
- thickness: 1.h,
- color: colorGrey,
- ),
- Gap(6.h),
- Row(
- children: [
- Icon(
- Icons.email,
- color: colorRed,
- size: 32.h,
- ),
- Gap(12.w),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Email',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnEmail] ?? '',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- ],
- ),
- ],
- ),
- Gap(6.h),
- Divider(
- thickness: 1.h,
- color: colorGrey,
- ),
- Gap(6.h),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Icon(
- Icons.place,
- color: colorRed,
- size: 32.h,
- ),
- Gap(12.w),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Province',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnProvinceName] ?? '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- Gap(8.h),
- Text(
- 'City',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnCityName] ?? '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- Gap(8.h),
- Text(
- 'Sub District',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnSubDistrictName] ??
- '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- Gap(8.h),
- Text(
- 'District',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- loggedInUser[DatabaseHelper.columnDistrictName] ?? '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- Gap(8.h),
- Text(
- 'Longitude',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- latestAttendance[DatabaseHelper.columnLongitude] ?? '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- Gap(8.h),
- Text(
- 'Latitude',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- fontStyle: FontStyle.italic,
- fontWeight: semiBold,
- ),
- ),
- Gap(4.h),
- Text(
- latestAttendance[DatabaseHelper.columnLatitude] ?? '-',
- style: blackTextStyle.copyWith(
- fontSize: 12.sp,
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- );
- }),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement