File tree Expand file tree Collapse file tree
lib/features/threads/presentation/thread_feed Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ class _ThreadFeedViewState extends State<ThreadFeedView>
6464 centerTitle: true ,
6565 leading: Builder (
6666 builder: (context) {
67- if (isLoggedIn) {
68- final userName = context.read <UserController >().userData? .accountName;
67+ final userName = context.select <UserController , String ?>(
68+ (controller) => controller.userData? .accountName);
69+ if (isLoggedIn && userName != null ) {
6970 return Padding (
7071 padding: const EdgeInsets .only (left: 8 ),
7172 child: UserProfileImage (
Original file line number Diff line number Diff line change @@ -174,10 +174,7 @@ class _UpvoteDialogState extends State<UpvoteDialog> {
174174 return ;
175175 }
176176 if (_tipFeedbackMessage != null ) {
177- setState (() {
178- _tipFeedbackMessage = null ;
179- _tipFeedbackSuccess = false ;
180- });
177+ _clearTipFeedback ();
181178 }
182179 final initialTipToken =
183180 _readStoredTipToken (userData.accountName);
@@ -496,16 +493,28 @@ class _UpvoteDialogState extends State<UpvoteDialog> {
496493
497494 void _showTipFeedback (String message, {required bool success}) {
498495 if (! mounted) return ;
499- setState (() {
500- _tipFeedbackMessage = message;
501- _tipFeedbackSuccess = success;
502- });
496+ if (success) {
497+ if (_tipFeedbackMessage != null ) {
498+ _clearTipFeedback ();
499+ }
500+ } else {
501+ setState (() {
502+ _tipFeedbackMessage = message;
503+ _tipFeedbackSuccess = success;
504+ });
505+ }
503506 widget.rootContext.showSnackBar (message);
504507 }
505508
506509 void _clearTipFeedback () {
507- _tipFeedbackMessage = null ;
508- _tipFeedbackSuccess = false ;
510+ if (! mounted) return ;
511+ if (_tipFeedbackMessage == null && ! _tipFeedbackSuccess) {
512+ return ;
513+ }
514+ setState (() {
515+ _tipFeedbackMessage = null ;
516+ _tipFeedbackSuccess = false ;
517+ });
509518 }
510519
511520 Future <void > _initTransferCallbacks () async {
You can’t perform that action at this time.
0 commit comments