Skip to content

Commit

Permalink
add trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Aug 31, 2023
1 parent c14d2b2 commit 70529b0
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 71 deletions.
116 changes: 66 additions & 50 deletions lib/view/user_page/user_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,80 +67,96 @@ class UserNotesState extends ConsumerState<UserNotes> {
},
children: const [
Padding(
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("返信つき")),
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("返信つき"),
),
Padding(
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("ファイルつき")),
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("ファイルつき"),
),
Padding(
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("リノートも"))
padding: EdgeInsets.only(left: 5, right: 5),
child: Text("リノートも"),
),
],
),
),
),
IconButton(
onPressed: () async {
final userInfo = ref.read(userInfoProvider(widget.userId));
final firstDate = widget.actualAccount == null
? userInfo?.response?.createdAt
: userInfo?.remoteResponse?.createdAt;
onPressed: () async {
final userInfo = ref.read(userInfoProvider(widget.userId));
final firstDate = widget.actualAccount == null
? userInfo?.response?.createdAt
: userInfo?.remoteResponse?.createdAt;

final result = await showDatePicker(
context: context,
initialDate: untilDate ?? DateTime.now(),
helpText: "この日までを表示",
firstDate: firstDate ?? DateTime.now(),
lastDate: DateTime.now());
if (result != null) {
untilDate = DateTime(result.year, result.month,
result.day, 23, 59, 59, 999);
}
setState(() {});
},
icon: const Icon(Icons.date_range))
final result = await showDatePicker(
context: context,
initialDate: untilDate ?? DateTime.now(),
helpText: "この日までを表示",
firstDate: firstDate ?? DateTime.now(),
lastDate: DateTime.now(),
);
if (result != null) {
untilDate = DateTime(
result.year,
result.month,
result.day,
23,
59,
59,
999,
);
}
setState(() {});
},
icon: const Icon(Icons.date_range),
),
],
),
),
Expanded(
child: PushableListView<Note>(
listKey:
Object.hashAll([isFileOnly, withReply, renote, untilDate]),
initializeFuture: () async {
final notes = await misskey.users.notes(UsersNotesRequest(
listKey: Object.hashAll([isFileOnly, withReply, renote, untilDate]),
initializeFuture: () async {
final notes = await misskey.users.notes(
UsersNotesRequest(
userId: widget.remoteUserId ?? widget.userId,
withFiles: isFileOnly,
includeReplies: withReply,
includeMyRenotes: renote,
untilDate: untilDate?.millisecondsSinceEpoch,
));
if (!mounted) return [];
ref
.read(notesProvider(AccountScope.of(context)))
.registerAll(notes);
return notes.toList();
},
nextFuture: (lastElement, _) async {
final notes = await misskey.users.notes(UsersNotesRequest(
),
);
if (!mounted) return [];
ref
.read(notesProvider(AccountScope.of(context)))
.registerAll(notes);
return notes.toList();
},
nextFuture: (lastElement, _) async {
final notes = await misskey.users.notes(
UsersNotesRequest(
userId: widget.remoteUserId ?? widget.userId,
untilId: lastElement.id,
withFiles: isFileOnly,
includeReplies: withReply,
includeMyRenotes: renote,
untilDate: untilDate?.millisecondsSinceEpoch,
));
if (!mounted) return [];
ref
.read(notesProvider(AccountScope.of(context)))
.registerAll(notes);
return notes.toList();
},
itemBuilder: (context, element) {
return MisskeyNote(
note: element,
loginAs: widget.actualAccount,
);
}),
),
);
if (!mounted) return [];
ref
.read(notesProvider(AccountScope.of(context)))
.registerAll(notes);
return notes.toList();
},
itemBuilder: (context, element) {
return MisskeyNote(
note: element,
loginAs: widget.actualAccount,
);
},
),
),
],
);
Expand Down
49 changes: 28 additions & 21 deletions lib/view/user_page/user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ class UserPageState extends ConsumerState<UserPage> {
bottom: TabBar(
tabs: [
Tab(
text:
"アカウント情報${userInfo?.remoteResponse != null ? "(ローカル)" : ""}"),
text:
"アカウント情報${userInfo?.remoteResponse != null ? "(ローカル)" : ""}",
),
if (isRemoteUser) const Tab(text: "アカウント情報(リモート)"),
Tab(
text:
"ノート${userInfo?.remoteResponse != null ? "(ローカル)" : ""}"),
text:
"ノート${userInfo?.remoteResponse != null ? "(ローカル)" : ""}",
),
if (isRemoteUser) const Tab(text: "ノート(リモート)"),
const Tab(text: "クリップ"),
if (isReactionAvailable) const Tab(text: "リアクション")
if (isReactionAvailable) const Tab(text: "リアクション"),
],
isScrollable: true,
),
Expand Down Expand Up @@ -112,17 +114,19 @@ class UserPageState extends ConsumerState<UserPage> {
),
),
Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: UserClips(
userId: widget.userId,
)),
padding: const EdgeInsets.only(left: 10, right: 10),
child: UserClips(
userId: widget.userId,
),
),
if (isReactionAvailable)
Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: UserReactions(userId: widget.userId)),
padding: const EdgeInsets.only(left: 10, right: 10),
child: UserReactions(userId: widget.userId),
),
],
),
)
),
],
),
),
Expand Down Expand Up @@ -164,18 +168,20 @@ class UserDetailTabState extends ConsumerState<UserDetailTab> {
.read(notesProvider(account))
.registerAll(response?.pinnedNotes ?? []);
ref.read(userInfoProvider(widget.userId).notifier).state = UserInfo(
userId: widget.userId,
response: response,
remoteUserId: null,
remoteResponse: null);
userId: widget.userId,
response: response,
remoteUserId: null,
remoteResponse: null,
);

final remoteHost = response?.host;
if (remoteHost != null) {
final remoteResponse = await ref
.read(misskeyProvider(Account.demoAccount(remoteHost)))
.users
.showByName(
UsersShowByUserNameRequest(userName: response!.username));
UsersShowByUserNameRequest(userName: response!.username),
);

await ref
.read(emojiRepositoryProvider(Account.demoAccount(remoteHost)))
Expand All @@ -185,10 +191,11 @@ class UserDetailTabState extends ConsumerState<UserDetailTab> {
.read(notesProvider(Account.demoAccount(remoteHost)))
.registerAll(remoteResponse.pinnedNotes ?? []);
ref.read(userInfoProvider(widget.userId).notifier).state = UserInfo(
userId: widget.userId,
response: response,
remoteUserId: remoteResponse.id,
remoteResponse: remoteResponse);
userId: widget.userId,
response: response,
remoteUserId: remoteResponse.id,
remoteResponse: remoteResponse,
);
}
} catch (e) {
setState(() {
Expand Down

0 comments on commit 70529b0

Please sign in to comment.