Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Design] Color,Font,Navbar세팅 #2

Merged
merged 9 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: getx설치,junior navbar 개발
  • Loading branch information
JjungminLee committed Feb 20, 2025
commit d4eb41cdbd4c45372da1235609dbeb0d2867c054
58 changes: 58 additions & 0 deletions lib/commons/presentation/main_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:weve_client/core/constants/colors.dart';
import 'package:weve_client/core/controllers/navigation_controller.dart';
import 'package:weve_client/core/navigator/junior_navigation_bar.dart';
import 'package:weve_client/features/junior/presentation/views/junior_home_screen.dart';
import 'package:weve_client/features/junior/presentation/views/junior_my_screen.dart';
import 'package:weve_client/features/junior/presentation/views/junior_write_screen.dart';

class MainScreen extends StatelessWidget {
final NavigationController navigationController = Get.find();

final List<Widget> _pages = [
JuniorHomeScreen(),
JuniorWriteScreen(),
JuniorMyScreen()
];

MainScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: WeveColor.bg.bg1 ?? Colors.white,
appBar: AppBar(
title: Text('메인 화면',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
centerTitle: true,
),
body: Obx(() {
int index = navigationController.selectedIndex.value;
if (index < 0 || index >= _pages.length) {
// 범위 검사 추가
return Center(
child: Text(
'잘못된 페이지 요청입니다.',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
);
}
return _pages[index];
}),
// MainScreen (bottomNavigationBar 쪽)
bottomNavigationBar: Obx(() {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"현재 선택된 페이지: ${navigationController.selectedIndex.value}",
style: TextStyle(fontSize: 14, color: Colors.grey),
),
JuniorNavigationBar(),
],
);
}),
);
}
}
15 changes: 15 additions & 0 deletions lib/commons/splash/presentation/views/splash.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class Splash extends StatefulWidget {
const Splash({super.key});

@override
State<Splash> createState() => _SplashState();
}

class _SplashState extends State<Splash> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
9 changes: 9 additions & 0 deletions lib/core/controllers/navigation_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:get/get.dart';

class NavigationController extends GetxController {
var selectedIndex = 0.obs;

void changeIndex(int index) {
selectedIndex.value = index;
}
}
11 changes: 11 additions & 0 deletions lib/core/controllers/user_mode_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:get/get.dart';

enum UserMode { junior, senior }

class UserModeController extends GetxController {
var userMode = UserMode.junior.obs;

void setMode(UserMode mode) {
userMode.value = mode;
}
}
26 changes: 26 additions & 0 deletions lib/core/navigator/junior_navigation_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:weve_client/core/controllers/navigation_controller.dart';

class JuniorNavigationBar extends StatelessWidget {
JuniorNavigationBar({super.key});
final NavigationController navigationController = Get.find();

@override
Widget build(BuildContext context) {
return BottomNavigationBar(
type: BottomNavigationBarType.fixed,
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: '홈'),
BottomNavigationBarItem(icon: Icon(Icons.edit), label: '작성'),
BottomNavigationBarItem(icon: Icon(Icons.person), label: '마이'),
],
currentIndex: navigationController.selectedIndex.value, // 여기서만 Rx 사용
onTap: (index) {
if (index >= 0 && index < 3) {
navigationController.changeIndex(index);
}
},
);
}
}
Empty file.
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions lib/features/junior/presentation/views/junior_home_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class JuniorHomeScreen extends StatefulWidget {
const JuniorHomeScreen({super.key});

@override
State<JuniorHomeScreen> createState() => _JuniorHomeScreenState();
}

class _JuniorHomeScreenState extends State<JuniorHomeScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
15 changes: 15 additions & 0 deletions lib/features/junior/presentation/views/junior_my_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class JuniorMyScreen extends StatefulWidget {
const JuniorMyScreen({super.key});

@override
State<JuniorMyScreen> createState() => _JuniorMyScreenState();
}

class _JuniorMyScreenState extends State<JuniorMyScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
15 changes: 15 additions & 0 deletions lib/features/junior/presentation/views/junior_write_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class JuniorWriteScreen extends StatefulWidget {
const JuniorWriteScreen({super.key});

@override
State<JuniorWriteScreen> createState() => _JuniorWriteScreenState();
}

class _JuniorWriteScreenState extends State<JuniorWriteScreen> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
35 changes: 14 additions & 21 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import 'package:flutter/material.dart';
import 'package:weve_client/core/constants/colors.dart';
import 'package:weve_client/core/constants/fonts.dart';
import 'package:get/get.dart';
import 'package:weve_client/commons/presentation/main_screen.dart';
import 'package:weve_client/core/controllers/navigation_controller.dart';
import 'package:weve_client/core/controllers/user_mode_controller.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();
Get.put(NavigationController());
Get.put(UserModeController());

runApp(const MyApp());
}

Expand All @@ -11,25 +17,12 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Weve App',
theme: ThemeData(
fontFamily: 'Pretendard',
),
home: Scaffold(
backgroundColor: WeveColor.bg.bg1,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Hello flutter",
style: WeveText.header1(color: WeveColor.main.orange1),
)
],
),
return GetMaterialApp(
title: 'Weve App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: 'Pretendard',
),
),
);
home: MainScreen());
}
}
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
get:
dependency: "direct main"
description:
name: get
sha256: c79eeb4339f1f3deffd9ec912f8a923834bec55f7b49c9e882b8fef2c139d425
url: "https://pub.dev"
source: hosted
version: "4.7.2"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -208,6 +216,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.3.0"
web:
dependency: transitive
description:
name: web
sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
url: "https://pub.dev"
source: hosted
version: "1.1.0"
sdks:
dart: ">=3.6.1 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
get: ^4.7.2

dev_dependencies:
flutter_test:
Expand Down Expand Up @@ -77,5 +78,5 @@ flutter:
fonts:
- asset: assets/fonts/Pretendard-Bold.ttf
weight: 700
- asset: fonts/Schyler-Regular.ttf
- asset: assets/fonts/Pretendard-Regular.ttf
weight: 400
30 changes: 0 additions & 30 deletions test/widget_test.dart

This file was deleted.