forked from eatvio/eatvio_app
feat(profile): subscribers and subscriptions
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum SubActionType { SendMessage, Subscribe }
|
||||
|
||||
class SubActionButtonWidget extends StatefulWidget {
|
||||
final SubActionType subActionType;
|
||||
|
||||
const SubActionButtonWidget({
|
||||
super.key,
|
||||
required this.subActionType,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SubActionButtonWidget> createState() => _SubActionButtonWidgetState();
|
||||
}
|
||||
|
||||
class _SubActionButtonWidgetState extends State<SubActionButtonWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.subActionType == SubActionType.Subscribe) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
child: Text(
|
||||
'Подписаться',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Color(0xFFF1F2F6),
|
||||
),
|
||||
child: Text(
|
||||
'Сообщение',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF6D6F71),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
65
lib/features/profile/presentation/widgets/sub_widget.dart
Normal file
65
lib/features/profile/presentation/widgets/sub_widget.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
import 'package:eatvio_app/features/profile/models/sub_model.dart';
|
||||
import 'package:eatvio_app/features/profile/presentation/widgets/sub_action_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SubWidget extends StatefulWidget {
|
||||
final SubModel subModel;
|
||||
|
||||
const SubWidget({
|
||||
super.key,
|
||||
required this.subModel,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SubWidget> createState() => _SubWidgetState();
|
||||
}
|
||||
|
||||
class _SubWidgetState extends State<SubWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Ink(
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundImage: NetworkImage(widget.subModel.profilePhotoUrl),
|
||||
radius: 28,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
widget.subModel.name,
|
||||
style: TextStyle(
|
||||
color: Color(0xFF323F4B),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${DateTime.now().year - widget.subModel.birthdate.year - (DateTime.now().isBefore(DateTime(DateTime.now().year, widget.subModel.birthdate.month, widget.subModel.birthdate.day)) ? 1 : 0)} лет, ${widget.subModel.city}',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF6D6F71),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
SubActionButtonWidget(
|
||||
subActionType: widget.subModel.isSubscribe ? SubActionType.SendMessage : SubActionType.Subscribe,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user