feat(profile): create blog post button

This commit is contained in:
mso7nueh
2024-10-18 15:52:21 +03:00
parent 8c1784bea4
commit 8b955bf2bf
5 changed files with 66 additions and 18 deletions

View File

@@ -70,9 +70,9 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
body: SafeArea(
child: Column(
children: [
SizedBox(height: 32),
const SizedBox(height: 32),
Text('Файл'),
SizedBox(height: 8),
const SizedBox(height: 8),
ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusStyle.circleBorder17,

View File

@@ -55,7 +55,7 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
),
backgroundColor: Colors.white,
),
SizedBox(width: 12),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -106,20 +106,22 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
if (widget.author != null) const SizedBox(height: 8),
if (widget.author != null) _messageAndSubscribe(),
if (widget.author != null) SizedBox(height: 16),
if (widget.author != null) const SizedBox(height: 16),
],
),
),
_subscriptionsAndSubscribers(state),
_badges(state),
if (widget.author == null) SizedBox(height: 16),
if (widget.author == null) const SizedBox(height: 16),
_socialLinks(state),
if (widget.author == null) SizedBox(height: 16),
if (widget.author == null) const SizedBox(height: 16),
_education(state),
if (widget.author == null) SizedBox(height: 16),
if (widget.author == null) const SizedBox(height: 16),
_diplomasAndCertificates(state),
if (widget.author == null) SizedBox(height: 16),
if (widget.author == null) const SizedBox(height: 16),
if (widget.author == null) _charts(),
if (widget.author == null) const SizedBox(height: 16),
_newBlogPostButton(),
_blogPosts(state),
],
),
@@ -127,6 +129,50 @@ class _ProfileScreenState extends State<ProfileScreen> {
);
}
_newBlogPostButton() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Material(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: InkWell(
onTap: () {
GoRouter.of(context).pushNamed('blogPostCreateScreen');
},
borderRadius: BorderRadius.circular(8),
child: Ink(
padding: EdgeInsets.all(12),
decoration: BoxDecoration(
color: Color(0xFFF6FAFF),
borderRadius: BorderRadius.circular(8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.add_circle_outline_rounded,
color: Color(0xFF2F80ED),
),
const SizedBox(width: 12),
Text(
'Новая запись',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Color(0xFF2F80ED),
),
),
],
),
),
),
),
),
);
}
_diplomasAndCertificates(ProfileStateLoaded state) {
if (state.profile.role != 'consultant') {
return const SizedBox.shrink();
@@ -513,7 +559,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: EdgeInsets.symmetric(vertical: 16),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => BlogPostWidget(feedBlogPostModel: state.blogPosts[index]),
itemBuilder: (context, index) => BlogPostWidget(
feedBlogPostModel: state.blogPosts[index],
),
separatorBuilder: (context, index) => SizedBox(height: 8),
itemCount: state.blogPosts.length,
);