106 lines
3.9 KiB
Dart
106 lines
3.9 KiB
Dart
import 'package:cheminova/controller/home_controller.dart';
|
|
import 'package:cheminova/widgets/my_drawer.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../widgets/comman_background.dart';
|
|
import '../../widgets/common_appbar.dart';
|
|
|
|
class ProfileScreen extends StatefulWidget {
|
|
const ProfileScreen({super.key});
|
|
|
|
@override
|
|
State<ProfileScreen> createState() => _ProfileScreenState();
|
|
}
|
|
|
|
class _ProfileScreenState extends State<ProfileScreen> {
|
|
final HomeController _homeController = Get.find();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(children: [
|
|
CommonBackground(
|
|
isFullWidth: true,
|
|
child: Scaffold(
|
|
drawer: const MyDrawer(),
|
|
backgroundColor: Colors.transparent,
|
|
appBar: CommonAppBar(
|
|
title: const Text('Profile'),
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0,
|
|
actions: [
|
|
IconButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
icon: SvgPicture.asset('assets/svg/back_arrow.svg'),
|
|
padding: const EdgeInsets.only(right: 20))
|
|
]),
|
|
body: Obx(() {
|
|
if (_homeController.isLoading.value) {
|
|
return const Center(child: CircularProgressIndicator());
|
|
} else if (_homeController.error.value.isNotEmpty) {
|
|
return Center(child: Text(_homeController.error.value));
|
|
} else {
|
|
final user = _homeController.userProfile.value;
|
|
return SingleChildScrollView(
|
|
child: Column(children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(20.0)
|
|
.copyWith(top: 15, bottom: 30),
|
|
margin: const EdgeInsets.symmetric(
|
|
horizontal: 30.0, vertical: 20.0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.white),
|
|
color: const Color(0xffB4D1E5).withOpacity(0.9),
|
|
borderRadius: BorderRadius.circular(26.0),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SizedBox(height: 20),
|
|
_buildProfileItem(
|
|
'Name', user!.myData!.name ?? ''),
|
|
_buildProfileItem(
|
|
'ID', user.myData!.uniqueId ?? ''),
|
|
_buildProfileItem(
|
|
'Email ID', user.myData!.email ?? ''),
|
|
_buildProfileItem('Mobile Number',
|
|
user.myData!.mobileNumber ?? ''),
|
|
_buildProfileItem(
|
|
'Designation', user.myData!.designation ?? '')
|
|
]))
|
|
]));
|
|
}
|
|
})))
|
|
]);
|
|
}
|
|
|
|
Widget _buildProfileItem(String label, String value) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xff004791),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
Text(
|
|
value,
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
const Divider(color: Colors.grey),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|