forked from eatvio/eatvio_app
78 lines
2.6 KiB
Dart
78 lines
2.6 KiB
Dart
import 'package:eatvio_app/core/app_config.dart';
|
|
import 'package:eatvio_app/core/locator_service.dart';
|
|
import 'package:eatvio_app/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart';
|
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class BlockedUserWidget extends StatefulWidget {
|
|
final ProfileModel profile;
|
|
const BlockedUserWidget({super.key, required this.profile});
|
|
|
|
@override
|
|
State<BlockedUserWidget> createState() => _BlockedUserWidgetState();
|
|
}
|
|
|
|
class _BlockedUserWidgetState extends State<BlockedUserWidget> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: () => GoRouter.of(context).pushNamed(
|
|
'profileScreen',
|
|
extra: widget.profile.slug,
|
|
),
|
|
child: Ink(
|
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
child: Row(
|
|
children: [
|
|
CircleAvatar(
|
|
foregroundImage: NetworkImage(sl<AppConfig>().baseUrl + widget.profile.profilePhotoUrl),
|
|
backgroundImage: const AssetImage('assets/images/no_avatar.png'),
|
|
radius: 28,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
widget.profile.name,
|
|
style: const TextStyle(
|
|
color: Color(0xFF323F4B),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
height: 1,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const Spacer(),
|
|
InkWell(
|
|
onTap: () {
|
|
context.read<BlockedUsersCubit>().unblockUser(widget.profile.slug);
|
|
},
|
|
borderRadius: BorderRadius.circular(4),
|
|
child: Ink(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFF1F2F6),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: const Text(
|
|
'Убрать',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xFF6D6F71),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|