import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; import 'logic.dart'; class ProfilePage extends GetView { const ProfilePage({super.key}); @override Widget build(BuildContext context) { return Column( spacing: 30, children: [ SizedBox( height: Get.height * 0.3, child: Stack( fit: StackFit.expand, alignment: Alignment.center, clipBehavior: Clip.none, children: [ vecWidget(Assets.vecBgHeaderUserProfileSvg, fit: BoxFit.cover), Positioned( bottom: -20, left: 0, right: 0, child: SizedBox( width: 110, height: 110, child: CircleAvatar( backgroundColor: AppColor.blueLightHover, child: FaIcon( FontAwesomeIcons.user, size: 45, color: Colors.white, ), ), ), ), ], ), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, spacing: 16, children: [ SizedBox( height: 75, child: ListView.separated( shrinkWrap: true, padding: EdgeInsets.all(16), scrollDirection: Axis.horizontal, itemBuilder: (context, index) => ObxValue((data) { return ChoiceChip( onSelected: (value) { data.value = index; }, selectedColor: AppColor.blueNormal, labelStyle: data.value == index ? AppFonts.yekan13.copyWith( color: AppColor.whiteLight, ) : AppFonts.yekan12.copyWith( color: AppColor.darkGreyNormalActive, ), checkmarkColor: Colors.white, label: Text(controller.roles[index]), selected: index == data.value, ); }, controller.selectedRole), separatorBuilder: (context, index) => SizedBox(width: 8), itemCount: controller.roles.length, ), ), Padding( padding: const EdgeInsets.symmetric( horizontal: 30, vertical: 10, ), child: Expanded( child: ObxValue((data) { return switch (data.value) { 0 => userProfileInformation(), 1 => bankInformationWidget(), 2 => invoiceIssuanceInformation(), int() => Placeholder(), }; }, controller.selectedInformationType), ), ), ObxValue((data) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Wrap( spacing: 20, runSpacing: 10, children: [ cardActionWidget( title: 'اطلاعات کاربری', onPressed: () { data.value = 0; }, icon: Assets.vecProfileUserSvg, selected: data.value == 0, ), cardActionWidget( title: 'اطلاعات بانکی', onPressed: () { data.value = 1; }, icon: Assets.vecInformationSvg, selected: data.value == 1, ), cardActionWidget( title: 'اطلاعات \nصدور فاکتور', onPressed: () { data.value = 2; }, icon: Assets.vecReceiptDiscountSvg, selected: data.value == 2, ), ], ), ); }, controller.selectedInformationType), ], ), ), ], ); } Container invoiceIssuanceInformation() => Container(); Widget bankInformationWidget() => Column( spacing: 16, children: [ itemList(title: 'نام بانک', content: 'سامان'), itemList(title: 'نام صاحب حساب', content: 'رضا رضایی'), itemList(title: 'شماره کارت ', content: '54154545415'), itemList(title: 'شماره حساب', content: '62565263263652'), itemList(title: 'شماره شبا', content: '62565263263652'), ], ); Column userProfileInformation() { return Column( spacing: 10, children: [ itemList( title: 'نام و نام خانوادگی', content: 'آیدا گل محمدی', icon: Assets.vecUserSvg, ), itemList( title: 'موبایل', content: '09302654896', icon: Assets.vecCallSvg, ), itemList( title: 'کدملی', content: 'نا مشخص', icon: Assets.vecTagUserSvg, ), itemList( title: 'شماره شناسنامه', content: 'نا مشخص', icon: Assets.vecUserSquareSvg, ), itemList( title: 'تاریخ تولد', content: '1404/10/12', icon: Assets.vecCalendarSvg, ), itemList( title: 'استان', content: 'لرستان', icon: Assets.vecPictureFrameSvg, ), itemList(title: 'شهر', content: 'خرم آباد', icon: Assets.vecMapSvg), ], ); } Widget itemList({ required String title, required String content, String? icon, }) => Row( spacing: 4, children: [ if (icon != null) Padding( padding: const EdgeInsets.only(left: 8.0), child: vecWidget( icon, width: 20, height: 20, color: AppColor.blueNormal, ), ), Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.blueNormal)), Spacer(), Text( content, style: AppFonts.yekan13.copyWith(color: AppColor.darkGreyNormalHover), ), ], ); Widget cardActionWidget({ required String title, required VoidCallback onPressed, required String icon, bool selected = false, }) { return GestureDetector( onTap: onPressed, child: Column( spacing: 4, children: [ Container( width: 52, height: 52, padding: EdgeInsets.all(8), decoration: ShapeDecoration( color: selected ? AppColor.blueLightActive : AppColor.blueLight, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), ), child: vecWidget( icon, width: 40, height: 40, color: selected ? AppColor.blueNormalActive : AppColor.blueNormal, ), ), SizedBox(height: 2), Text( title, style: AppFonts.yekan10.copyWith( color: selected ? AppColor.blueNormal : AppColor.blueLightActive, ), textAlign: TextAlign.center, ), ], ), ); } }