forked from eatvio/eatvio_app
feat(profile): create blog post button
This commit is contained in:
@@ -70,9 +70,9 @@ class _PhotoViewScreenState extends State<PhotoViewScreen> {
|
|||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
Text('Файл'),
|
Text('Файл'),
|
||||||
SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
ListTile(
|
ListTile(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadiusStyle.circleBorder17,
|
borderRadius: BorderRadiusStyle.circleBorder17,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
|
|||||||
),
|
),
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -106,20 +106,22 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
|
if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state),
|
||||||
if (widget.author != null) const SizedBox(height: 8),
|
if (widget.author != null) const SizedBox(height: 8),
|
||||||
if (widget.author != null) _messageAndSubscribe(),
|
if (widget.author != null) _messageAndSubscribe(),
|
||||||
if (widget.author != null) SizedBox(height: 16),
|
if (widget.author != null) const SizedBox(height: 16),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_subscriptionsAndSubscribers(state),
|
_subscriptionsAndSubscribers(state),
|
||||||
_badges(state),
|
_badges(state),
|
||||||
if (widget.author == null) SizedBox(height: 16),
|
if (widget.author == null) const SizedBox(height: 16),
|
||||||
_socialLinks(state),
|
_socialLinks(state),
|
||||||
if (widget.author == null) SizedBox(height: 16),
|
if (widget.author == null) const SizedBox(height: 16),
|
||||||
_education(state),
|
_education(state),
|
||||||
if (widget.author == null) SizedBox(height: 16),
|
if (widget.author == null) const SizedBox(height: 16),
|
||||||
_diplomasAndCertificates(state),
|
_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) _charts(),
|
||||||
|
if (widget.author == null) const SizedBox(height: 16),
|
||||||
|
_newBlogPostButton(),
|
||||||
_blogPosts(state),
|
_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) {
|
_diplomasAndCertificates(ProfileStateLoaded state) {
|
||||||
if (state.profile.role != 'consultant') {
|
if (state.profile.role != 'consultant') {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
@@ -513,7 +559,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
padding: EdgeInsets.symmetric(vertical: 16),
|
padding: EdgeInsets.symmetric(vertical: 16),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
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),
|
separatorBuilder: (context, index) => SizedBox(height: 8),
|
||||||
itemCount: state.blogPosts.length,
|
itemCount: state.blogPosts.length,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(s.email),
|
Text(s.email),
|
||||||
SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
|
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
|
||||||
selector: (state) => state.emailController,
|
selector: (state) => state.emailController,
|
||||||
builder: (context, emailController) {
|
builder: (context, emailController) {
|
||||||
@@ -67,9 +67,9 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(s.password),
|
Text(s.password),
|
||||||
SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
|
BlocSelector<AuthBloc, AuthState, TextEditingController?>(
|
||||||
selector: (state) => state.passwordController,
|
selector: (state) => state.passwordController,
|
||||||
builder: (context, passwordController) {
|
builder: (context, passwordController) {
|
||||||
@@ -91,7 +91,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -135,7 +135,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BlocBuilder<AuthBloc, AuthState>(
|
BlocBuilder<AuthBloc, AuthState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class DietCreateScreen extends StatelessWidget {
|
|||||||
decoration: AppDecoration.fillGray,
|
decoration: AppDecoration.fillGray,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
left: 16,
|
left: 16,
|
||||||
@@ -70,17 +70,17 @@ class DietCreateScreen extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 16.0),
|
const SizedBox(height: 16.0),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: state.name,
|
controller: state.name,
|
||||||
decoration: InputDecoration(labelText: 'Заголовок'),
|
decoration: InputDecoration(labelText: 'Заголовок'),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
const SizedBox(height: 16.0),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: state.details,
|
controller: state.details,
|
||||||
decoration: InputDecoration(labelText: 'Описание'),
|
decoration: InputDecoration(labelText: 'Описание'),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
const SizedBox(height: 16.0),
|
||||||
// Здесь нужно добавить виджет для загрузки картинки
|
// Здесь нужно добавить виджет для загрузки картинки
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => context.read<DietCreateBloc>().add(CreateDiet()),
|
onPressed: () => context.read<DietCreateBloc>().add(CreateDiet()),
|
||||||
|
|||||||
Reference in New Issue
Block a user