Skip to content

Commit 78bca77

Browse files
committed
Moved /profile to /users to fix weird urls
1 parent 562e4ef commit 78bca77

File tree

8 files changed

+242
-335
lines changed

8 files changed

+242
-335
lines changed

untitled_app/lib/custom_widgets/profile_page_header.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class ProfileHeader extends StatelessWidget {
4848
label: AppLocalizations.of(context)!.followers,
4949
onPressed: () {
5050
if (loggedIn) {
51-
context.push('/profile/followers', extra: user);
51+
context.push('/users/${user.username}/followers',
52+
extra: user);
5253
}
5354
},
5455
),
@@ -57,7 +58,8 @@ class ProfileHeader extends StatelessWidget {
5758
label: AppLocalizations.of(context)!.following,
5859
onPressed: () {
5960
if (loggedIn) {
60-
context.push('/profile/following', extra: user);
61+
context.push('/users/${user.username}/following',
62+
extra: user);
6163
}
6264
},
6365
),

untitled_app/lib/utilities/router.dart

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import 'package:untitled_app/views/user_settings.dart';
2020
import 'package:untitled_app/views/compose_page.dart';
2121
import 'package:untitled_app/views/feed_page.dart';
2222
import 'package:untitled_app/views/search_page.dart';
23-
import 'package:untitled_app/views/profile_page.dart';
2423
import 'package:untitled_app/views/edit_profile.dart';
2524
import 'package:untitled_app/views/navigation_bar.dart';
2625
import 'package:untitled_app/views/other_profile.dart';
@@ -40,6 +39,7 @@ import 'package:untitled_app/views/view_likes_page.dart';
4039
import 'package:untitled_app/widgets/gifs.dart';
4140
import 'package:untitled_app/widgets/require_auth.dart';
4241
import 'package:untitled_app/widgets/require_no_auth.dart';
42+
import 'package:untitled_app/views/profile_redirect_page.dart';
4343

4444
final _rootNavigatorKey = GlobalKey<NavigatorState>();
4545
final _shellNavigatorFeedKey = GlobalKey<NavigatorState>(debugLabel: 'Feed');
@@ -111,29 +111,6 @@ final goRouter = GoRouter(
111111
},
112112
),
113113
]),
114-
GoRoute(
115-
path: '/users',
116-
redirect: (context, state) {
117-
if (state.pathParameters['username'] == null) {
118-
return '/feed';
119-
}
120-
return null;
121-
},
122-
routes: [
123-
GoRoute(
124-
path: ':username',
125-
name: 'user_profile',
126-
builder: (context, state) {
127-
final username = state.pathParameters['username']!;
128-
final uid = state.uri.queryParameters['uid'];
129-
return OtherProfile(
130-
username: username,
131-
uid: uid,
132-
);
133-
},
134-
),
135-
],
136-
),
137114
StatefulShellRoute.indexedStack(
138115
builder: (context, state, navigationShell) {
139116
return PopScope(
@@ -350,8 +327,20 @@ final goRouter = GoRouter(
350327
path: '/profile',
351328
name: 'profile',
352329
pageBuilder: (context, state) => const NoTransitionPage(
353-
child: ProfilePage(),
330+
child: ProfileRedirect(),
354331
),
332+
),
333+
GoRoute(
334+
path: '/users/:username',
335+
name: 'user_profile',
336+
builder: (context, state) {
337+
final username = state.pathParameters['username']!;
338+
final uid = state.uri.queryParameters['uid'];
339+
return OtherProfile(
340+
username: username,
341+
uid: uid,
342+
);
343+
},
355344
routes: [
356345
GoRoute(
357346
path: 'share_profile',

untitled_app/lib/views/edit_profile.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,6 @@ class _EditProfileState extends ConsumerState<EditProfile> {
310310
inputType: TextInputType.text,
311311
),
312312
SizedBox(height: height * 0.03),
313-
Text(
314-
AppLocalizations.of(context)!.verification,
315-
style: TextStyle(
316-
fontSize: 20,
317-
fontWeight: FontWeight.bold,
318-
color: Theme.of(context).colorScheme.onSurface,
319-
),
320-
),
321-
SizedBox(height: height * 0.01),
322313
ProfileInputField(
323314
label: AppLocalizations.of(context)!.verificationUrl,
324315
controller: verificationUrlController,
@@ -328,12 +319,8 @@ class _EditProfileState extends ConsumerState<EditProfile> {
328319
Text(
329320
AppLocalizations.of(context)!.verificationExp,
330321
style: TextStyle(
331-
fontSize: 16,
332-
color: Theme.of(context)
333-
.colorScheme
334-
.onSurface
335-
.withOpacity(0.7),
336-
),
322+
fontSize: 16,
323+
color: Theme.of(context).colorScheme.onSurface),
337324
),
338325
SizedBox(height: height * 0.01),
339326
ElevatedButton(

0 commit comments

Comments
 (0)