Skip to content

Commit 22eb64f

Browse files
committed
chore: 라우팅 설정 (GoRouter)
#4
1 parent 133c116 commit 22eb64f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

lectureq_app/lib/main.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_riverpod/flutter_riverpod.dart';
33
import 'app_theme.dart';
4+
import 'router.dart';
45

56
void main() {
67
runApp(const ProviderScope(child: MyApp()));
@@ -11,14 +12,10 @@ class MyApp extends StatelessWidget {
1112

1213
@override
1314
Widget build(BuildContext context) {
14-
return MaterialApp(
15+
return MaterialApp.router(
1516
title: 'LectureQ',
1617
theme: AppTheme.lightTheme,
17-
home: const Scaffold(
18-
body: Center(
19-
child: Text('LectureQ'),
20-
),
21-
),
18+
routerConfig: router,
2219
);
2320
}
2421
}

lectureq_app/lib/router.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'package:go_router/go_router.dart';
2+
import 'package:flutter/material.dart';
3+
4+
final GoRouter router = GoRouter(
5+
initialLocation: '/',
6+
routes: [
7+
GoRoute(
8+
path: '/',
9+
builder: (context, state) => const Scaffold(
10+
body: Center(
11+
child: Text('LectureQ'),
12+
),
13+
),
14+
),
15+
],
16+
);

0 commit comments

Comments
 (0)