Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 21
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 21
22_23-J 21
Commits
b337d55f
Commit
b337d55f
authored
May 10, 2023
by
Kaushan H.K.R
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added my_post_list screen
parent
ec858fe2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
FrontEnd/lib/screens/my_post_list.dart
FrontEnd/lib/screens/my_post_list.dart
+85
-0
No files found.
FrontEnd/lib/screens/my_post_list.dart
0 → 100644
View file @
b337d55f
import
'package:flutter/material.dart'
;
import
'package:provider/provider.dart'
;
import
'../providers/post_provider.dart'
;
import
'../utils/loading_overlay.dart'
;
import
'../utils/utils.dart'
;
import
'../widgets/drawer_widget.dart'
;
import
'../widgets/utils/common_widget.dart'
;
import
'my_post.dart'
;
class
MyPostList
extends
StatefulWidget
{
const
MyPostList
({
super
.
key
});
@override
State
<
MyPostList
>
createState
()
=>
_MyPostListState
();
}
class
_MyPostListState
extends
State
<
MyPostList
>
{
late
PostProvider
pPost
;
@override
void
initState
()
{
super
.
initState
();
pPost
=
Provider
.
of
<
PostProvider
>(
context
,
listen:
false
);
Future
.
delayed
(
Duration
.
zero
,
()
async
{
await
initialize
();
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
drawer:
const
DrawerWidget
(),
appBar:
AppBar
(
title:
const
Text
(
'My Pest Control Methods'
),
),
body:
SingleChildScrollView
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
20
),
child:
Consumer
<
PostProvider
>(
builder:
(
context
,
post
,
child
)
{
return
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
if
(
post
.
posts
.
isEmpty
)
const
Center
(
child:
Text
(
'No Pest Control Methods found'
),
),
...
List
.
generate
(
post
.
posts
.
length
,
(
index
)
=>
Padding
(
padding:
const
EdgeInsets
.
only
(
bottom:
10
),
child:
ListTile
(
onTap:
()
{
Navigator
.
push
(
context
,
SlidePageRoute
(
page:
MyPost
(
postId:
post
.
posts
[
index
].
id
)));
},
title:
Text
(
'
${post.posts[index].refModel?.name ?? ''}
-
${post.posts[index].title}
'
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),
),
subtitle:
Text
(
Utils
.
getAgoTime
(
post
.
posts
[
index
].
createdAt
!)),
trailing:
const
Icon
(
Icons
.
chevron_right_rounded
,
size:
30
,
)),
),
),
],
);
},
)),
),
);
}
Future
<
void
>
initialize
()
async
{
await
LoadingOverlay
.
of
(
context
).
during
(
pPost
.
getPostsByUid
());
setState
(()
{});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment