Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
refactor: routes 상수
Browse files Browse the repository at this point in the history
  • Loading branch information
suu3 committed Jul 3, 2024
1 parent f4f45e6 commit 491b34a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 49 deletions.
Binary file removed assets/google_logo.png
Binary file not shown.
4 changes: 4 additions & 0 deletions lib/constants/routes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Routes {
static const String login = '/login';
static const String home = '/home';
}
7 changes: 4 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_demo/constants/routes.dart';
import 'package:flutter_riverpod_demo/screens/home.dart';
import 'package:flutter_riverpod_demo/screens/login.dart';
import 'package:go_router/go_router.dart';
Expand All @@ -10,14 +11,14 @@ void main() {

GoRouter router() {
return GoRouter(
initialLocation: '/login',
initialLocation: Routes.login,
routes: [
GoRoute(
path: '/login',
path: Routes.login,
builder: (context, state) => const MyLogin(),
),
GoRoute(
path: '/home',
path: Routes.home,
builder: (context, state) => const MyHome(),
),
],
Expand Down
71 changes: 26 additions & 45 deletions lib/screens/login.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_demo/constants/routes.dart';
import 'package:go_router/go_router.dart';

class MyLogin extends StatelessWidget {
Expand All @@ -16,7 +17,7 @@ class MyLogin extends StatelessWidget {
children: [
const SizedBox(height: 120),
const Text(
'Login',
'로그인',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
Expand All @@ -25,64 +26,44 @@ class MyLogin extends StatelessWidget {
const SizedBox(height: 32),
const TextField(
decoration: InputDecoration(
labelText: 'Username',
hintText: 'Enter your Username',
labelText: '이메일',
hintText: '이메일을 입력하세요.',
),
),
const SizedBox(height: 16),
const TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
hintText: 'Enter your Password',
labelText: '비밀번호',
hintText: '비밀번호를 입력하세요.',
),
),
const SizedBox(height: 32),
ElevatedButton(
onPressed: () {
context.go('/home'); // 로그인 성공 시 list 화면으로 이동
},
child: const Text('Login'),
),
const SizedBox(height: 16),
const Row(
Row(
children: [
Expanded(child: Divider(color: Color(0xFF232323))),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Text('or'),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10), // 버튼의 반지름 값 조정
),
padding: const EdgeInsets.all(20)),
onPressed: () {
context.go(Routes.home);
},
child: const Text(
'로그인',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
),
),
Expanded(child: Divider(color: Color(0xFF232323))),
],
),
const SizedBox(height: 16),
ElevatedButton.icon(
onPressed: () {},
icon: Image.asset('assets/google_logo.png', height: 24),
label: const Text('Login with Google'),
),
const SizedBox(height: 16),
// ElevatedButton.icon(
// onPressed: () {},
// icon: const Icon(Icons.apple, color: Color(0xFF232323)),
// label: const Text('Login with Apple'),
// ),
// const Spacer(),
// Center(
// child: RichText(
// text: const TextSpan(
// text: "Don't have an account? ",
// style: TextStyle(color: Color(0xFF232323)),
// children: <TextSpan>[
// TextSpan(
// text: 'Register',
// style: TextStyle(color: Colors.blue),
// ),
// ],
// ),
// ),
// ),
const SizedBox(height: 16),
],
),
),
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ flutter:
uses-material-design: true

assets:
- assets/google_logo.png
- assets/task_image.png
# To add assets to your application, add an assets section, like this:
# assets:
Expand Down

0 comments on commit 491b34a

Please sign in to comment.