142 lines
5.0 KiB
Dart
142 lines
5.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:onufitness/constants/color_constant.dart';
|
|
import 'package:onufitness/constants/text_constant.dart';
|
|
import 'package:onufitness/screens/echoboard/models/get_user_list_for_connection_request_response_model.dart';
|
|
import 'package:onufitness/utils/helper_function.dart';
|
|
import 'package:onufitness/widgets/Buttons/custom_submit_button.dart';
|
|
|
|
class InvitationCard extends StatelessWidget {
|
|
final SocialUserInfo user;
|
|
final Function() onAccept;
|
|
final Function() onReject;
|
|
final RxList<String> loadingIds;
|
|
|
|
const InvitationCard({
|
|
super.key,
|
|
required this.user,
|
|
required this.onAccept,
|
|
required this.onReject,
|
|
required this.loadingIds,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: isTablet ? 50.sp : 40.sp,
|
|
height: isTablet ? 50.sp : 40.sp,
|
|
decoration: BoxDecoration(
|
|
color: lightGreyColor,
|
|
shape: BoxShape.circle,
|
|
),
|
|
child:
|
|
user.userProfileImage != null &&
|
|
user.userProfileImage!.isNotEmpty
|
|
? ClipOval(
|
|
child: Image.network(
|
|
user.userProfileImage!,
|
|
width: isTablet ? 50.sp : 40.sp,
|
|
height: isTablet ? 50.sp : 40.sp,
|
|
fit: BoxFit.cover,
|
|
loadingBuilder: (context, child, loadingProgress) {
|
|
if (loadingProgress == null) return child;
|
|
return Center(
|
|
child: SizedBox(
|
|
width: 20.sp,
|
|
height: 20.sp,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2.0,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
Color(darkGreyColor),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
errorBuilder: (context, error, stackTrace) {
|
|
return Icon(
|
|
Icons.person,
|
|
size: 30,
|
|
color: Color(darkGreyColor),
|
|
);
|
|
},
|
|
),
|
|
)
|
|
: Icon(Icons.person, size: 30, color: Color(darkGreyColor)),
|
|
),
|
|
SizedBox(width: 15.w),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
user.fullName ?? "Unknown",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: mediumSizeText,
|
|
),
|
|
),
|
|
SizedBox(height: 5),
|
|
Text(
|
|
user.userTypeName ?? "",
|
|
style: TextStyle(
|
|
color: greyTextColor1,
|
|
fontSize: smallSizeText,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Obx(() {
|
|
final isLoading = loadingIds.contains(user.userId);
|
|
return Row(
|
|
children: [
|
|
CustomSubmitButton(
|
|
// isLoading: isLoading,
|
|
text: "Accept",
|
|
onPressed: onAccept,
|
|
backgroundColor: Colors.white,
|
|
textColor: Colors.black,
|
|
fontSize: smallSizeText,
|
|
height: 35.h,
|
|
width: isTablet ? 150.w : 100.w,
|
|
borderRadius: 30.r,
|
|
borderSide: BorderSide(color: greyTextColor1),
|
|
),
|
|
SizedBox(width: 10),
|
|
InkWell(
|
|
onTap: isLoading ? null : onReject,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: Colors.pink.withValues(alpha: 0.2),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5),
|
|
child: Icon(
|
|
Icons.close,
|
|
color: Colors.red,
|
|
size: largeSizeText,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|