-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ice-tychon
committed
Jul 29, 2024
1 parent
029eba1
commit b60dd55
Showing
19 changed files
with
253 additions
and
31 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
lib/app/features/feed/model/post_reply/post_reply_data.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'post_reply_data.freezed.dart'; | ||
|
||
@Freezed(copyWith: true) | ||
class PostReplyData with _$PostReplyData { | ||
const factory PostReplyData({ | ||
required String text, | ||
}) = _PostReplyData; | ||
|
||
factory PostReplyData.empty() => PostReplyData( | ||
text: '', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:ice/app/features/feed/model/post/post_data.dart'; | ||
import 'package:nostr_dart/nostr_dart.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'post_by_id_provider.g.dart'; | ||
|
||
@riverpod | ||
PostData? postById(PostByIdRef ref, { | ||
required String id, | ||
}) { | ||
return PostData.fromEventMessage( | ||
EventMessage.fromJson( | ||
json.decode( | ||
r'["EVENT","5f6556d1-9a5e-4092-a7e3-a202857b445f",{"content":"GM https://image.nostr.build/d84c3d3a7abfa358106cad5a3ec0cc0888733f4cacda2b49cf3d7f9519003698.jpg","created_at":1720428050,"id":"0454657a5edeedf3db10b37dd5a3ca387f5714a2675f7e51539475e8fcb331de","kind":1,"pubkey":"d0c01dd5931409d2bc7e58ee4908e6366ff0fd722d20e9c709fde6846f3ceabb","sig":"263b97d9157f602b944859ebd3fe56851a5a786379bf38f7e81f6a58ec7acc5bca412f1e3a488ada033e240977bbc134f2f5047e4a9df32dcd19d96126c8a9ed","tags":[["e","6f2f2e100c8075d5ebae5866544ae243aad9e56916c3cb33e7a69c69004858e6","","root"],["p","6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93"],["r","https://image.nostr.build/d84c3d3a7abfa358106cad5a3ec0cc0888733f4cacda2b49cf3d7f9519003698.jpg"],["imeta","url https://image.nostr.build/d84c3d3a7abfa358106cad5a3ec0cc0888733f4cacda2b49cf3d7f9519003698.jpg","m image/jpeg","alt Verifiable file url","x 1dc63792be80c939b207f089f69221df8755c0f6e38503f666e4619f1ccf9a12","size 340088","dim 864x1920","blurhash [[email protected];W?nzbdEFo$WBj]NPahjqj]o}bIofWUt7oHWEj=IVocjYa}Mwn$WYfRsiW=a#oI","ox d84c3d3a7abfa358106cad5a3ec0cc0888733f4cacda2b49cf3d7f9519003698"]]}]', | ||
) as List<dynamic>, | ||
), | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
lib/app/features/feed/providers/post_reply/reply_data_notifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:ice/app/features/feed/model/post_reply/post_reply_data.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'reply_data_notifier.g.dart'; | ||
|
||
@riverpod | ||
class ReplyDataNotifier extends _$ReplyDataNotifier { | ||
@override | ||
PostReplyData build() { | ||
return PostReplyData.empty(); | ||
} | ||
|
||
void onTextChanged(String newValue) { | ||
state = state.copyWith(text: newValue); | ||
} | ||
|
||
void clear() { | ||
state = PostReplyData.empty(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/app/features/feed/providers/post_reply/send_reply_request_notifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:ice/app/features/feed/providers/post_reply/reply_data_notifier.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'send_reply_request_notifier.g.dart'; | ||
|
||
@riverpod | ||
class SendReplyRequestNotifier extends _$SendReplyRequestNotifier { | ||
@override | ||
Future<bool?> build() async { | ||
return null; | ||
} | ||
|
||
Future<void> sendReply() async { | ||
state = AsyncValue.loading(); | ||
|
||
// send reply | ||
await Future<void>.delayed(Duration(seconds: 1)); | ||
ref.read(replyDataNotifierProvider.notifier).clear(); | ||
|
||
state = AsyncValue.data(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...features/feed/views/pages/post_details_page/components/post_not_found/post_not_found.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/extensions/extensions.dart'; | ||
import 'package:ice/app/router/components/navigation_app_bar/navigation_app_bar.dart'; | ||
|
||
class PostNotFound extends StatelessWidget { | ||
const PostNotFound({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: NavigationAppBar.screen( | ||
title: Text(context.i18n.post_page_title), | ||
), | ||
body: Center( | ||
child: Text('Post not found'), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...s/pages/post_details_page/components/reply_sent_notification/reply_sent_notification.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/extensions/extensions.dart'; | ||
import 'package:ice/generated/assets.gen.dart'; | ||
|
||
class ReplySentNotification extends StatelessWidget { | ||
const ReplySentNotification({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final colors = context.theme.appColors; | ||
final textStyles = context.theme.appTextThemes; | ||
|
||
return SizedBox( | ||
height: 54.0.s, | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(16.0.s), | ||
color: colors.primaryAccent, | ||
), | ||
child: Padding( | ||
padding: EdgeInsets.symmetric(horizontal: 15.0.s), | ||
child: Row( | ||
children: [ | ||
Assets.images.icons.iconBlockCheckboxOnWhite.icon(), | ||
SizedBox(width: 8.0.s), | ||
Text( | ||
context.i18n.post_reply_sent, | ||
style: textStyles.subtitle2.copyWith(color: colors.onPrimaryAccent), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.