Skip to content

Commit ad0fea9

Browse files
committed
fix(notification_indicator): adjust indicator position and remove redundant code
- Update NotificationIndicator to use Positioned.directional for better alignment - Remove redundant Directionality widget in discover_sliver_app_bar.dart and feed_sliver_app_bar.dart - Adjust positioning values for the indicator in notification_indicator.dart
1 parent 5eca8b1 commit ad0fea9

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

lib/discover/widgets/discover_sliver_app_bar.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,13 @@ class DiscoverSliverAppBar extends StatelessWidget
7979
child: BlocSelector<AppBloc, AppState, bool>(
8080
selector: (state) => state.hasUnreadInAppNotifications,
8181
builder: (context, showIndicator) {
82-
return Directionality(
83-
textDirection: Directionality.of(context),
84-
child: NotificationIndicator(
85-
showIndicator: showIndicator,
86-
child: BlocSelector<AppBloc, AppState, User?>(
87-
selector: (state) => state.user,
88-
builder: (context, user) {
89-
return UserAvatar(user: user);
90-
},
91-
),
82+
return NotificationIndicator(
83+
showIndicator: showIndicator,
84+
child: BlocSelector<AppBloc, AppState, User?>(
85+
selector: (state) => state.user,
86+
builder: (context, user) {
87+
return UserAvatar(user: user);
88+
},
9289
),
9390
);
9491
},

lib/headlines-feed/widgets/feed_sliver_app_bar.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ class FeedSliverAppBar extends StatelessWidget implements PreferredSizeWidget {
8585
child: BlocSelector<AppBloc, AppState, bool>(
8686
selector: (state) => state.hasUnreadInAppNotifications,
8787
builder: (context, showIndicator) {
88-
return Directionality(
89-
textDirection: Directionality.of(context),
90-
child: NotificationIndicator(
91-
showIndicator: showIndicator,
92-
child: BlocSelector<AppBloc, AppState, User?>(
93-
selector: (state) => state.user,
94-
builder: (context, user) {
95-
return UserAvatar(user: user);
96-
},
97-
),
88+
return NotificationIndicator(
89+
showIndicator: showIndicator,
90+
child: BlocSelector<AppBloc, AppState, User?>(
91+
selector: (state) => state.user,
92+
builder: (context, user) {
93+
return UserAvatar(user: user);
94+
},
9895
),
9996
);
10097
},

lib/shared/widgets/notification_indicator.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ class NotificationIndicator extends StatelessWidget {
2727
children: [
2828
child,
2929
if (showIndicator)
30-
Positioned(
31-
top: 0,
32-
right: 0,
30+
Positioned.directional(
31+
textDirection: Directionality.of(context),
32+
top: 2,
33+
end: 2,
3334
child: Container(
3435
width: AppSpacing.sm,
3536
height: AppSpacing.sm,

0 commit comments

Comments
 (0)