Skip to content

Commit b82f8d5

Browse files
committed
♻️ 코드의 유지보수 강화
path를 String형식의 변수로 변경, class를 싱글톤으로 변경, 전역변수를 클래스로 묶음, router 설정 일부 변경
1 parent 9b9dce6 commit b82f8d5

File tree

5,083 files changed

+383710
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,083 files changed

+383710
-52
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package io.flutter.plugins;
2+
3+
import androidx.annotation.Keep;
4+
import androidx.annotation.NonNull;
5+
import io.flutter.Log;
6+
7+
import io.flutter.embedding.engine.FlutterEngine;
8+
9+
/**
10+
* Generated file. Do not edit.
11+
* This file is generated by the Flutter tool based on the
12+
* plugins that support the Android platform.
13+
*/
14+
@Keep
15+
public final class GeneratedPluginRegistrant {
16+
private static final String TAG = "GeneratedPluginRegistrant";
17+
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
18+
try {
19+
flutterEngine.getPlugins().add(new net.jonhanson.flutter_native_splash.FlutterNativeSplashPlugin());
20+
} catch (Exception e) {
21+
Log.e(TAG, "Error registering plugin flutter_native_splash, net.jonhanson.flutter_native_splash.FlutterNativeSplashPlugin", e);
22+
}
23+
try {
24+
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
25+
} catch (Exception e) {
26+
Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
27+
}
28+
try {
29+
flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin());
30+
} catch (Exception e) {
31+
Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e);
32+
}
33+
}
34+
}

android/local.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sdk.dir=/Users/damn_yul/Library/Android/sdk
2+
flutter.sdk=/opt/homebrew/Caskroom/flutter/3.29.2/flutter

lib/main.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ class MyApp extends StatelessWidget {
2929

3030
@override
3131
Widget build(BuildContext context) {
32+
final appRouter = AppRouter();
3233
return ScreenUtilInit(
3334
designSize: const Size(360, 800),
3435
minTextAdapt: true,
3536
splitScreenMode: true,
3637
builder: (context, child) {
3738
return MaterialApp.router(
38-
routerConfig: router,
39+
routerDelegate: appRouter.router.routerDelegate,
40+
routeInformationParser: appRouter.router.routeInformationParser,
41+
routeInformationProvider: appRouter.router.routeInformationProvider,
3942
title: 'Jusicool',
4043
theme: ThemeData(
4144
primarySwatch: Colors.blue,

lib/router.dart

Lines changed: 75 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,78 @@ import 'package:jusicool_ios/screens/mycapital_screens/maincapital_screen.dart';
99
import 'package:jusicool_ios/screens/mycapital_screens/monthlyrevenue_screen.dart';
1010
import 'package:jusicool_ios/screens/mycapital_screens/order_detail.dart';
1111

12-
final GoRouter router = GoRouter(
13-
initialLocation: '/splash',
14-
routes: [
15-
GoRoute(path: '/splash', builder: (context, state) => const SplashScreen()),
16-
GoRoute(path: '/login', builder: (context, state) => const LoginScreen()),
17-
GoRoute(
18-
path: '/name-input',
19-
builder: (context, state) => const NameInputScreen(),
20-
),
21-
GoRoute(
22-
path: '/email-auth',
23-
builder: (context, state) {
24-
final username = state.extra as String?;
25-
return EmailAuthScreen(username: username ?? '');
26-
},
27-
),
28-
GoRoute(
29-
path: '/password-create',
30-
builder: (context, state) {
31-
final extra = state.extra as Map<String, String>?;
32-
return PasswordCreateScreen(
33-
username: extra?['username'] ?? '',
34-
email: extra?['email'] ?? '',
35-
);
36-
},
37-
),
38-
GoRoute(
39-
path: '/find-school',
40-
builder: (context, state) {
41-
final extra = state.extra as Map<String, String>?;
42-
return FindSchoolScreen(
43-
username: extra?['username'] ?? '',
44-
email: extra?['email'] ?? '',
45-
password: extra?['password'] ?? '',
46-
);
47-
},
48-
),
49-
GoRoute(
50-
path: '/main-capital',
51-
builder: (context, state) => const MainCapitalScreen(),
52-
),
53-
GoRoute(
54-
path: '/monthly-revenue',
55-
builder: (context, state) => const MonthlyRevenueScreen(),
56-
),
57-
GoRoute(
58-
path: '/order-detail',
59-
builder: (context, state) => const OrderDetailScreen(),
60-
),
61-
],
62-
);
12+
class RoutePaths {
13+
static const String splash = '/splash';
14+
static const String login = '/login';
15+
static const String nameInput = '/name-input';
16+
static const String emailAuth = '/email-auth';
17+
static const String passwordCreate = '/password-create';
18+
static const String findSchool = '/find-school';
19+
static const String mainCapital = '/main-capital';
20+
static const String monthlyRevenue = '/monthly-revenue';
21+
static const String orderDetail = '/order-detail';
22+
}
23+
24+
class AppRouter {
25+
AppRouter._internal();
26+
static final AppRouter _instance = AppRouter._internal();
27+
factory AppRouter() => _instance;
28+
29+
late final GoRouter router = GoRouter(
30+
initialLocation: RoutePaths.splash,
31+
routes: [
32+
GoRoute(
33+
path: RoutePaths.splash,
34+
builder: (context, state) => const SplashScreen(),
35+
),
36+
GoRoute(
37+
path: RoutePaths.login,
38+
builder: (context, state) => const LoginScreen(),
39+
),
40+
GoRoute(
41+
path: RoutePaths.nameInput,
42+
builder: (context, state) => const NameInputScreen(),
43+
),
44+
GoRoute(
45+
path: RoutePaths.emailAuth,
46+
builder: (context, state) {
47+
final username = state.extra as String?;
48+
return EmailAuthScreen(username: username ?? '');
49+
},
50+
),
51+
GoRoute(
52+
path: RoutePaths.passwordCreate,
53+
builder: (context, state) {
54+
final extra = state.extra as Map<String, String>?;
55+
return PasswordCreateScreen(
56+
username: extra?['username'] ?? '',
57+
email: extra?['email'] ?? '',
58+
);
59+
},
60+
),
61+
GoRoute(
62+
path: RoutePaths.findSchool,
63+
builder: (context, state) {
64+
final extra = state.extra as Map<String, String>?;
65+
return FindSchoolScreen(
66+
username: extra?['username'] ?? '',
67+
email: extra?['email'] ?? '',
68+
password: extra?['password'] ?? '',
69+
);
70+
},
71+
),
72+
GoRoute(
73+
path: RoutePaths.mainCapital,
74+
builder: (context, state) => const MainCapitalScreen(),
75+
),
76+
GoRoute(
77+
path: RoutePaths.monthlyRevenue,
78+
builder: (context, state) => const MonthlyRevenueScreen(),
79+
),
80+
GoRoute(
81+
path: RoutePaths.orderDetail,
82+
builder: (context, state) => const OrderDetailScreen(),
83+
),
84+
],
85+
);
86+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/damn_yul/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/damn_yul/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#include "generated_plugin_registrant.h"
8+
9+
#include <url_launcher_linux/url_launcher_plugin.h>
10+
11+
void fl_register_plugins(FlPluginRegistry* registry) {
12+
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
13+
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
14+
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#ifndef GENERATED_PLUGIN_REGISTRANT_
8+
#define GENERATED_PLUGIN_REGISTRANT_
9+
10+
#include <flutter_linux/flutter_linux.h>
11+
12+
// Registers Flutter plugins.
13+
void fl_register_plugins(FlPluginRegistry* registry);
14+
15+
#endif // GENERATED_PLUGIN_REGISTRANT_
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
list(APPEND FLUTTER_PLUGIN_LIST
6+
url_launcher_linux
7+
)
8+
9+
list(APPEND FLUTTER_FFI_PLUGIN_LIST
10+
)
11+
12+
set(PLUGIN_BUNDLED_LIBRARIES)
13+
14+
foreach(plugin ${FLUTTER_PLUGIN_LIST})
15+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
16+
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17+
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
18+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19+
endforeach(plugin)
20+
21+
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
23+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24+
endforeach(ffi_plugin)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
import path_provider_foundation
9+
import url_launcher_macos
10+
11+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
12+
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
13+
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
14+
}

0 commit comments

Comments
 (0)