Skip to content

Commit 42f2d8d

Browse files
committed
fix(mobile): simplify profile identity display
Signed-off-by: kenny lopez <[email protected]>
1 parent 9c8bc7c commit 42f2d8d

3 files changed

Lines changed: 22 additions & 49 deletions

File tree

‎mobile/lib/features/profile/user_profile_sheet.dart‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -172,30 +172,6 @@ class UserProfileSheet extends HookConsumerWidget {
172172
),
173173
),
174174
),
175-
if (displayName != null && displayName.isNotEmpty)
176-
Padding(
177-
padding: const EdgeInsets.only(top: Grid.xxs),
178-
child: Center(
179-
child: Row(
180-
mainAxisSize: MainAxisSize.min,
181-
children: [
182-
Icon(
183-
LucideIcons.key,
184-
size: 14,
185-
color: context.colors.onSurfaceVariant,
186-
),
187-
const SizedBox(width: Grid.xxs),
188-
Text(
189-
shortPubkey(pubkey),
190-
style: context.textTheme.bodySmall?.copyWith(
191-
color: context.colors.onSurfaceVariant,
192-
fontFamily: 'monospace',
193-
),
194-
),
195-
],
196-
),
197-
),
198-
),
199175
// Match Settings: status is quiet, centered copy directly
200176
// below the profile name rather than a separate information row.
201177
if (userStatus != null && !userStatus.isEmpty)

‎mobile/lib/shared/widgets/concentric_sheet_surface.dart‎

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import 'package:flutter/foundation.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter/rendering.dart';
44
import 'package:flutter/services.dart';
5+
import 'package:flutter_hooks/flutter_hooks.dart';
56

67
import '../theme/theme.dart';
78

89
/// An iOS-native sheet surface that adopts the system's concentric corners on
910
/// iOS 26 and newer. Other platforms keep the normal Flutter shape.
10-
class ConcentricSheetSurface extends StatefulWidget {
11+
class ConcentricSheetSurface extends HookWidget {
1112
const ConcentricSheetSurface({
1213
required this.child,
1314
required this.enabled,
@@ -19,43 +20,38 @@ class ConcentricSheetSurface extends StatefulWidget {
1920
final bool enabled;
2021
final Color? color;
2122

22-
@override
23-
State<ConcentricSheetSurface> createState() => _ConcentricSheetSurfaceState();
24-
}
25-
26-
class _ConcentricSheetSurfaceState extends State<ConcentricSheetSurface> {
2723
static const _surfaceChannel = MethodChannel('buzz/concentric_sheet_surface');
2824

29-
bool _nativeSurfaceSupported = false;
30-
31-
@override
32-
void initState() {
33-
super.initState();
34-
_checkNativeSurfaceSupport();
35-
}
36-
37-
Future<void> _checkNativeSurfaceSupport() async {
38-
if (!widget.enabled || defaultTargetPlatform != TargetPlatform.iOS) return;
39-
25+
Future<bool> _checkNativeSurfaceSupport() async {
4026
try {
4127
final supported = await _surfaceChannel.invokeMethod<bool>('isSupported');
42-
if (mounted && supported == true) {
43-
setState(() => _nativeSurfaceSupported = true);
44-
}
28+
return supported == true;
4529
} on MissingPluginException {
4630
// The registrar is unavailable, so retain the Flutter surface.
31+
return false;
4732
} on PlatformException {
4833
// The native surface is optional; retain the Flutter surface on failure.
34+
return false;
4935
}
5036
}
5137

5238
@override
5339
Widget build(BuildContext context) {
54-
if (!widget.enabled || defaultTargetPlatform != TargetPlatform.iOS) {
55-
return widget.child;
40+
final shouldCheckNativeSurface =
41+
enabled && defaultTargetPlatform == TargetPlatform.iOS;
42+
final supportFuture = useMemoized(
43+
() => shouldCheckNativeSurface
44+
? _checkNativeSurfaceSupport()
45+
: Future<bool>.value(false),
46+
[shouldCheckNativeSurface],
47+
);
48+
final nativeSurfaceSupported = useFuture(supportFuture).data ?? false;
49+
50+
if (!shouldCheckNativeSurface) {
51+
return child;
5652
}
5753

58-
final surfaceColor = widget.color ?? context.colors.surface;
54+
final surfaceColor = color ?? context.colors.surface;
5955

6056
return Padding(
6157
padding: const EdgeInsets.only(
@@ -65,7 +61,7 @@ class _ConcentricSheetSurfaceState extends State<ConcentricSheetSurface> {
6561
),
6662
child: Stack(
6763
children: [
68-
if (_nativeSurfaceSupported)
64+
if (nativeSurfaceSupported)
6965
Positioned.fill(
7066
child: ExcludeSemantics(
7167
child: UiKitView(
@@ -87,7 +83,7 @@ class _ConcentricSheetSurfaceState extends State<ConcentricSheetSurface> {
8783
clipBehavior: Clip.antiAlias,
8884
),
8985
),
90-
widget.child,
86+
child,
9187
],
9288
),
9389
);

‎mobile/test/features/channels/channel_detail_page_test.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,7 @@ void main() {
23842384
await tester.pumpAndSettle();
23852385

23862386
expect(find.text('Copy public key'), findsOneWidget);
2387+
expect(find.text('alice'), findsNothing);
23872388
expect(find.byType(UserProfileSheet), findsOneWidget);
23882389
});
23892390

0 commit comments

Comments
 (0)