Skip to content

Commit

Permalink
fix to context.goName
Browse files Browse the repository at this point in the history
  • Loading branch information
jwson-automation committed Jul 25, 2024
1 parent da76e2e commit 1e8838c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lib/router/RouterProvider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ final routerProvider = Provider<GoRouter>((ref) {
)),
GoRoute(
path: '/TopScreen',
name: TopScreen.name,
builder: (context, state) =>
ResponsiveLayoutBuilder(context, const TopScreen()),
),
GoRoute(
path: '/SignUpScreen',
name : SignUpScreen.name,
builder: (context, state) =>
ResponsiveLayoutBuilder(context, const SignUpScreen()),
),
GoRoute(
path: '/SettingsScreen',
name : SettingScreen.name,
builder: (context, state) =>
ResponsiveLayoutBuilder(context, const SettingScreen()),
)
Expand Down
1 change: 1 addition & 0 deletions lib/screens/SettingScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '../providers/NotificationProvider.dart';
import '../providers/ThemeProvider.dart';

class SettingScreen extends ConsumerWidget {
static const String name = 'SettingsScreen';
const SettingScreen({super.key});

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/SplashScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> {
await Future.delayed(const Duration(seconds: 3));
// 초기화 완료 후 메인 화면으로 전환
if (mounted) {
GoRouter.of(context).go(TopScreen.routeName);
GoRouter.of(context).go(TopScreen.name);
}
} catch (e) {
// 초기화 중 발생한 오류 처리
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/TopScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'friendsList/FriendsListScreen.dart';
final selectedIndexProvider = StateProvider<int>((ref) => 0);

class TopScreen extends ConsumerWidget {
static const String routeName = '/TopScreen';
static const String name = '/TopScreen';
const TopScreen({super.key});

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/mypage/LoginScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Widget _buildLogin(BuildContext context, WidgetRef ref) {
child: const Text(AppStrings.loginButtonText),
),
TextButton(
onPressed: () => context.go(SignUpScreen.routeName),
onPressed: () => context.goNamed(SignUpScreen.name),
child: const Text(
AppStrings.signUpButtonText,
style: TextStyle(color: Colors.blue),
Expand Down
3 changes: 1 addition & 2 deletions lib/screens/mypage/SignUpScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ final phoneNumberProvider = StateProvider<String>((ref) => '');
final verificationNumberProvider = StateProvider<String>((ref) => '');

class SignUpScreen extends StatefulWidget {
static const String routeName = '/SignUpScreen';
static const String name = 'SignUpScreen';
const SignUpScreen({super.key});


@override
State<SignUpScreen> createState() => _SignUpScreenState();
}
Expand Down

0 comments on commit 1e8838c

Please sign in to comment.