https://github.com/dev-hwang/flutter_dev_packages
[Flutter 3.0] This plugin includes components, utilities, and more to make it easier to develop the Flutter app.
https://github.com/dev-hwang/flutter_dev_packages
Last synced: 5 months ago
JSON representation
[Flutter 3.0] This plugin includes components, utilities, and more to make it easier to develop the Flutter app.
- Host: GitHub
- URL: https://github.com/dev-hwang/flutter_dev_packages
- Owner: Dev-hwang
- License: other
- Created: 2022-07-01T04:12:39.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-01T04:15:40.000Z (about 4 years ago)
- Last Synced: 2025-10-07T19:58:26.696Z (9 months ago)
- Language: Dart
- Size: 110 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
This plugin includes components, utilities, and more to make it easier to develop the Flutter app.
## Directory
``` bash
├── logger
│ ├── models
│ │ ├── log_event.dart
│ │ └── log_level.dart
│ ├── logger.dart
│ └── printer.dart
├── network
│ ├── exception
│ │ └── api_exception.dart
│ ├── models
│ │ ├── charset.dart
│ │ ├── http_media_type.dart
│ │ ├── http_request_method.dart
│ │ └── network_protocol.dart
│ └── rest_api.dart
├── permission
│ ├── models
│ │ ├── permission_data.dart
│ │ ├── permission_type.dart
│ │ └── permissions_status.dart
│ ├── permission_check_page.dart
│ └── permission_utils.dart
├── ui
│ ├── button
│ │ ├── models
│ │ │ └── button_size.dart
│ │ ├── date_picker_button.dart
│ │ ├── drop_down_button.dart
│ │ ├── ghost_button.dart
│ │ └── simple_button.dart
│ ├── component
│ │ ├── gradient_app_bar.dart
│ │ └── speech_bubble.dart
│ ├── dialog
│ │ ├── android_toast.dart
│ │ ├── custom_dialog.dart
│ │ ├── modal_date_picker.dart
│ │ └── system_dialog.dart
│ └── views
│ ├── with_drag_detector.dart
│ ├── with_progress_screen.dart
│ ├── with_scroll_up_button.dart
│ ├── with_theme_manager.dart
│ └── with_will_pop_scope.dart
├── utils
│ ├── date_time_utils.dart
│ ├── device_info_utils.dart
│ ├── exception_utils.dart
│ ├── notification_utils.dart
│ ├── system_utils.dart
│ ├── text_format_utils.dart
│ └── web_image_utils.dart
└── flutter_dev_packages.dart
```
## Getting started
To use this plugin, add `flutter_dev_packages` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example:
```yaml
dependencies:
flutter_dev_packages:
git:
url: https://github.com/Dev-hwang/flutter_dev_packages.git
ref: master
```
## Usage
플러그인에 포함된 패키지나 유틸리티를 사용하려면 플랫폼별 초기 설정이 필요하다.
### :baby_chick: logger package
1. [sentry.io](https://sentry.io/welcome/) 회원가입을 진행한다.
2. 프로젝트를 생성하고 DSN 값을 얻는다.
3. 프로젝트의 `main` 함수에 아래와 같이 `Sentry` 플러그인을 초기화한다.
``` dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_dev_packages/flutter_dev_packages.dart';
const String kSentryDsn = 'https://80ab98a9a0b448e0b591d2d5db20c47b@o332735.ingest.sentry.io/0';
void main() {
runZonedGuarded(() async {
await Sentry.init((options) {
options.dsn = kSentryDsn;
});
runApp(const ExampleApp());
}, (error, stackTrace) async {
await Logger.f('FATAL EXCEPTION', error: error, stackTrace: stackTrace);
});
}
```
### :baby_chick: network package
network 패키지 사용 시 아래 권한 추가 필요
#### Android
/android/app/src/main/AndroidManifest.xml
``` xml
```
#### iOS
/ios/Runner/info.plist
``` xml
NSAppTransportSecurity
NSAllowsArbitraryLoads
NSAllowsArbitraryLoadsInWebContent
```
### :baby_chick: permission package
permission 패키지 사용 시 필요 권한 추가 필요
#### Android
/android/app/src/main/AndroidManifest.xml
``` xml
```
#### iOS
/ios/Runner/info.plist
``` xml
NSCalendarsUsageDescription
NSCameraUsageDescription
NSContactsUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
NSLocationUsageDescription
NSLocationAlwaysUsageDescription
NSMicrophoneUsageDescription
NSPhotoLibraryUsageDescription
NSAppleMusicUsageDescription
kTCCServiceMediaLibrary
NSMotionUsageDescription
NSSpeechRecognitionUsageDescription
NSRemindersUsageDescription
```
/ios/Podfile
``` xml
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## 아래 표를 참고하여 사용할 권한에 대한 매크로를 추가한다.
'PERMISSION_LOCATION=1',
'PERMISSION_NOTIFICATIONS=1'
]
end
flutter_additional_ios_build_settings(target)
end
end
```
| Permission | Info.plist | Macro |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| PermissionType.calendar | NSCalendarsUsageDescription | PERMISSION_EVENTS |
| PermissionType.reminders | NSRemindersUsageDescription | PERMISSION_REMINDERS |
| PermissionType.contacts | NSContactsUsageDescription | PERMISSION_CONTACTS |
| PermissionType.camera | NSCameraUsageDescription | PERMISSION_CAMERA |
| PermissionType.microphone | NSMicrophoneUsageDescription | PERMISSION_MICROPHONE |
| PermissionType.speech | NSSpeechRecognitionUsageDescription | PERMISSION_SPEECH_RECOGNIZER |
| PermissionType.photos | NSPhotoLibraryUsageDescription | PERMISSION_PHOTOS |
| PermissionType.location | NSLocationUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription | PERMISSION_LOCATION |
| PermissionType.notification | PermissionGroupNotification | PERMISSION_NOTIFICATIONS |
| PermissionType.mediaLibrary | NSAppleMusicUsageDescription, kTCCServiceMediaLibrary | PERMISSION_MEDIA_LIBRARY |
| PermissionType.sensors | NSMotionUsageDescription | PERMISSION_SENSORS |
| PermissionType.bluetooth | NSBluetoothAlwaysUsageDescription, NSBluetoothPeripheralUsageDescription | PERMISSION_BLUETOOTH |
### :baby_chick: notification_utils
#### Android
/android/app/src/main/AndroidManifest.xml
``` xml
```
/android/app/proguard-rules.pro
``` xml
-keep class com.dexterous.** { *; }
```
#### iOS
/ios/Runner/AppDelegate.swift
``` xml
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// 노티피케이션 대리자를 등록하세요.
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
```
### :baby_chick: date_picker_button
/project/pubspec.yaml
```yaml
dependencies:
flutter_localizations:
sdk: flutter
```
/project/lib/main.dart
``` dart
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: [
GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [
const Locale('en'),
const Locale('ko'),
],
...
);
}
```
## Prepare release
### :star2: keystore 생성 및 서명 구성
#### 1. 터미널에 아래 명령어를 입력하여 keystore 파일을 생성한다.
맥/리눅스에서는 아래 명령어를 사용하세요:
``` text
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
```
윈도우에서는 아래 명령어를 사용하세요:
``` text
keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
```
#### 2. /android/key.properties 파일을 생성하고 아래 내용을 입력한다.
``` text
storePassword=
keyPassword=
keyAlias=key
storeFile=/key.jks>
```
#### 3. /android/app/build.gradle 파일에 아래 코드를 추가한다.
``` text
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
// 기본 코드 생략..
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
```
### :star2: 코드 난독화
#### 1. /android/app/proguard-rules.pro 파일을 생성하고 아래 내용을 입력한다.
``` text
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-dontwarn io.flutter.embedding.**
```
#### 2. /android/app/build.gradle 파일에 아래 코드를 추가한다.
``` text
android {
// 기본 코드 생략..
buildTypes {
release {
shrinkResources true
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
}
```
자세한 내용은 [공식 홈페이지](https://flutter-ko.dev/docs/deployment/android) 참조