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,
);

View File

@@ -54,7 +54,7 @@ class _AuthScreenState extends State<AuthScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(s.email),
SizedBox(height: 4),
const SizedBox(height: 4),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
@@ -67,9 +67,9 @@ class _AuthScreenState extends State<AuthScreen> {
);
},
),
SizedBox(height: 16),
const SizedBox(height: 16),
Text(s.password),
SizedBox(height: 4),
const SizedBox(height: 4),
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
selector: (state) => state.passwordController,
builder: (context, passwordController) {
@@ -91,7 +91,7 @@ class _AuthScreenState extends State<AuthScreen> {
);
},
),
SizedBox(height: 16),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -135,7 +135,7 @@ class _AuthScreenState extends State<AuthScreen> {
),
],
),
SizedBox(height: 16),
const SizedBox(height: 16),
BlocBuilder<AuthBloc, AuthState>(
builder: (context, state) {
return Container(

View File

@@ -47,7 +47,7 @@ class DietCreateScreen extends StatelessWidget {
decoration: AppDecoration.fillGray,
child: ListView(
children: [
SizedBox(height: 30),
const SizedBox(height: 30),
Container(
margin: EdgeInsets.only(
left: 16,
@@ -70,17 +70,17 @@ class DietCreateScreen extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 16.0),
const SizedBox(height: 16.0),
TextFormField(
controller: state.name,
decoration: InputDecoration(labelText: 'Заголовок'),
),
SizedBox(height: 16.0),
const SizedBox(height: 16.0),
TextFormField(
controller: state.details,
decoration: InputDecoration(labelText: 'Описание'),
),
SizedBox(height: 16.0),
const SizedBox(height: 16.0),
// Здесь нужно добавить виджет для загрузки картинки
ElevatedButton(
onPressed: () => context.read<DietCreateBloc>().add(CreateDiet()),