Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
profile_screen.dart
Go to the documentation of this file.
1import 'package:connect/core/localization/app_localizations.dart';
2import 'package:connect/features/account/screens/cubit/document_cubit/document_cubit.dart';
3import 'package:connect/features/account/screens/cubit/profile_cubit/load_profile_cubit_cubit.dart';
4import 'package:connect/features/account/screens/profile_screen/widgets/documents_listview.dart';
5import 'package:flutter/material.dart';
6import 'package:flutter_bloc/flutter_bloc.dart';
7import 'package:flutter_screenutil/flutter_screenutil.dart';
8import 'package:hugeicons/hugeicons.dart';
9
10import '../../../authentication/presentation/logic/authentication_bloc/authentication_bloc.dart';
11import '/core/ui/widgets/custom_card.dart';
12import '/core/ui/widgets/custom_scaffold.dart';
13import '/features/account/screens/profile_screen/widgets/profile_information_form.dart';
14
16 const ProfileScreen({super.key});
17
18 @override
19 State<ProfileScreen> createState() => _ProfileScreenState();
20}
21
22class _ProfileScreenState extends State<ProfileScreen> {
23 @override
24 void initState() {
25 final authenticationState = context.read<AuthenticationBloc>().state;
26 if (authenticationState is AuthenticatedState) {
27 int uid = authenticationState.session.uid!;
28 String partnerId = authenticationState.session.partnerId!;
29 context.read<LoadProfileCubitCubit>().loadProfile(userId: '$uid');
30 context.read<DocumentCubit>().loadDocuments(partnerId: partnerId);
31 super.initState();
32 }
33 }
34
35 @override
36 Widget build(BuildContext context) {
37 return CustomScaffold(
38 title: AppLocalizations.of(context).translate('PROFILE'),
39 isLeadingVisible: false,
40 body: SafeArea(
41 child: ListView(
42 padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 7.sp),
43 children: [
44 const ProfileInformationForm(),
45 SizedBox(height: 10.sp),
46 DocumentsListView(),
47 ],
48 ),
49 ),
50 );
51 }
52
54 required String label,
55 required BuildContext context,
56 Function()? onPressed,
57 }) {
58 return ElevatedButton(
59 onPressed: onPressed,
60 style: ElevatedButton.styleFrom(
62 Theme.of(context).colorScheme.surface.withOpacity(0.11),
63 padding: EdgeInsets.all(5.sp),
64 overlayColor: Theme.of(context).colorScheme.primary.withOpacity(0.11),
65 ),
66 child: Column(
67 crossAxisAlignment: CrossAxisAlignment.center,
68 mainAxisAlignment: MainAxisAlignment.center,
69 children: [
70 Icon(
71 HugeIcons.strokeRoundedFileAttachment,
72 color: Theme.of(context).colorScheme.primary,
73 size: 20.sp,
74 ),
75 SizedBox(height: 5.sp),
76 Text(
77 label,
78 textAlign: TextAlign.center,
79 style: Theme.of(context).textTheme.bodySmall?.copyWith(
80 fontSize: 10.sp,
81 ),
82 )
83 ],
84 ),
85 );
86 }
87}
String translate(String key)
static AppLocalizations of(BuildContext context)
const ProfileScreen({super.key})
override State< ProfileScreen > createState()
final num partnerId
final Widget child
final EdgeInsets padding
override void initState()
final Color backgroundColor
final String label
final Color color
Definition failures.dart:1
override Widget build(BuildContext context)
const ProfileScreen({super.key})
Widget _buildDocumentButton({ required String label, required BuildContext context, Function()? onPressed, })
final int uid
final Function(ProposedTimeEntity pickedTimeRange) onPickTimeRange
final String title