@@ -10,20 +10,16 @@ import 'package:pref/pref.dart';
10
10
import 'package:provider/provider.dart' ;
11
11
import '../constants.dart' ;
12
12
13
+ final UserWithExtra user = UserWithExtra ();
14
+
13
15
class ForYouTweets extends StatefulWidget {
14
- final UserWithExtra user;
15
16
final String type;
16
17
final bool includeReplies;
17
18
final List <String > pinnedTweets;
18
19
final BasePrefService pref;
19
20
20
21
const ForYouTweets (
21
- {Key ? key,
22
- required this .user,
23
- required this .type,
24
- required this .includeReplies,
25
- required this .pinnedTweets,
26
- required this .pref})
22
+ {Key ? key, required this .type, required this .includeReplies, required this .pinnedTweets, required this .pref})
27
23
: super (key: key);
28
24
29
25
@override
@@ -40,6 +36,9 @@ class _ForYouTweetsState extends State<ForYouTweets> with AutomaticKeepAliveClie
40
36
@override
41
37
void initState () {
42
38
super .initState ();
39
+ user.idStr = "1" ;
40
+ user.possiblySensitive = false ;
41
+ user.screenName = "ForYou" ;
43
42
_pagingController = PagingController (firstPageKey: null );
44
43
_pagingController.addPageRequestListener ((cursor) {
45
44
_loadTweets (cursor);
@@ -63,7 +62,7 @@ class _ForYouTweetsState extends State<ForYouTweets> with AutomaticKeepAliveClie
63
62
Future _loadTweets (String ? cursor) async {
64
63
try {
65
64
var result = await Twitter .getTimelineTweets (
66
- widget. user.idStr! ,
65
+ user.idStr! ,
67
66
widget.type,
68
67
widget.pinnedTweets,
69
68
cursor: cursor,
@@ -99,7 +98,7 @@ class _ForYouTweetsState extends State<ForYouTweets> with AutomaticKeepAliveClie
99
98
],
100
99
builder: (context, child) {
101
100
return Consumer <TweetContextState >(builder: (context, model, child) {
102
- if (model.hideSensitive && (widget. user.possiblySensitive ?? false )) {
101
+ if (model.hideSensitive && (user.possiblySensitive ?? false )) {
103
102
return EmojiErrorWidget (
104
103
emoji: '🍆🙈🍆' ,
105
104
message: L10n .current.possibly_sensitive,
@@ -118,10 +117,7 @@ class _ForYouTweetsState extends State<ForYouTweets> with AutomaticKeepAliveClie
118
117
builderDelegate: PagedChildBuilderDelegate (
119
118
itemBuilder: (context, chain, index) {
120
119
return TweetConversation (
121
- id: chain.id,
122
- tweets: chain.tweets,
123
- username: widget.user.screenName! ,
124
- isPinned: chain.isPinned);
120
+ id: chain.id, tweets: chain.tweets, username: user.screenName! , isPinned: chain.isPinned);
125
121
},
126
122
firstPageErrorIndicatorBuilder: (context) => FullPageErrorWidget (
127
123
error: _pagingController.error[0 ],
0 commit comments