-
44.gitignore
-
33.metadata
-
16README.md
-
20analysis_options.yaml
-
13android/.gitignore
-
72android/app/build.gradle
-
7android/app/src/debug/AndroidManifest.xml
-
33android/app/src/main/AndroidManifest.xml
-
6android/app/src/main/kotlin/com/example/sonnat/MainActivity.kt
-
12android/app/src/main/res/drawable-v21/launch_background.xml
-
12android/app/src/main/res/drawable/launch_background.xml
-
BINandroid/app/src/main/res/mipmap-hdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-mdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xhdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
-
BINandroid/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
-
18android/app/src/main/res/values-night/styles.xml
-
18android/app/src/main/res/values/styles.xml
-
7android/app/src/profile/AndroidManifest.xml
-
31android/build.gradle
-
3android/gradle.properties
-
5android/gradle/wrapper/gradle-wrapper.properties
-
11android/settings.gradle
-
BINassets/fonts/arabi/Cairo-Black.ttf
-
BINassets/fonts/arabi/Cairo-Bold.ttf
-
BINassets/fonts/arabi/Cairo-ExtraBold.ttf
-
BINassets/fonts/arabi/Cairo-ExtraLight.ttf
-
BINassets/fonts/arabi/Cairo-Light.ttf
-
BINassets/fonts/arabi/Cairo-Medium.ttf
-
BINassets/fonts/arabi/Cairo-Regular.ttf
-
BINassets/fonts/arabi/Cairo-SemiBold.ttf
-
BINassets/fonts/farsi/Vazir-Black-FD.ttf
-
BINassets/fonts/farsi/Vazir-Bold-FD.ttf
-
BINassets/fonts/farsi/Vazir-Light-FD.ttf
-
BINassets/fonts/farsi/Vazir-Medium-FD.ttf
-
BINassets/fonts/farsi/Vazir-Regular-FD.ttf
-
BINassets/fonts/farsi/Vazir-Thin-FD.ttf
-
BINassets/images/png/ic_main_header.png
-
6assets/images/svg/ic_akhbar.svg
-
6assets/images/svg/ic_aqayed.svg
-
6assets/images/svg/ic_back.svg
-
7assets/images/svg/ic_instagram.svg
-
9assets/images/svg/ic_line.svg
-
6assets/images/svg/ic_mataen.svg
-
10assets/images/svg/ic_more.svg
-
3assets/images/svg/ic_phone.svg
-
9assets/images/svg/ic_rounded_search.svg
-
6assets/images/svg/ic_search.svg
-
6assets/images/svg/ic_shobahat.svg
-
6assets/images/svg/ic_video.svg
-
6assets/images/svg/ic_vijeha.svg
-
2assets/languages/ar.json
-
17assets/languages/en.json
-
17assets/languages/fa.json
-
2assets/meta/about_us.txt
-
47data/data_core/local_db/local_db_core/.gitignore
-
45data/data_core/local_db/local_db_core/.metadata
-
16data/data_core/local_db/local_db_core/README.md
-
29data/data_core/local_db/local_db_core/analysis_options.yaml
-
66data/data_core/local_db/local_db_core/lib/lib/boxes/box_list/setting_box/app_setting_box.dart
-
9data/data_core/local_db/local_db_core/lib/lib/boxes/box_list/setting_box/box_keys.dart
-
7data/data_core/local_db/local_db_core/lib/lib/boxes/interfaces/base_box_interface.dart
-
5data/data_core/local_db/local_db_core/lib/lib/boxes/interfaces/config_box_interface.dart
-
340data/data_core/local_db/local_db_core/pubspec.lock
-
23data/data_core/local_db/local_db_core/pubspec.yaml
-
10data/data_core/local_db/local_db_core/test/widget_test.dart
-
30data/data_core/network/network_core/.gitignore
-
10data/data_core/network/network_core/.metadata
-
3data/data_core/network/network_core/CHANGELOG.md
-
39data/data_core/network/network_core/README.md
-
37data/data_core/network/network_core/lib/initializer/base_initializer.dart
-
34data/data_core/network/network_core/lib/initializer/gamification_initializer.dart
-
37data/data_core/network/network_core/lib/initializer/hamrah_cloud_initializer.dart
-
39data/data_core/network/network_core/lib/initializer/logger_initializer.dart
-
20data/data_core/network/network_core/lib/network/helper/config.dart
-
21data/data_core/network/network_core/lib/network/helper/path_provider_service.dart
-
8data/data_core/network/network_core/lib/network/helper/util.dart
-
11data/data_core/network/network_core/lib/network/interface/network_initializer_interface.dart
-
140data/data_core/network/network_core/lib/network/networking/api_endpoint.dart
-
41data/data_core/network/network_core/lib/network/networking/api_interface.dart
-
210data/data_core/network/network_core/lib/network/networking/api_service.dart
-
111data/data_core/network/network_core/lib/network/networking/custom_exception.dart
-
203data/data_core/network/network_core/lib/network/networking/dio_service.dart
-
53data/data_core/network/network_core/lib/network/networking/interceptors/api_interceptor.dart
-
48data/data_core/network/network_core/lib/network/networking/response_model.dart
-
26data/data_core/network/network_core/pubspec.yaml
-
30data/data_types/data/.gitignore
-
10data/data_types/data/.metadata
-
3data/data_types/data/CHANGELOG.md
-
39data/data_types/data/README.md
-
102data/data_types/data/lib/app_setting_data/repository/app_setting_box_repository_impl.dart
-
22data/data_types/data/pubspec.yaml
-
30domain/repositories/.gitignore
-
4domain/repositories/analysis_options.yaml
-
13domain/repositories/lib/app_setting_box_domain/model/user_data_model.dart
-
21domain/repositories/lib/app_setting_box_domain/repository/app_setting_box_repository.dart
-
6domain/repositories/lib/typedefs.dart
-
17domain/repositories/pubspec.yaml
-
34ios/.gitignore
-
26ios/Flutter/AppFrameworkInfo.plist
@ -0,0 +1,44 @@ |
|||
# Miscellaneous |
|||
*.class |
|||
*.log |
|||
*.pyc |
|||
*.swp |
|||
.DS_Store |
|||
.atom/ |
|||
.buildlog/ |
|||
.history |
|||
.svn/ |
|||
migrate_working_dir/ |
|||
|
|||
# IntelliJ related |
|||
*.iml |
|||
*.ipr |
|||
*.iws |
|||
.idea/ |
|||
|
|||
# The .vscode folder contains launch configuration and tasks you configure in |
|||
# VS Code which you may wish to be included in version control, so this line |
|||
# is commented out by default. |
|||
#.vscode/ |
|||
|
|||
# Flutter/Dart/Pub related |
|||
**/doc/api/ |
|||
**/ios/Flutter/.last_build_id |
|||
.dart_tool/ |
|||
.flutter-plugins |
|||
.flutter-plugins-dependencies |
|||
.packages |
|||
.pub-cache/ |
|||
.pub/ |
|||
/build/ |
|||
|
|||
# Symbolication related |
|||
app.*.symbols |
|||
|
|||
# Obfuscation related |
|||
app.*.map.json |
|||
|
|||
# Android Studio will place build artifacts here |
|||
/android/app/debug |
|||
/android/app/profile |
|||
/android/app/release |
@ -0,0 +1,33 @@ |
|||
# This file tracks properties of this Flutter project. |
|||
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
|||
# |
|||
# This file should be version controlled. |
|||
|
|||
version: |
|||
revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
channel: stable |
|||
|
|||
project_type: app |
|||
|
|||
# Tracks metadata for the flutter migrate command |
|||
migration: |
|||
platforms: |
|||
- platform: root |
|||
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
- platform: android |
|||
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
- platform: ios |
|||
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 |
|||
|
|||
# User provided section |
|||
|
|||
# List of Local paths (relative to this file) that should be |
|||
# ignored by the migrate tool. |
|||
# |
|||
# Files that are not part of the templates will be ignored by default. |
|||
unmanaged_files: |
|||
- 'lib/main.dart' |
|||
- 'ios/Runner.xcodeproj/project.pbxproj' |
@ -0,0 +1,16 @@ |
|||
# sonnat |
|||
|
|||
A new Flutter project. |
|||
|
|||
## Getting Started |
|||
|
|||
This project is a starting point for a Flutter application. |
|||
|
|||
A few resources to get you started if this is your first Flutter project: |
|||
|
|||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) |
|||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) |
|||
|
|||
For help getting started with Flutter development, view the |
|||
[online documentation](https://docs.flutter.dev/), which offers tutorials, |
|||
samples, guidance on mobile development, and a full API reference. |
@ -0,0 +1,20 @@ |
|||
include: package:flutter_lints/flutter.yaml |
|||
|
|||
linter: |
|||
# In addition to the flutter_lints |
|||
rules: |
|||
- always_declare_return_types |
|||
- avoid_types_on_closure_parameters |
|||
- avoid_void_async |
|||
- cancel_subscriptions |
|||
- close_sinks |
|||
- directives_ordering |
|||
- flutter_style_todos |
|||
- package_api_docs |
|||
- prefer_single_quotes |
|||
- test_types_in_equals |
|||
- throw_in_finally |
|||
- unawaited_futures |
|||
- unnecessary_statements |
|||
- unsafe_html |
|||
- use_super_parameters |
@ -0,0 +1,13 @@ |
|||
gradle-wrapper.jar |
|||
/.gradle |
|||
/captures/ |
|||
/gradlew |
|||
/gradlew.bat |
|||
/local.properties |
|||
GeneratedPluginRegistrant.java |
|||
|
|||
# Remember to never publicly share your keystore. |
|||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app |
|||
key.properties |
|||
**/*.keystore |
|||
**/*.jks |
@ -0,0 +1,72 @@ |
|||
def localProperties = new Properties() |
|||
def localPropertiesFile = rootProject.file('local.properties') |
|||
if (localPropertiesFile.exists()) { |
|||
localPropertiesFile.withReader('UTF-8') { reader -> |
|||
localProperties.load(reader) |
|||
} |
|||
} |
|||
|
|||
def flutterRoot = localProperties.getProperty('flutter.sdk') |
|||
if (flutterRoot == null) { |
|||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
|||
} |
|||
|
|||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') |
|||
if (flutterVersionCode == null) { |
|||
flutterVersionCode = '1' |
|||
} |
|||
|
|||
def flutterVersionName = localProperties.getProperty('flutter.versionName') |
|||
if (flutterVersionName == null) { |
|||
flutterVersionName = '1.0' |
|||
} |
|||
|
|||
apply plugin: 'com.android.application' |
|||
apply plugin: 'kotlin-android' |
|||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
|||
|
|||
android { |
|||
namespace "com.example.sonnat" |
|||
compileSdkVersion flutter.compileSdkVersion |
|||
ndkVersion flutter.ndkVersion |
|||
|
|||
compileOptions { |
|||
sourceCompatibility JavaVersion.VERSION_1_8 |
|||
targetCompatibility JavaVersion.VERSION_1_8 |
|||
} |
|||
|
|||
kotlinOptions { |
|||
jvmTarget = '1.8' |
|||
} |
|||
|
|||
sourceSets { |
|||
main.java.srcDirs += 'src/main/kotlin' |
|||
} |
|||
|
|||
defaultConfig { |
|||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
|||
applicationId "com.example.sonnat" |
|||
// You can update the following values to match your application needs. |
|||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. |
|||
minSdkVersion flutter.minSdkVersion |
|||
targetSdkVersion flutter.targetSdkVersion |
|||
versionCode flutterVersionCode.toInteger() |
|||
versionName flutterVersionName |
|||
} |
|||
|
|||
buildTypes { |
|||
release { |
|||
// TODO: Add your own signing config for the release build. |
|||
// Signing with the debug keys for now, so `flutter run --release` works. |
|||
signingConfig signingConfigs.debug |
|||
} |
|||
} |
|||
} |
|||
|
|||
flutter { |
|||
source '../..' |
|||
} |
|||
|
|||
dependencies { |
|||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
|||
} |
@ -0,0 +1,7 @@ |
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<!-- The INTERNET permission is required for development. Specifically, |
|||
the Flutter tool needs it to communicate with the running application |
|||
to allow setting breakpoints, to provide hot reload, etc. |
|||
--> |
|||
<uses-permission android:name="android.permission.INTERNET"/> |
|||
</manifest> |
@ -0,0 +1,33 @@ |
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<application |
|||
android:label="sonnat" |
|||
android:name="${applicationName}" |
|||
android:icon="@mipmap/ic_launcher"> |
|||
<activity |
|||
android:name=".MainActivity" |
|||
android:exported="true" |
|||
android:launchMode="singleTop" |
|||
android:theme="@style/LaunchTheme" |
|||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" |
|||
android:hardwareAccelerated="true" |
|||
android:windowSoftInputMode="adjustResize"> |
|||
<!-- Specifies an Android theme to apply to this Activity as soon as |
|||
the Android process has started. This theme is visible to the user |
|||
while the Flutter UI initializes. After that, this theme continues |
|||
to determine the Window background behind the Flutter UI. --> |
|||
<meta-data |
|||
android:name="io.flutter.embedding.android.NormalTheme" |
|||
android:resource="@style/NormalTheme" |
|||
/> |
|||
<intent-filter> |
|||
<action android:name="android.intent.action.MAIN"/> |
|||
<category android:name="android.intent.category.LAUNCHER"/> |
|||
</intent-filter> |
|||
</activity> |
|||
<!-- Don't delete the meta-data below. |
|||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> |
|||
<meta-data |
|||
android:name="flutterEmbedding" |
|||
android:value="2" /> |
|||
</application> |
|||
</manifest> |
@ -0,0 +1,6 @@ |
|||
package com.example.sonnat |
|||
|
|||
import io.flutter.embedding.android.FlutterActivity |
|||
|
|||
class MainActivity: FlutterActivity() { |
|||
} |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Modify this file to customize your launch splash screen --> |
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<item android:drawable="?android:colorBackground" /> |
|||
|
|||
<!-- You can insert your own image assets here --> |
|||
<!-- <item> |
|||
<bitmap |
|||
android:gravity="center" |
|||
android:src="@mipmap/launch_image" /> |
|||
</item> --> |
|||
</layer-list> |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Modify this file to customize your launch splash screen --> |
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<item android:drawable="@android:color/white" /> |
|||
|
|||
<!-- You can insert your own image assets here --> |
|||
<!-- <item> |
|||
<bitmap |
|||
android:gravity="center" |
|||
android:src="@mipmap/launch_image" /> |
|||
</item> --> |
|||
</layer-list> |
After Width: 72 | Height: 72 | Size: 544 B |
After Width: 48 | Height: 48 | Size: 442 B |
After Width: 96 | Height: 96 | Size: 721 B |
After Width: 144 | Height: 144 | Size: 1.0 KiB |
After Width: 192 | Height: 192 | Size: 1.4 KiB |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<resources> |
|||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> |
|||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> |
|||
<!-- Show a splash screen on the activity. Automatically removed when |
|||
the Flutter engine draws its first frame --> |
|||
<item name="android:windowBackground">@drawable/launch_background</item> |
|||
</style> |
|||
<!-- Theme applied to the Android Window as soon as the process has started. |
|||
This theme determines the color of the Android Window while your |
|||
Flutter UI initializes, as well as behind your Flutter UI while its |
|||
running. |
|||
|
|||
This Theme is only used starting with V2 of Flutter's Android embedding. --> |
|||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> |
|||
<item name="android:windowBackground">?android:colorBackground</item> |
|||
</style> |
|||
</resources> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<resources> |
|||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> |
|||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> |
|||
<!-- Show a splash screen on the activity. Automatically removed when |
|||
the Flutter engine draws its first frame --> |
|||
<item name="android:windowBackground">@drawable/launch_background</item> |
|||
</style> |
|||
<!-- Theme applied to the Android Window as soon as the process has started. |
|||
This theme determines the color of the Android Window while your |
|||
Flutter UI initializes, as well as behind your Flutter UI while its |
|||
running. |
|||
|
|||
This Theme is only used starting with V2 of Flutter's Android embedding. --> |
|||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> |
|||
<item name="android:windowBackground">?android:colorBackground</item> |
|||
</style> |
|||
</resources> |
@ -0,0 +1,7 @@ |
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
|||
<!-- The INTERNET permission is required for development. Specifically, |
|||
the Flutter tool needs it to communicate with the running application |
|||
to allow setting breakpoints, to provide hot reload, etc. |
|||
--> |
|||
<uses-permission android:name="android.permission.INTERNET"/> |
|||
</manifest> |
@ -0,0 +1,31 @@ |
|||
buildscript { |
|||
ext.kotlin_version = '1.7.10' |
|||
repositories { |
|||
google() |
|||
mavenCentral() |
|||
} |
|||
|
|||
dependencies { |
|||
classpath 'com.android.tools.build:gradle:7.3.0' |
|||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
|||
} |
|||
} |
|||
|
|||
allprojects { |
|||
repositories { |
|||
google() |
|||
mavenCentral() |
|||
} |
|||
} |
|||
|
|||
rootProject.buildDir = '../build' |
|||
subprojects { |
|||
project.buildDir = "${rootProject.buildDir}/${project.name}" |
|||
} |
|||
subprojects { |
|||
project.evaluationDependsOn(':app') |
|||
} |
|||
|
|||
tasks.register("clean", Delete) { |
|||
delete rootProject.buildDir |
|||
} |
@ -0,0 +1,3 @@ |
|||
org.gradle.jvmargs=-Xmx1536M |
|||
android.useAndroidX=true |
|||
android.enableJetifier=true |
@ -0,0 +1,5 @@ |
|||
distributionBase=GRADLE_USER_HOME |
|||
distributionPath=wrapper/dists |
|||
zipStoreBase=GRADLE_USER_HOME |
|||
zipStorePath=wrapper/dists |
|||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip |
@ -0,0 +1,11 @@ |
|||
include ':app' |
|||
|
|||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") |
|||
def properties = new Properties() |
|||
|
|||
assert localPropertiesFile.exists() |
|||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } |
|||
|
|||
def flutterSdkPath = properties.getProperty("flutter.sdk") |
|||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" |
|||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
After Width: 203 | Height: 203 | Size: 6.9 KiB |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="40.5" height="27" viewBox="0 0 40.5 27"> |
|||
<g id="Group_1604" data-name="Group 1604" transform="translate(-167.25 -699)"> |
|||
<rect id="Rectangle_3543" data-name="Rectangle 3543" width="31" height="23" transform="translate(173 701)" fill="#00845c"/> |
|||
<path id="Icon_awesome-newspaper" data-name="Icon awesome-newspaper" d="M38.813,4.5H6.188A1.687,1.687,0,0,0,4.5,6.188V6.75H1.688A1.687,1.687,0,0,0,0,8.438V27.563A3.937,3.937,0,0,0,3.938,31.5H37.125A3.375,3.375,0,0,0,40.5,28.125V6.188A1.687,1.687,0,0,0,38.813,4.5ZM3.938,28.125a.563.563,0,0,1-.562-.562V10.125H4.5V27.563A.563.563,0,0,1,3.938,28.125ZM20.531,27H9.844A.844.844,0,0,1,9,26.156v-.562a.844.844,0,0,1,.844-.844H20.531a.844.844,0,0,1,.844.844v.563A.844.844,0,0,1,20.531,27Zm14.625,0H24.469a.844.844,0,0,1-.844-.844v-.562a.844.844,0,0,1,.844-.844H35.156a.844.844,0,0,1,.844.844v.563A.844.844,0,0,1,35.156,27ZM20.531,20.25H9.844A.844.844,0,0,1,9,19.406v-.562A.844.844,0,0,1,9.844,18H20.531a.844.844,0,0,1,.844.844v.563A.844.844,0,0,1,20.531,20.25Zm14.625,0H24.469a.844.844,0,0,1-.844-.844v-.562A.844.844,0,0,1,24.469,18H35.156a.844.844,0,0,1,.844.844v.563A.844.844,0,0,1,35.156,20.25Zm0-6.75H9.844A.844.844,0,0,1,9,12.656V9.844A.844.844,0,0,1,9.844,9H35.156A.844.844,0,0,1,36,9.844v2.813A.844.844,0,0,1,35.156,13.5Z" transform="translate(167.25 694.5)" fill="#fff"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="34.875" height="32.192" viewBox="0 0 34.875 32.192"> |
|||
<g id="Icon_ionic-md-chatboxes" data-name="Icon ionic-md-chatboxes" transform="translate(-3.375 -4.5)"> |
|||
<path id="Path_2716" data-name="Path 2716" d="M32.176,4.5h-28a.807.807,0,0,0-.805.684V23.143a.841.841,0,0,0,.805.723H8.992v7.452l7.556-7.452H32.176a.677.677,0,0,0,.624-.723V5.184A.641.641,0,0,0,32.176,4.5Z" fill="#fff"/> |
|||
<path id="Path_2717" data-name="Path 2717" d="M35.839,8.93H33.123V22.894c0,1.34-.58,2.216-2.109,2.216H15.861L12.6,28.379H23.472l7.555,7.461V28.379h4.812a.691.691,0,0,0,.637-.728V9.693A.725.725,0,0,0,35.839,8.93Z" transform="translate(1.774 0.852)" fill="#00845c"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="41" height="41" viewBox="0 0 41 41"> |
|||
<g id="Group_1609" data-name="Group 1609" transform="translate(-27 -26)"> |
|||
<circle id="Ellipse_367" data-name="Ellipse 367" cx="20.5" cy="20.5" r="20.5" transform="translate(27 26)" fill="#8d95ab"/> |
|||
<path id="Icon_ionic-ios-arrow-round-back" data-name="Icon ionic-ios-arrow-round-back" d="M16.725,11.563a1.108,1.108,0,0,1,.008,1.56l-5.147,5.164,11.942.008a1.1,1.1,0,0,1,0,2.2l-11.942-.008,5.155,5.164a1.116,1.116,0,0,1-.008,1.56,1.1,1.1,0,0,1-1.552-.008L8.2,20.169h0a1.238,1.238,0,0,1-.229-.348,1.052,1.052,0,0,1-.085-.424,1.105,1.105,0,0,1,.314-.772l6.987-7.037A1.08,1.08,0,0,1,16.725,11.563Z" transform="translate(31.248 26.807)" fill="#e7e7f5"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,7 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="21.001" height="21.001" viewBox="0 0 21.001 21.001"> |
|||
<g id="Icon_feather-instagram" data-name="Icon feather-instagram" transform="translate(1.5 1.5)"> |
|||
<path id="Path_2725" data-name="Path 2725" d="M7.5,3h9A4.5,4.5,0,0,1,21,7.5v9A4.5,4.5,0,0,1,16.5,21h-9A4.5,4.5,0,0,1,3,16.5v-9A4.5,4.5,0,0,1,7.5,3Z" transform="translate(-3 -3)" fill="none" stroke="#404966" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> |
|||
<path id="Path_2726" data-name="Path 2726" d="M19.226,15.007a3.6,3.6,0,1,1-3.033-3.033,3.6,3.6,0,0,1,3.033,3.033Z" transform="translate(-6.626 -6.574)" fill="none" stroke="#404966" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> |
|||
<path id="Path_2727" data-name="Path 2727" d="M26.25,9.75h0" transform="translate(-12.299 -5.7)" fill="none" stroke="#404966" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,9 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="155.866" height="22.764" viewBox="0 0 155.866 22.764"> |
|||
<g id="Group_1609" data-name="Group 1609" transform="translate(-109.567 -448.656)"> |
|||
<line id="Line_240" data-name="Line 240" x1="154.866" transform="translate(110.067 460.038)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1"/> |
|||
<path id="Union_576" data-name="Union 576" d="M11.3,22.763V15.946h0v6.818a14.017,14.017,0,0,0-2.592-2.973A4.516,4.516,0,0,1,6.74,15.941a4.5,4.5,0,0,1-3.767-1.966A13.843,13.843,0,0,0,0,11.382H0A14.069,14.069,0,0,0,2.973,8.788,4.537,4.537,0,0,1,6.9,6.818,4.516,4.516,0,0,1,8.87,2.973,13.81,13.81,0,0,0,11.463,0h0a14.069,14.069,0,0,0,2.593,2.973,4.519,4.519,0,0,1,1.968,3.849,4.5,4.5,0,0,1,3.767,1.966,13.844,13.844,0,0,0,2.972,2.592h0a14.069,14.069,0,0,0-2.973,2.593,4.537,4.537,0,0,1-3.929,1.969,4.519,4.519,0,0,1-1.968,3.845A13.777,13.777,0,0,0,11.3,22.763h0ZM0,11.382H0Zm22.763,0h0Z" transform="translate(176.118 448.656)" fill="#fff"/> |
|||
<ellipse id="Ellipse_366" data-name="Ellipse 366" cx="2.871" cy="2.871" rx="2.871" ry="2.871" transform="translate(184.73 457.24)" fill="#178756"/> |
|||
<path id="Union_576-2" data-name="Union 576" d="M4.824,9.717V6.807h0v2.91A5.984,5.984,0,0,0,3.717,8.448a1.928,1.928,0,0,1-.84-1.643,1.921,1.921,0,0,1-1.608-.839A5.91,5.91,0,0,0,0,4.859H0A6.006,6.006,0,0,0,1.269,3.751a1.937,1.937,0,0,1,1.677-.841,1.928,1.928,0,0,1,.84-1.642A5.9,5.9,0,0,0,4.893,0h0A6.006,6.006,0,0,0,6,1.269a1.929,1.929,0,0,1,.84,1.643,1.921,1.921,0,0,1,1.608.839A5.91,5.91,0,0,0,9.718,4.859h0A6.006,6.006,0,0,0,8.449,5.966a1.937,1.937,0,0,1-1.677.841,1.929,1.929,0,0,1-.84,1.642A5.881,5.881,0,0,0,4.825,9.717h0ZM0,4.859H0Zm9.717,0h0Z" transform="translate(198.882 455.179)" fill="#fff"/> |
|||
<path id="Union_576-3" data-name="Union 576" d="M4.824,9.717V6.807h0v2.91A5.984,5.984,0,0,0,3.717,8.448a1.928,1.928,0,0,1-.84-1.643,1.921,1.921,0,0,1-1.608-.839A5.91,5.91,0,0,0,0,4.859H0A6.006,6.006,0,0,0,1.269,3.751a1.937,1.937,0,0,1,1.677-.841,1.928,1.928,0,0,1,.84-1.642A5.9,5.9,0,0,0,4.893,0h0A6.006,6.006,0,0,0,6,1.269a1.929,1.929,0,0,1,.84,1.643,1.921,1.921,0,0,1,1.608.839A5.91,5.91,0,0,0,9.718,4.859h0A6.006,6.006,0,0,0,8.449,5.966a1.937,1.937,0,0,1-1.677.841,1.929,1.929,0,0,1-.84,1.642A5.881,5.881,0,0,0,4.825,9.717h0ZM0,4.859H0Zm9.717,0h0Z" transform="translate(165.882 455.179)" fill="#fff"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="29.25" height="29.25" viewBox="0 0 29.25 29.25"> |
|||
<g id="Group_1606" data-name="Group 1606" transform="translate(-278.875 -585.375)"> |
|||
<rect id="Rectangle_3542" data-name="Rectangle 3542" width="19" height="23" transform="translate(287 588)" fill="#00845c"/> |
|||
<path id="Icon_ionic-ios-paper" data-name="Icon ionic-ios-paper" d="M8.719,5.625V28.266a.987.987,0,0,1-.984.984h0a.987.987,0,0,1-.984-.984V7.875H5.625a2.248,2.248,0,0,0-2.25,2.25v20.25a2.248,2.248,0,0,0,2.25,2.25H30.452a2.174,2.174,0,0,0,2.173-2.173V5.625a2.248,2.248,0,0,0-2.25-2.25l-19.547.141A2.015,2.015,0,0,0,8.719,5.625Zm4.641,2.25h5.906a.987.987,0,0,1,.984.984h0a.987.987,0,0,1-.984.984H13.359a.987.987,0,0,1-.984-.984h0A.987.987,0,0,1,13.359,7.875Zm0,11.25H23.766a.987.987,0,0,1,.984.984h0a.987.987,0,0,1-.984.984H13.359a.987.987,0,0,1-.984-.984h0A.987.987,0,0,1,13.359,19.125Zm13.781,7.594H13.359a.987.987,0,0,1-.984-.984h0a.987.987,0,0,1,.984-.984H27.141a.987.987,0,0,1,.984.984h0A.987.987,0,0,1,27.141,26.719Zm0-11.25H13.359a.987.987,0,0,1-.984-.984h0a.987.987,0,0,1,.984-.984H27.141a.987.987,0,0,1,.984.984h0A.987.987,0,0,1,27.141,15.469Z" transform="translate(275.5 582)" fill="#fff"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,10 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"> |
|||
<g id="Group_1609" data-name="Group 1609" transform="translate(-309 -27)"> |
|||
<circle id="Ellipse_368" data-name="Ellipse 368" cx="20" cy="20" r="20" transform="translate(309 27)" fill="#8d95ab"/> |
|||
<g id="Group_1608" data-name="Group 1608" transform="translate(326.647 37.295)"> |
|||
<circle id="Ellipse_172" data-name="Ellipse 172" cx="2.353" cy="2.353" r="2.353" transform="translate(0 0)" fill="#e7e7f5"/> |
|||
<circle id="Ellipse_173" data-name="Ellipse 173" cx="2.353" cy="2.353" r="2.353" transform="translate(0 7.059)" fill="#e7e7f5"/> |
|||
<circle id="Ellipse_174" data-name="Ellipse 174" cx="2.353" cy="2.353" r="2.353" transform="translate(0 14.118)" fill="#e7e7f5"/> |
|||
</g> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,3 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"> |
|||
<path id="Icon_awesome-phone-alt" data-name="Icon awesome-phone-alt" d="M19.429,14.133l-4.375-1.875a.937.937,0,0,0-1.094.27l-1.937,2.367A14.479,14.479,0,0,1,5.1,7.973L7.469,6.036a.935.935,0,0,0,.27-1.094L5.863.567A.944.944,0,0,0,4.789.024L.727.962A.937.937,0,0,0,0,1.875,18.123,18.123,0,0,0,18.125,20a.937.937,0,0,0,.914-.727l.937-4.062a.949.949,0,0,0-.547-1.078Z" transform="translate(0 0)" fill="#404966"/> |
|||
</svg> |
@ -0,0 +1,9 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"> |
|||
<g id="Group_1610" data-name="Group 1610" transform="translate(-261 -27)"> |
|||
<circle id="Ellipse_369" data-name="Ellipse 369" cx="20" cy="20" r="20" transform="translate(261 27)" fill="#8d95ab"/> |
|||
<g id="Icon_feather-search" data-name="Icon feather-search" transform="translate(272.526 38.761)"> |
|||
<path id="Path_177" data-name="Path 177" d="M19.146,11.823A7.323,7.323,0,1,1,11.823,4.5,7.323,7.323,0,0,1,19.146,11.823Z" transform="translate(-4.5 -4.5)" fill="none" stroke="#e7e7f5" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/> |
|||
<path id="Path_178" data-name="Path 178" d="M28.957,28.957l-3.982-3.982" transform="translate(-12.48 -12.48)" fill="none" stroke="#e7e7f5" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/> |
|||
</g> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="18.27" height="18.27" viewBox="0 0 18.27 18.27"> |
|||
<g id="Icon_feather-search" data-name="Icon feather-search" transform="translate(1 1)"> |
|||
<path id="Path_177" data-name="Path 177" d="M18.594,11.547A7.047,7.047,0,1,1,11.547,4.5,7.047,7.047,0,0,1,18.594,11.547Z" transform="translate(-4.5 -4.5)" fill="none" stroke="#636e88" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/> |
|||
<path id="Path_178" data-name="Path 178" d="M28.807,28.807l-3.832-3.832" transform="translate(-12.951 -12.951)" fill="none" stroke="#636e88" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="37.42" height="35.482" viewBox="0 0 37.42 35.482"> |
|||
<g id="Group_1607" data-name="Group 1607" transform="translate(-168.79 -582)"> |
|||
<path id="Icon_simple-hipchat" data-name="Icon simple-hipchat" d="M30.772,29.665s.161-.114.416-.309A15.246,15.246,0,0,0,37.42,17.321c0-8.911-8.377-16.14-18.705-16.14S0,8.41,0,17.321,8.374,33.468,18.707,33.468a21.456,21.456,0,0,0,3.935-.355l.409-.07a19.473,19.473,0,0,0,9.8,3.1,1,1,0,0,0,.861-1.721,18.937,18.937,0,0,1-2.944-4.759Z" transform="translate(168.79 581.337)" fill="#fff"/> |
|||
<text id="_" data-name="?" transform="translate(188 607)" fill="#00845c" font-size="23" font-family="SegoeUI, Segoe UI"><tspan x="-5.155" y="0">?</tspan></text> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="34.875" height="34.875" viewBox="0 0 34.875 34.875"> |
|||
<g id="Group_1603" data-name="Group 1603" transform="translate(-64.563 -692.967)"> |
|||
<rect id="Rectangle_3544" data-name="Rectangle 3544" width="21" height="21" transform="translate(73 700)" fill="#00845c"/> |
|||
<path id="Icon_awesome-play-circle" data-name="Icon awesome-play-circle" d="M18,.563A17.438,17.438,0,1,0,35.438,18,17.434,17.434,0,0,0,18,.563Zm8.135,19.125-12.375,7.1a1.691,1.691,0,0,1-2.51-1.477V10.688a1.692,1.692,0,0,1,2.51-1.477l12.375,7.523A1.693,1.693,0,0,1,26.135,19.688Z" transform="translate(64 692.404)" fill="#fff"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,6 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="33" height="35.135" viewBox="0 0 33 35.135"> |
|||
<g id="Group_1605" data-name="Group 1605" transform="translate(-278.291 -687.903)"> |
|||
<path id="Icon_awesome-star" data-name="Icon awesome-star" d="M15.465,1.045,11.63,8.82,3.05,10.071a1.88,1.88,0,0,0-1.039,3.206l6.207,6.049L6.75,27.871A1.878,1.878,0,0,0,9.475,29.85l7.675-4.034,7.675,4.034a1.88,1.88,0,0,0,2.725-1.979l-1.468-8.544,6.207-6.049a1.88,1.88,0,0,0-1.039-3.206L22.671,8.82,18.836,1.045a1.881,1.881,0,0,0-3.371,0Z" transform="translate(276.85 692.968)" fill="#fff"/> |
|||
<path id="Icon_awesome-star-2" data-name="Icon awesome-star" d="M6.165.351,4.873,2.97l-2.89.421a.633.633,0,0,0-.35,1.08L3.724,6.509,3.229,9.387a.633.633,0,0,0,.918.667L6.732,8.694l2.585,1.359a.633.633,0,0,0,.918-.667L9.741,6.509l2.091-2.037a.633.633,0,0,0-.35-1.08L8.592,2.97,7.3.351a.633.633,0,0,0-1.135,0Z" transform="translate(299.268 687.904)" fill="#00845c"/> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
@ -0,0 +1,17 @@ |
|||
{ |
|||
"criticism_of_ideas": "Criticism of ideas", |
|||
"doubts": "Doubts", |
|||
"forbidden": "Forbidden", |
|||
"video": "Video", |
|||
"news": "News", |
|||
"specials": "Specials", |
|||
"search_term": "Search term", |
|||
"main_header_text": "Saint comprehensive portal", |
|||
"second_header_text": "A description of the unanalyzed history of Islam", |
|||
"more_about_us": "Get to know us more", |
|||
"main_target": "Our main goal", |
|||
"contact_to_us": "Contact us", |
|||
"send_message_to_us": "Send us a message", |
|||
"send_message": "Write your message", |
|||
"send": "Send" |
|||
} |
@ -0,0 +1,17 @@ |
|||
{ |
|||
"criticism_of_ideas": "نقد عقاید", |
|||
"doubts": "شبهات", |
|||
"forbidden": "مطاعن", |
|||
"video": "ویدئو", |
|||
"news": "اخبار", |
|||
"specials": "ویژه\u200Cها", |
|||
"search_term": "...جستجوی عبارت", |
|||
"main_header_text": "پرتال جامع سنت", |
|||
"second_header_text": " شرحی بر تاریـــخ تحلیل نشــده اســــلام", |
|||
"more_about_us": "با ما بیشتر آشنا شوید", |
|||
"main_target": "هدف اصلی ما", |
|||
"contact_to_us": "ارتباط با ما", |
|||
"send_message_to_us": "ارسال پیام به ما", |
|||
"send_message": "پیام خود را بنویسید", |
|||
"send": "ارسال" |
|||
} |
@ -0,0 +1,2 @@ |
|||
نقل است که هنگام بیعت با ابوبکر در سقیفه نزدیک بود سعدبنعباده کشته شود و به نقل بخاری به سوی سعد هجوم برده میشود.در این هنگام یکی از یاران سعد میگوید: «مراقب سعد باشید که لهش نکنید!(به نقل بخاری: سعد را کشتید!)»و عمر میگوید: «او را بکشید، خدا او را بکشد!» به نقل طبری عمر بالای سر سعد میایستد و میگوید: «سعیداشتم آنگونه تو را لهکنم که اعضایت از هم بپاشد!» و سعد ریش عمر را میگیرد و میگوید:« اگر فقط یک مو از ریشم بکَنی، برنمیگردی مگراینکه دندان سالم در دهانت نیست!» و بعدمیگوید: «(اگر میتوانستم) تو را به همان قومی که درمیانشان بودی و تبعیّتمیکردی امّا موردتبعیّت نبودی، ملحقمیکردم.» پس از آن حباببنمنذر روبه انصار میگوید: «اگر بخواهیم اینها را از مدینه بیرون میکنیم.» عمر پاسخمیدهد: «در آن صورت خدا تو را بکشد.» |
|||
و حباببنمنذر هم در جواب او میگوید: «بلکه خودت کشتهشوی!» |
@ -0,0 +1,47 @@ |
|||
# Miscellaneous |
|||
*.class |
|||
*.log |
|||
*.pyc |
|||
*.swp |
|||
.DS_Store |
|||
.atom/ |
|||
.buildlog/ |
|||
.history |
|||
.svn/ |
|||
migrate_working_dir/ |
|||
|
|||
# IntelliJ related |
|||
*.iml |
|||
*.ipr |
|||
*.iws |
|||
.idea/ |
|||
|
|||
# The .vscode folder contains launch configuration and tasks you configure in |
|||
# VS Code which you may wish to be included in version control, so this line |
|||
# is commented out by default. |
|||
#.vscode/ |
|||
|
|||
# Flutter/Dart/Pub related |
|||
**/doc/api/ |
|||
**/ios/Flutter/.last_build_id |
|||
.dart_tool/ |
|||
.flutter-plugins |
|||
.flutter-plugins-dependencies |
|||
.packages |
|||
.pub-cache/ |
|||
.pub/ |
|||
/build/ |
|||
|
|||
# Web related |
|||
lib/generated_plugin_registrant.dart |
|||
|
|||
# Symbolication related |
|||
app.*.symbols |
|||
|
|||
# Obfuscation related |
|||
app.*.map.json |
|||
|
|||
# Android Studio will place build artifacts here |
|||
/android/app/debug |
|||
/android/app/profile |
|||
/android/app/release |
@ -0,0 +1,45 @@ |
|||
# This file tracks properties of this Flutter project. |
|||
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
|||
# |
|||
# This file should be version controlled. |
|||
|
|||
version: |
|||
revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
channel: stable |
|||
|
|||
project_type: app |
|||
|
|||
# Tracks metadata for the flutter migrate command |
|||
migration: |
|||
platforms: |
|||
- platform: root |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: android |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: ios |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: linux |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: macos |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: web |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
- platform: windows |
|||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
|
|||
# User provided section |
|||
|
|||
# List of Local paths (relative to this file) that should be |
|||
# ignored by the migrate tool. |
|||
# |
|||
# Files that are not part of the templates will be ignored by default. |
|||
unmanaged_files: |
|||
- 'lib/main.dart' |
|||
- 'ios/Runner.xcodeproj/project.pbxproj' |
@ -0,0 +1,16 @@ |
|||
# local_db_core |
|||
|
|||
A new Flutter project. |
|||
|
|||
## Getting Started |
|||
|
|||
This project is a starting point for a Flutter application. |
|||
|
|||
A few resources to get you started if this is your first Flutter project: |
|||
|
|||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) |
|||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) |
|||
|
|||
For help getting started with Flutter development, view the |
|||
[online documentation](https://docs.flutter.dev/), which offers tutorials, |
|||
samples, guidance on mobile development, and a full API reference. |
@ -0,0 +1,29 @@ |
|||
# This file configures the analyzer, which statically analyzes Dart code to |
|||
# check for errors, warnings, and lints. |
|||
# |
|||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled |
|||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be |
|||
# invoked from the command line by running `flutter analyze`. |
|||
|
|||
# The following line activates a set of recommended lints for Flutter apps, |
|||
# packages, and plugins designed to encourage good coding practices. |
|||
include: package:flutter_lints/flutter.yaml |
|||
|
|||
linter: |
|||
# The lint rules applied to this project can be customized in the |
|||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` |
|||
# included above or to enable additional rules. A list of all available lints |
|||
# and their documentation is published at |
|||
# https://dart-lang.github.io/linter/lints/index.html. |
|||
# |
|||
# Instead of disabling a lint rule for the entire project in the |
|||
# section below, it can also be suppressed for a single line of code |
|||
# or a specific dart file by using the `// ignore: name_of_lint` and |
|||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file |
|||
# producing the lint. |
|||
rules: |
|||
# avoid_print: false # Uncomment to disable the `avoid_print` rule |
|||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule |
|||
|
|||
# Additional information about this file can be found at |
|||
# https://dart.dev/guides/language/analysis-options |
@ -0,0 +1,66 @@ |
|||
import 'package:hive/hive.dart'; |
|||
import 'package:local_db_core/lib/boxes/box_list/setting_box/box_keys.dart'; |
|||
import 'package:local_db_core/lib/boxes/interfaces/config_box_interface.dart'; |
|||
import 'package:repositories/app_setting_box_domain/model/user_data_model.dart'; |
|||
|
|||
class AppSettingBox implements ConfigBoxInterface<BoxKeys> { |
|||
Box? _box; |
|||
|
|||
AppSettingBox.privateConstructor(); |
|||
|
|||
static final AppSettingBox instance = AppSettingBox.privateConstructor(); |
|||
|
|||
factory AppSettingBox() { |
|||
return instance; |
|||
} |
|||
|
|||
@override |
|||
String getBoxName() { |
|||
return "appSetting"; |
|||
} |
|||
|
|||
@override |
|||
String getKeyName(BoxKeys key) { |
|||
return key.value; |
|||
} |
|||
|
|||
@override |
|||
Future<void> openBox() async { |
|||
_box = await Hive.openBox(getBoxName()); |
|||
initialFirstData(); |
|||
} |
|||
|
|||
@override |
|||
void initialFirstData() {} |
|||
|
|||
void setAppDirection(String value) { |
|||
_box?.put(getKeyName(BoxKeys.appDirection), value); |
|||
} |
|||
|
|||
String? getAppDirection() { |
|||
return _box?.get(getKeyName(BoxKeys.appDirection)); |
|||
} |
|||
|
|||
String? getCurrentLanguage() { |
|||
return _box?.get(getKeyName(BoxKeys.currentLanguage)); |
|||
} |
|||
|
|||
Future<void> setCurrentLanguage(String language) async { |
|||
await _box?.put(getKeyName(BoxKeys.currentLanguage), language); |
|||
} |
|||
|
|||
Future<UserDataModel?> getUserData() async { |
|||
if(!Hive.isBoxOpen(getBoxName())) { |
|||
await Hive.openBox(getBoxName()); |
|||
} |
|||
Map<dynamic, dynamic>? data = await _box!.get(getKeyName(BoxKeys.userData)); |
|||
if (data == null) { |
|||
return null; |
|||
} |
|||
return UserDataModel.fromJson(data); |
|||
} |
|||
|
|||
Future<void> setUserData(Map<String, dynamic> data) async { |
|||
await _box!.put(getKeyName(BoxKeys.userData), data); |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
enum BoxKeys { |
|||
currentLanguage("current-language"), |
|||
userData('user-data'), |
|||
appDirection("app-direction"); |
|||
|
|||
final String value; |
|||
|
|||
const BoxKeys(this.value); |
|||
} |
@ -0,0 +1,7 @@ |
|||
abstract class BaseBoxInterface<T> { |
|||
String getBoxName(); |
|||
|
|||
String getKeyName(T key); |
|||
|
|||
Future<void> openBox(); |
|||
} |
@ -0,0 +1,5 @@ |
|||
import 'package:local_db_core/lib/boxes/interfaces/base_box_interface.dart'; |
|||
|
|||
abstract class ConfigBoxInterface<T> implements BaseBoxInterface<T> { |
|||
void initialFirstData(); |
|||
} |
@ -0,0 +1,340 @@ |
|||
# Generated by pub |
|||
# See https://dart.dev/tools/pub/glossary#lockfile |
|||
packages: |
|||
async: |
|||
dependency: transitive |
|||
description: |
|||
name: async |
|||
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.11.0" |
|||
boolean_selector: |
|||
dependency: transitive |
|||
description: |
|||
name: boolean_selector |
|||
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.1" |
|||
characters: |
|||
dependency: transitive |
|||
description: |
|||
name: characters |
|||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.3.0" |
|||
clock: |
|||
dependency: transitive |
|||
description: |
|||
name: clock |
|||
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.1.1" |
|||
collection: |
|||
dependency: transitive |
|||
description: |
|||
name: collection |
|||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.17.1" |
|||
crypto: |
|||
dependency: transitive |
|||
description: |
|||
name: crypto |
|||
sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "3.0.2" |
|||
cupertino_icons: |
|||
dependency: "direct main" |
|||
description: |
|||
name: cupertino_icons |
|||
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.0.5" |
|||
fake_async: |
|||
dependency: transitive |
|||
description: |
|||
name: fake_async |
|||
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.3.1" |
|||
ffi: |
|||
dependency: transitive |
|||
description: |
|||
name: ffi |
|||
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.1" |
|||
file: |
|||
dependency: transitive |
|||
description: |
|||
name: file |
|||
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "6.1.4" |
|||
flutter: |
|||
dependency: "direct main" |
|||
description: flutter |
|||
source: sdk |
|||
version: "0.0.0" |
|||
flutter_lints: |
|||
dependency: "direct dev" |
|||
description: |
|||
name: flutter_lints |
|||
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.1" |
|||
flutter_test: |
|||
dependency: "direct dev" |
|||
description: flutter |
|||
source: sdk |
|||
version: "0.0.0" |
|||
hive: |
|||
dependency: "direct main" |
|||
description: |
|||
name: hive |
|||
sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.2.3" |
|||
hive_flutter: |
|||
dependency: "direct main" |
|||
description: |
|||
name: hive_flutter |
|||
sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.1.0" |
|||
js: |
|||
dependency: transitive |
|||
description: |
|||
name: js |
|||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "0.6.7" |
|||
lints: |
|||
dependency: transitive |
|||
description: |
|||
name: lints |
|||
sha256: "5e4a9cd06d447758280a8ac2405101e0e2094d2a1dbdd3756aec3fe7775ba593" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.1" |
|||
matcher: |
|||
dependency: transitive |
|||
description: |
|||
name: matcher |
|||
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "0.12.15" |
|||
material_color_utilities: |
|||
dependency: transitive |
|||
description: |
|||
name: material_color_utilities |
|||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "0.2.0" |
|||
meta: |
|||
dependency: transitive |
|||
description: |
|||
name: meta |
|||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.9.1" |
|||
path: |
|||
dependency: transitive |
|||
description: |
|||
name: path |
|||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.8.3" |
|||
path_provider: |
|||
dependency: "direct main" |
|||
description: |
|||
name: path_provider |
|||
sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.11" |
|||
path_provider_android: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_android |
|||
sha256: "1dab723dd8feeb80afb39c7be894f09df1457243d930010f6f328fb8c660c5e1" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.21" |
|||
path_provider_ios: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_ios |
|||
sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.11" |
|||
path_provider_linux: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_linux |
|||
sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.7" |
|||
path_provider_macos: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_macos |
|||
sha256: "2a97e7fbb7ae9dcd0dfc1220a78e9ec3e71da691912e617e8715ff2a13086ae8" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.6" |
|||
path_provider_platform_interface: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_platform_interface |
|||
sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.0.5" |
|||
path_provider_windows: |
|||
dependency: transitive |
|||
description: |
|||
name: path_provider_windows |
|||
sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.3" |
|||
platform: |
|||
dependency: transitive |
|||
description: |
|||
name: platform |
|||
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "3.1.0" |
|||
plugin_platform_interface: |
|||
dependency: transitive |
|||
description: |
|||
name: plugin_platform_interface |
|||
sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.3" |
|||
process: |
|||
dependency: transitive |
|||
description: |
|||
name: process |
|||
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "4.2.4" |
|||
repositories: |
|||
dependency: "direct main" |
|||
description: |
|||
path: "../../../../domain/repositories" |
|||
relative: true |
|||
source: path |
|||
version: "0.0.1" |
|||
sky_engine: |
|||
dependency: transitive |
|||
description: flutter |
|||
source: sdk |
|||
version: "0.0.99" |
|||
source_span: |
|||
dependency: transitive |
|||
description: |
|||
name: source_span |
|||
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.9.1" |
|||
stack_trace: |
|||
dependency: transitive |
|||
description: |
|||
name: stack_trace |
|||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.11.0" |
|||
stream_channel: |
|||
dependency: transitive |
|||
description: |
|||
name: stream_channel |
|||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.1" |
|||
string_scanner: |
|||
dependency: transitive |
|||
description: |
|||
name: string_scanner |
|||
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.2.0" |
|||
term_glyph: |
|||
dependency: transitive |
|||
description: |
|||
name: term_glyph |
|||
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.2.1" |
|||
test_api: |
|||
dependency: transitive |
|||
description: |
|||
name: test_api |
|||
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "0.5.1" |
|||
typed_data: |
|||
dependency: transitive |
|||
description: |
|||
name: typed_data |
|||
sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "1.3.1" |
|||
vector_math: |
|||
dependency: transitive |
|||
description: |
|||
name: vector_math |
|||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "2.1.4" |
|||
win32: |
|||
dependency: transitive |
|||
description: |
|||
name: win32 |
|||
sha256: d13ac5deea7327f027b3b97ee19ee210f68256ecf3f1a304bcfb992ee947637c |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "3.1.1" |
|||
xdg_directories: |
|||
dependency: transitive |
|||
description: |
|||
name: xdg_directories |
|||
sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f" |
|||
url: "https://pub.dev" |
|||
source: hosted |
|||
version: "0.2.0+2" |
|||
sdks: |
|||
dart: ">=3.0.0-0 <4.0.0" |
|||
flutter: ">=3.0.0" |
@ -0,0 +1,23 @@ |
|||
name: local_db_core |
|||
description: A new Flutter project. |
|||
version: 1.0.0+1 |
|||
publish_to: 'none' |
|||
|
|||
environment: |
|||
sdk: ">=2.17.6 <3.0.0" |
|||
dependencies: |
|||
flutter: |
|||
sdk: flutter |
|||
cupertino_icons: ^1.0.2 |
|||
hive: ^2.0.5 |
|||
hive_flutter: ^1.1.0 |
|||
path_provider: ^2.0.11 |
|||
repositories: |
|||
path: ../../../../domain/repositories |
|||
|
|||
dev_dependencies: |
|||
flutter_test: |
|||
sdk: flutter |
|||
flutter_lints: ^2.0.0 |
|||
flutter: |
|||
uses-material-design: true |
@ -0,0 +1,10 @@ |
|||
import 'package:flutter_test/flutter_test.dart'; |
|||
|
|||
void main() { |
|||
test('adds one to input values', () { |
|||
// final calculator = Calculator(); |
|||
// expect(calculator.addOne(2), 3); |
|||
// expect(calculator.addOne(-7), -6); |
|||
// expect(calculator.addOne(0), 1); |
|||
}); |
|||
} |
@ -0,0 +1,30 @@ |
|||
# Miscellaneous |
|||
*.class |
|||
*.log |
|||
*.pyc |
|||
*.swp |
|||
.DS_Store |
|||
.atom/ |
|||
.buildlog/ |
|||
.history |
|||
.svn/ |
|||
migrate_working_dir/ |
|||
|
|||
# IntelliJ related |
|||
*.iml |
|||
*.ipr |
|||
*.iws |
|||
.idea/ |
|||
|
|||
# The .vscode folder contains launch configuration and tasks you configure in |
|||
# VS Code which you may wish to be included in version control, so this line |
|||
# is commented out by default. |
|||
#.vscode/ |
|||
|
|||
# Flutter/Dart/Pub related |
|||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
|||
/pubspec.lock |
|||
**/doc/api/ |
|||
.dart_tool/ |
|||
.packages |
|||
build/ |
@ -0,0 +1,10 @@ |
|||
# This file tracks properties of this Flutter project. |
|||
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
|||
# |
|||
# This file should be version controlled and should not be manually edited. |
|||
|
|||
version: |
|||
revision: f1875d570e39de09040c8f79aa13cc56baab8db1 |
|||
channel: stable |
|||
|
|||
project_type: package |
@ -0,0 +1,3 @@ |
|||
## 0.0.1 |
|||
|
|||
* TODO: Describe initial release. |
@ -0,0 +1,39 @@ |
|||
<!-- |
|||
This README describes the package. If you publish this package to pub.dev, |
|||
this README's contents appear on the landing page for your package. |
|||
|
|||
For information about how to write a good package README, see the guide for |
|||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). |
|||
|
|||
For general information about developing packages, see the Dart guide for |
|||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) |
|||
and the Flutter guide for |
|||
[developing packages and plugins](https://flutter.dev/developing-packages). |
|||
--> |
|||
|
|||
TODO: Put a short description of the package here that helps potential users |
|||
know whether this package might be useful for them. |
|||
|
|||
## Features |
|||
|
|||
TODO: List what your package can do. Maybe include images, gifs, or videos. |
|||
|
|||
## Getting started |
|||
|
|||
TODO: List prerequisites and provide or point to information on how to |
|||
start using the package. |
|||
|
|||
## Usage |
|||
|
|||
TODO: Include short and useful examples for package users. Add longer examples |
|||
to `/example` folder. |
|||
|
|||
```dart |
|||
const like = 'sample'; |
|||
``` |
|||
|
|||
## Additional information |
|||
|
|||
TODO: Tell users more about the package: where to find more information, how to |
|||
contribute to the package, how to file issues, what response they can expect |
|||
from the package authors, and more. |
@ -0,0 +1,37 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/interface/network_initializer_interface.dart'; |
|||
import 'package:network_core/network/networking/api_endpoint.dart'; |
|||
import 'package:network_core/network/networking/api_service.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
import 'package:network_core/network/networking/interceptors/api_interceptor.dart'; |
|||
|
|||
class BaseInitializer implements NetworkInitializerInterface { |
|||
factory BaseInitializer() { |
|||
return instance; |
|||
} |
|||
|
|||
BaseInitializer.privateConstructor(); |
|||
|
|||
static final BaseInitializer instance = BaseInitializer.privateConstructor(); |
|||
|
|||
@override |
|||
DioService getDioService() { |
|||
return DioService( |
|||
dioClient: getDioClient(), |
|||
interceptors: [ |
|||
ApiInterceptor(), |
|||
], |
|||
); |
|||
} |
|||
|
|||
@override |
|||
Dio getDioClient() { |
|||
final baseOptions = BaseOptions(baseUrl: ApiEndpoint.baseUrl); |
|||
return Dio(baseOptions); |
|||
} |
|||
|
|||
@override |
|||
ApiService getApiService() { |
|||
return ApiService(getDioService()); |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/interface/network_initializer_interface.dart'; |
|||
import 'package:network_core/network/networking/api_endpoint.dart'; |
|||
import 'package:network_core/network/networking/api_service.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
|
|||
class GamificationInitializer implements NetworkInitializerInterface { |
|||
factory GamificationInitializer() { |
|||
return instance; |
|||
} |
|||
|
|||
GamificationInitializer.privateConstructor(); |
|||
|
|||
static final GamificationInitializer instance = GamificationInitializer.privateConstructor(); |
|||
|
|||
@override |
|||
DioService getDioService() { |
|||
return DioService( |
|||
dioClient: getDioClient(), |
|||
interceptors: [], |
|||
); |
|||
} |
|||
|
|||
@override |
|||
Dio getDioClient() { |
|||
final baseOptions = BaseOptions(baseUrl: ApiEndpoint.gamificationBaseUrl); |
|||
return Dio(baseOptions); |
|||
} |
|||
|
|||
@override |
|||
ApiService getApiService() { |
|||
return ApiService(getDioService()); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/interface/network_initializer_interface.dart'; |
|||
import 'package:network_core/network/networking/api_endpoint.dart'; |
|||
import 'package:network_core/network/networking/api_service.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
import 'package:network_core/network/networking/interceptors/api_interceptor.dart'; |
|||
|
|||
class HamrahCloudInitializer implements NetworkInitializerInterface { |
|||
factory HamrahCloudInitializer() { |
|||
return instance; |
|||
} |
|||
|
|||
HamrahCloudInitializer.privateConstructor(); |
|||
|
|||
static final HamrahCloudInitializer instance = HamrahCloudInitializer.privateConstructor(); |
|||
|
|||
@override |
|||
DioService getDioService() { |
|||
return DioService( |
|||
dioClient: getDioClient(), |
|||
interceptors: [ |
|||
ApiInterceptor(useToken: false, addAllowMethod: false), |
|||
], |
|||
); |
|||
} |
|||
|
|||
@override |
|||
Dio getDioClient() { |
|||
final baseOptions = BaseOptions(baseUrl: ApiEndpoint.hamrahCloudBaseUrl); |
|||
return Dio(baseOptions); |
|||
} |
|||
|
|||
@override |
|||
ApiService getApiService() { |
|||
return ApiService(getDioService()); |
|||
} |
|||
} |
@ -0,0 +1,39 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/interface/network_initializer_interface.dart'; |
|||
import 'package:network_core/network/networking/api_endpoint.dart'; |
|||
import 'package:network_core/network/networking/api_service.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
import 'package:network_core/network/networking/interceptors/api_interceptor.dart'; |
|||
|
|||
class LoggerInitializer implements NetworkInitializerInterface { |
|||
factory LoggerInitializer() { |
|||
return instance; |
|||
} |
|||
|
|||
LoggerInitializer.privateConstructor(); |
|||
|
|||
static final LoggerInitializer instance = LoggerInitializer.privateConstructor(); |
|||
|
|||
@override |
|||
DioService getDioService() { |
|||
return DioService( |
|||
dioClient: getDioClient(), |
|||
interceptors: [ |
|||
ApiInterceptor(), |
|||
], |
|||
); |
|||
} |
|||
|
|||
@override |
|||
Dio getDioClient() { |
|||
final baseOptions = BaseOptions( |
|||
baseUrl: ApiEndpoint.loggerBaseUrl, |
|||
); |
|||
return Dio(baseOptions); |
|||
} |
|||
|
|||
@override |
|||
ApiService getApiService() { |
|||
return ApiService(getDioService()); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
import 'package:flutter/foundation.dart'; |
|||
|
|||
@immutable |
|||
class Config { |
|||
const Config._(); |
|||
|
|||
static const baseUrl = String.fromEnvironment('BASE_URL', defaultValue: 'https://api-game.zarebin.ir/api'); |
|||
|
|||
static const loggerBaseUrl = String.fromEnvironment( |
|||
'BASE_URL', |
|||
defaultValue: 'https://supervisor.pr.mci.dev/api/v1/', |
|||
); |
|||
|
|||
static const hamrahCloudBaseUrl = String.fromEnvironment( |
|||
'BASE_URL', |
|||
defaultValue: 'https://hamrahi.cloud/live/api/v1', |
|||
); |
|||
|
|||
static const gamificationBaseUrl = String.fromEnvironment('BASE_URL', defaultValue: 'https://eagle-eyes.st.mci.dev'); |
|||
} |
@ -0,0 +1,21 @@ |
|||
import 'package:path_provider/path_provider.dart' as pp; |
|||
|
|||
class PathProviderService { |
|||
PathProviderService._(); |
|||
|
|||
static String? _path; |
|||
|
|||
static String get path { |
|||
if (_path != null) { |
|||
return _path!; |
|||
} else { |
|||
throw Exception('Path not initialized'); |
|||
} |
|||
} |
|||
|
|||
static Future<String> init() async { |
|||
final dir = await pp.getApplicationDocumentsDirectory(); |
|||
_path = dir.path; |
|||
return _path!; |
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
import 'package:flutter/foundation.dart'; |
|||
|
|||
@immutable |
|||
class Util { |
|||
const Util._(); |
|||
|
|||
static bool boolFromInt(int i) => i == 1; |
|||
} |
@ -0,0 +1,11 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/networking/api_service.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
|
|||
abstract class NetworkInitializerInterface { |
|||
DioService getDioService(); |
|||
|
|||
Dio getDioClient(); |
|||
|
|||
ApiService getApiService(); |
|||
} |
@ -0,0 +1,140 @@ |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:network_core/network/helper/config.dart'; |
|||
|
|||
@immutable |
|||
class ApiEndpoint { |
|||
const ApiEndpoint._(); |
|||
|
|||
static const baseUrl = Config.baseUrl; |
|||
static const loggerBaseUrl = Config.loggerBaseUrl; |
|||
static const hamrahCloudBaseUrl = Config.hamrahCloudBaseUrl; |
|||
static const gamificationBaseUrl = Config.gamificationBaseUrl; |
|||
|
|||
static String account(AccountEndpoint endpoint) { |
|||
return '/account/${endpoint.value}'; |
|||
} |
|||
|
|||
static String game(GameEndpoint endpoint) { |
|||
return '/game/${endpoint.value}'; |
|||
} |
|||
|
|||
static String general(GeneralEndPoint endPoint) { |
|||
return '/general/${endPoint.value}'; |
|||
} |
|||
|
|||
static String leaderboard(LeaderboardEndpoint endpoint) { |
|||
return '/leaderboard/${endpoint.value}'; |
|||
} |
|||
|
|||
static String gamePlayer(GamePlayerEndpoint endpoint) { |
|||
return '/game-player/${endpoint.value}'; |
|||
} |
|||
|
|||
static String getFriendReq(FriendRequestEndPoint endPoint) { |
|||
return '/player/friendRequest/${endPoint.value}'; |
|||
} |
|||
|
|||
static String logger(LogEndPoint endPoint) { |
|||
return endPoint.value; |
|||
} |
|||
|
|||
static String hamrahCloud(HamrahCloudEndpoint endPoint) { |
|||
return endPoint.value; |
|||
} |
|||
|
|||
static String campaigns(CampaignsEndPoint endPoint) { |
|||
return '/api/v1/campaigns/${endPoint.value}/'; |
|||
} |
|||
} |
|||
|
|||
enum AccountEndpoint { |
|||
profile('profile'); |
|||
|
|||
final String value; |
|||
|
|||
const AccountEndpoint(this.value); |
|||
} |
|||
|
|||
enum GamePlayerEndpoint { |
|||
playerInfo('gamePlayerInfo'), |
|||
myRank('best'); |
|||
|
|||
final String value; |
|||
|
|||
const GamePlayerEndpoint(this.value); |
|||
} |
|||
|
|||
enum GameEndpoint { |
|||
banners('banners'), |
|||
categories('categories'), |
|||
favoriteGames('favorite-games'), |
|||
gameProfile('game-profile'), |
|||
games('games'), |
|||
recentPlayedGames('recent-played-games'), |
|||
search('search'), |
|||
searchHistory('search-history'), |
|||
suggestedGames('suggested-games'), |
|||
topGames('top-games'); |
|||
|
|||
final String value; |
|||
|
|||
const GameEndpoint(this.value); |
|||
} |
|||
|
|||
enum GeneralEndPoint { |
|||
streams('streams'), |
|||
whiteList('channels/whitelist'), |
|||
deepLink('deeplink'), |
|||
lv('lv'), |
|||
rootItems('root_items'); |
|||
|
|||
final String value; |
|||
|
|||
const GeneralEndPoint(this.value); |
|||
} |
|||
|
|||
enum LeaderboardEndpoint { |
|||
campaignLeaderboard('campaign-leaderboard'), |
|||
games('games'), |
|||
leaderboards('leaderboards'); |
|||
|
|||
final String value; |
|||
|
|||
const LeaderboardEndpoint(this.value); |
|||
} |
|||
|
|||
enum FriendRequestEndPoint { |
|||
createFriendReq(''), |
|||
answerFriendReq('answer'), |
|||
getWaitingAddFriendReq('waiting'); |
|||
|
|||
final String value; |
|||
|
|||
const FriendRequestEndPoint(this.value); |
|||
} |
|||
|
|||
enum LogEndPoint { |
|||
multiEvent('events'), |
|||
singleEvent('event'); |
|||
|
|||
final String value; |
|||
|
|||
const LogEndPoint(this.value); |
|||
} |
|||
|
|||
enum HamrahCloudEndpoint { |
|||
list('/vod/viewers/list-vod/'), |
|||
search('/live/search/pinobject/387/?'); |
|||
|
|||
final String value; |
|||
|
|||
const HamrahCloudEndpoint(this.value); |
|||
} |
|||
|
|||
enum CampaignsEndPoint { |
|||
events('events'); |
|||
|
|||
final String value; |
|||
|
|||
const CampaignsEndPoint(this.value); |
|||
} |
@ -0,0 +1,41 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:network_core/network/networking/response_model.dart'; |
|||
import 'package:repositories/typedefs.dart'; |
|||
|
|||
abstract class ApiInterface { |
|||
const ApiInterface(); |
|||
|
|||
Future<T> getCollectionData<T>({ |
|||
required String endpoint, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required T Function(Response responseBody) converter, |
|||
}); |
|||
|
|||
Future<T> getDocumentData<T>({ |
|||
required String endpoint, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required T Function(JSON responseBody) converter, |
|||
}); |
|||
|
|||
Future<T> setData<T>({ |
|||
required String endpoint, |
|||
required JSON data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required T Function(Response response) converter, |
|||
}); |
|||
|
|||
Future<T> deleteData<T>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required T Function(ResponseModel<JSON> response) converter, |
|||
}); |
|||
|
|||
void cancelRequests({CancelToken? cancelToken}); |
|||
} |
@ -0,0 +1,210 @@ |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; |
|||
import 'package:network_core/network/networking/api_interface.dart'; |
|||
import 'package:network_core/network/networking/custom_exception.dart'; |
|||
import 'package:network_core/network/networking/dio_service.dart'; |
|||
import 'package:network_core/network/networking/response_model.dart'; |
|||
import 'package:repositories/typedefs.dart'; |
|||
|
|||
class ApiService implements ApiInterface { |
|||
ApiService(DioService dioService) : _dioService = dioService; |
|||
late final DioService _dioService; |
|||
|
|||
@override |
|||
Future<T> getCollectionData<T>({ |
|||
required String endpoint, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
CachePolicy? cachePolicy, |
|||
int? cacheAgeDays, |
|||
bool requiresAuthToken = true, |
|||
required T Function(Response responseBody) converter, |
|||
}) async { |
|||
Response data; |
|||
try { |
|||
data = await _dioService.getData( |
|||
endpoint: endpoint, |
|||
options: Options( |
|||
extra: <String, Object?>{ |
|||
'requiresAuthToken': requiresAuthToken, |
|||
}, |
|||
), |
|||
queryParams: queryParams, |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(data); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
@override |
|||
Future<T> getDocumentData<T>({ |
|||
required String endpoint, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
CachePolicy? cachePolicy, |
|||
int? cacheAgeDays, |
|||
bool requiresAuthToken = true, |
|||
required T Function(JSON response) converter, |
|||
}) async { |
|||
Response response; |
|||
try { |
|||
response = await _dioService.get<JSON>( |
|||
endpoint: endpoint, |
|||
queryParams: queryParams, |
|||
cacheOptions: _dioService.globalCacheOptions?.copyWith( |
|||
policy: cachePolicy, |
|||
maxStale: cacheAgeDays != null ? Nullable(Duration(days: cacheAgeDays)) : null, |
|||
), |
|||
options: requiresAuthToken |
|||
? Options( |
|||
extra: <String, Object?>{'requiresAuthToken': requiresAuthToken}, |
|||
) |
|||
: null, |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(response.data); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
@override |
|||
Future<T> setData<T>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
ProgressCallback? onReceiveProgress, |
|||
JSON? queryParams, |
|||
required T Function(Response response) converter, |
|||
}) async { |
|||
Response response; |
|||
try { |
|||
response = await _dioService.post<JSON>( |
|||
endpoint: endpoint, |
|||
data: data, |
|||
queryParams: queryParams, |
|||
onReceiveProgress: onReceiveProgress, |
|||
options: Options( |
|||
extra: <String, Object?>{ |
|||
'requiresAuthToken': requiresAuthToken, |
|||
}, |
|||
), |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(response); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
Future<T> setDataWithListResponse<T>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
ProgressCallback? onReceiveProgress, |
|||
JSON? queryParams, |
|||
required T Function(Response response) converter, |
|||
}) async { |
|||
Response response; |
|||
try { |
|||
response = await _dioService.post<List<dynamic>>( |
|||
endpoint: endpoint, |
|||
data: data, |
|||
queryParams: queryParams, |
|||
onReceiveProgress: onReceiveProgress, |
|||
options: Options( |
|||
extra: <String, Object?>{ |
|||
'requiresAuthToken': requiresAuthToken, |
|||
}, |
|||
), |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(response); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
Future<void> updateData({ |
|||
required String endpoint, |
|||
required JSON data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required Function() converter, |
|||
}) async { |
|||
try { |
|||
await _dioService.patchData( |
|||
endpoint: endpoint, |
|||
data: data, |
|||
options: Options( |
|||
extra: <String, Object?>{ |
|||
'requiresAuthToken': requiresAuthToken, |
|||
}, |
|||
), |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
@override |
|||
Future<T> deleteData<T>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
CancelToken? cancelToken, |
|||
bool requiresAuthToken = true, |
|||
required T Function(ResponseModel<JSON> response) converter, |
|||
}) async { |
|||
ResponseModel<JSON> response; |
|||
try { |
|||
response = await _dioService.delete<JSON>( |
|||
endpoint: endpoint, |
|||
data: data, |
|||
options: Options( |
|||
extra: <String, Object?>{ |
|||
'requiresAuthToken': requiresAuthToken, |
|||
}, |
|||
), |
|||
cancelToken: cancelToken, |
|||
); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromDioException(ex); |
|||
} |
|||
try { |
|||
return converter(response); |
|||
} on Exception catch (ex) { |
|||
throw CustomException.fromParsingException(ex); |
|||
} |
|||
} |
|||
|
|||
@override |
|||
void cancelRequests({CancelToken? cancelToken}) { |
|||
_dioService.cancelRequests(cancelToken: cancelToken); |
|||
} |
|||
} |
@ -0,0 +1,111 @@ |
|||
import 'package:dio/dio.dart'; |
|||
|
|||
enum ExceptionType { |
|||
tokenExpiredException, |
|||
cancelException, |
|||
connectTimeoutException, |
|||
sendTimeoutException, |
|||
receiveTimeoutException, |
|||
socketException, |
|||
fetchDataException, |
|||
formatException, |
|||
unrecognizedException, |
|||
apiException, |
|||
serializationException, |
|||
} |
|||
|
|||
class CustomException implements Exception { |
|||
CustomException({ |
|||
this.code, |
|||
int? statusCode, |
|||
required this.message, |
|||
this.exceptionType = ExceptionType.apiException, |
|||
String? apiPath, |
|||
}) : statusCode = statusCode ?? 500, |
|||
apiPath = apiPath ?? '', |
|||
name = exceptionType.name; |
|||
|
|||
factory CustomException.fromDioException(Exception error) { |
|||
try { |
|||
if (error is DioError) { |
|||
switch (error.type) { |
|||
case DioErrorType.cancel: |
|||
return CustomException( |
|||
exceptionType: ExceptionType.cancelException, |
|||
statusCode: error.response?.statusCode, |
|||
message: 'Request cancelled prematurely', |
|||
); |
|||
case DioErrorType.connectTimeout: |
|||
return CustomException( |
|||
exceptionType: ExceptionType.connectTimeoutException, |
|||
statusCode: error.response?.statusCode, |
|||
message: 'Connection not established', |
|||
); |
|||
case DioErrorType.sendTimeout: |
|||
return CustomException( |
|||
exceptionType: ExceptionType.sendTimeoutException, |
|||
statusCode: error.response?.statusCode, |
|||
message: 'Failed to send', |
|||
); |
|||
case DioErrorType.receiveTimeout: |
|||
return CustomException( |
|||
exceptionType: ExceptionType.receiveTimeoutException, |
|||
statusCode: error.response?.statusCode, |
|||
message: 'Failed to receive', |
|||
); |
|||
case DioErrorType.response: |
|||
case DioErrorType.other: |
|||
if (error.response != null) { |
|||
if (error.response?.data != null) { |
|||
return CustomException( |
|||
exceptionType: ExceptionType.apiException, |
|||
statusCode: error.response?.statusCode, |
|||
message: error.response?.data.toString() ?? '', |
|||
apiPath: error.requestOptions.baseUrl + error.requestOptions.path, |
|||
); |
|||
} |
|||
return CustomException( |
|||
exceptionType: ExceptionType.apiException, |
|||
statusCode: error.response?.statusCode, |
|||
message: '', |
|||
); |
|||
} |
|||
return CustomException( |
|||
exceptionType: ExceptionType.apiException, |
|||
statusCode: error.response?.statusCode, |
|||
message: '', |
|||
); |
|||
} |
|||
} else { |
|||
return CustomException( |
|||
exceptionType: ExceptionType.unrecognizedException, |
|||
message: 'Error unrecognized', |
|||
); |
|||
} |
|||
} on FormatException catch (e) { |
|||
return CustomException( |
|||
exceptionType: ExceptionType.formatException, |
|||
message: e.message, |
|||
); |
|||
} on Exception catch (_) { |
|||
return CustomException( |
|||
exceptionType: ExceptionType.unrecognizedException, |
|||
message: 'Error unrecognized', |
|||
); |
|||
} |
|||
} |
|||
|
|||
factory CustomException.fromParsingException(Exception error) { |
|||
return CustomException( |
|||
exceptionType: ExceptionType.serializationException, |
|||
message: 'Failed to parse network response to model or vice versa', |
|||
); |
|||
} |
|||
|
|||
final String name; |
|||
String message; |
|||
final String? code; |
|||
final int? statusCode; |
|||
final ExceptionType exceptionType; |
|||
String? apiPath; |
|||
} |
@ -0,0 +1,203 @@ |
|||
import 'dart:async'; |
|||
|
|||
import 'package:dio/dio.dart'; |
|||
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; |
|||
import 'package:network_core/network/networking/response_model.dart'; |
|||
import 'package:repositories/typedefs.dart'; |
|||
|
|||
class DioService { |
|||
DioService({ |
|||
required Dio dioClient, |
|||
this.globalCacheOptions, |
|||
Iterable<Interceptor>? interceptors, |
|||
HttpClientAdapter? httpClientAdapter, |
|||
}) : _dio = dioClient, |
|||
_cancelToken = CancelToken() { |
|||
if (interceptors != null) { |
|||
_dio.interceptors.addAll(interceptors); |
|||
} |
|||
if (httpClientAdapter != null) { |
|||
_dio.httpClientAdapter = httpClientAdapter; |
|||
} |
|||
} |
|||
|
|||
final Dio _dio; |
|||
final CacheOptions? globalCacheOptions; |
|||
final CancelToken _cancelToken; |
|||
|
|||
void cancelRequests({CancelToken? cancelToken}) { |
|||
if (cancelToken == null) { |
|||
_cancelToken.cancel('Cancelled'); |
|||
} else { |
|||
cancelToken.cancel(); |
|||
} |
|||
} |
|||
|
|||
Future<Response> get<R>({ |
|||
required String endpoint, |
|||
JSON? queryParams, |
|||
Options? options, |
|||
CacheOptions? cacheOptions, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.get<JSON>( |
|||
endpoint, |
|||
queryParameters: queryParams, |
|||
options: _mergeDioAndCacheOptions( |
|||
dioOptions: options, |
|||
cacheOptions: cacheOptions, |
|||
), |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> getData({ |
|||
required String endpoint, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
JSON? queryParams, |
|||
}) async { |
|||
final response = await _dio.get( |
|||
endpoint, |
|||
queryParameters: queryParams, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> post<R>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
Options? options, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
ProgressCallback? onReceiveProgress, |
|||
}) async { |
|||
final response = await _dio.post<R>( |
|||
endpoint, |
|||
data: data, |
|||
options: options, |
|||
queryParameters: queryParams, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
onReceiveProgress: onReceiveProgress, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> upload<R>({ |
|||
required String endpoint, |
|||
required FormData data, |
|||
Options? options, |
|||
JSON? queryParams, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.post( |
|||
endpoint, |
|||
queryParameters: queryParams, |
|||
data: data, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> postData({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
JSON? queryParams, |
|||
}) async { |
|||
final response = await _dio.post( |
|||
endpoint, |
|||
data: data, |
|||
queryParameters: queryParams, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> postDataWithParams({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
JSON? queryParams, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.post( |
|||
endpoint, |
|||
data: data, |
|||
queryParameters: queryParams, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<Response> patchData({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.patch( |
|||
endpoint, |
|||
data: data, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return response; |
|||
} |
|||
|
|||
Future<ResponseModel<R>> patch<R>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.patch<JSON>( |
|||
endpoint, |
|||
data: data, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return ResponseModel<R>.fromJson(response.data!); |
|||
} |
|||
|
|||
Future<ResponseModel<R>> delete<R>({ |
|||
required String endpoint, |
|||
JSON? data, |
|||
Options? options, |
|||
CancelToken? cancelToken, |
|||
}) async { |
|||
final response = await _dio.delete<JSON>( |
|||
endpoint, |
|||
data: data, |
|||
options: options, |
|||
cancelToken: cancelToken ?? _cancelToken, |
|||
); |
|||
return ResponseModel<R>.fromJson(response.data!); |
|||
} |
|||
|
|||
Options? _mergeDioAndCacheOptions({ |
|||
Options? dioOptions, |
|||
CacheOptions? cacheOptions, |
|||
}) { |
|||
if (dioOptions == null && cacheOptions == null) { |
|||
return null; |
|||
} else if (dioOptions == null && cacheOptions != null) { |
|||
return cacheOptions.toOptions(); |
|||
} else if (dioOptions != null && cacheOptions == null) { |
|||
return dioOptions; |
|||
} |
|||
|
|||
final cacheOptionsMap = cacheOptions!.toExtra(); |
|||
final options = dioOptions!.copyWith( |
|||
extra: <String, dynamic>{...dioOptions.extra!, ...cacheOptionsMap}, |
|||
); |
|||
return options; |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
import 'package:data/app_setting_data/repository/app_setting_box_repository_impl.dart'; |
|||
import 'package:dio/dio.dart'; |
|||
import 'package:local_db_core/lib/boxes/box_list/setting_box/app_setting_box.dart'; |
|||
import 'package:repositories/app_setting_box_domain/model/user_data_model.dart'; |
|||
import 'package:repositories/app_setting_box_domain/repository/app_setting_box_repository.dart'; |
|||
|
|||
class ApiInterceptor extends Interceptor { |
|||
final bool useToken; |
|||
final bool addAllowMethod; |
|||
AppSettingBoxRepository _repository = AppSettingBoxRepositoryImpl(appSettingBox: AppSettingBox()); |
|||
|
|||
ApiInterceptor({this.useToken = true, this.addAllowMethod = true}); |
|||
|
|||
@override |
|||
Future<void> onRequest(RequestOptions options, RequestInterceptorHandler handler) async { |
|||
if (options.extra['requiresAuthToken'] == true) { |
|||
options.headers.addAll(<String, Object?>{ |
|||
'Content-Type': 'application/json', |
|||
'Accept': '*/*', |
|||
}); |
|||
if (addAllowMethod) { |
|||
options.headers.addAll(<String, Object?>{ |
|||
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, PUT, DELETE, HEAD', |
|||
'Access-Control-Allow-Origin': '*', |
|||
}); |
|||
} |
|||
UserDataModel? userData = await _repository.getUserData(); |
|||
if (useToken) { |
|||
if (userData != null) { |
|||
options.headers.addAll(<String, Object?>{ |
|||
'Authorization': 'Bearer ${userData.token}', |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
options.extra.remove('requiresAuthToken'); |
|||
return handler.next(options); |
|||
} |
|||
|
|||
@override |
|||
void onResponse(Response response, ResponseInterceptorHandler handler) { |
|||
final success = [200, 201, 202, 203, 204].contains(response.statusCode); |
|||
if (success) { |
|||
return handler.next(response); |
|||
} |
|||
return handler.reject( |
|||
DioError( |
|||
requestOptions: response.requestOptions, |
|||
response: response, |
|||
), |
|||
); |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
import 'package:repositories/typedefs.dart'; |
|||
|
|||
class ResponseModel<T> { |
|||
final T data; |
|||
String? message; |
|||
final ResponseStatus code; |
|||
|
|||
ResponseModel({ |
|||
required this.data, |
|||
required this.code, |
|||
this.message, |
|||
}); |
|||
|
|||
factory ResponseModel.fromJson(JSON json) { |
|||
return ResponseModel( |
|||
data: json['data'], |
|||
code: json['status'] == 'success' ? ResponseStatus.success : ResponseStatus.failure, |
|||
); |
|||
} |
|||
} |
|||
|
|||
enum ResponseStatus { |
|||
success('success'), |
|||
failure('failure'); |
|||
|
|||
final String value; |
|||
|
|||
const ResponseStatus(this.value); |
|||
} |
|||
|
|||
class ResponseListModel<T> { |
|||
final List<T> data; |
|||
String? message; |
|||
final ResponseStatus code; |
|||
|
|||
ResponseListModel({ |
|||
required this.data, |
|||
required this.code, |
|||
this.message, |
|||
}); |
|||
|
|||
factory ResponseListModel.fromJson(JSON json) { |
|||
return ResponseListModel( |
|||
data: json['data'], |
|||
code: json['status'] == 'success' ? ResponseStatus.success : ResponseStatus.failure, |
|||
); |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
name: network_core |
|||
description: A new Flutter project. |
|||
version: 0.0.1 |
|||
publish_to: 'none' |
|||
|
|||
|
|||
environment: |
|||
sdk: ">=2.17.6 <3.0.0" |
|||
flutter: ">=1.17.0" |
|||
|
|||
dependencies: |
|||
flutter: |
|||
sdk: flutter |
|||
dio: ^4.0.6 |
|||
dio_cache_interceptor: ^3.3.1 |
|||
repositories: |
|||
path: ../../../../domain/repositories |
|||
local_db_core: |
|||
path: ../../../../data/data_core/local_db/local_db_core |
|||
data: |
|||
path: ../../../../data/data_types/data |
|||
|
|||
dev_dependencies: |
|||
flutter_test: |
|||
sdk: flutter |
|||
flutter: |
@ -0,0 +1,30 @@ |
|||
# Miscellaneous |
|||
*.class |
|||
*.log |
|||
*.pyc |
|||
*.swp |
|||
.DS_Store |
|||
.atom/ |
|||
.buildlog/ |
|||
.history |
|||
.svn/ |
|||
migrate_working_dir/ |
|||
|
|||
# IntelliJ related |
|||
*.iml |
|||
*.ipr |
|||
*.iws |
|||
.idea/ |
|||
|
|||
# The .vscode folder contains launch configuration and tasks you configure in |
|||
# VS Code which you may wish to be included in version control, so this line |
|||
# is commented out by default. |
|||
#.vscode/ |
|||
|
|||
# Flutter/Dart/Pub related |
|||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
|||
/pubspec.lock |
|||
**/doc/api/ |
|||
.dart_tool/ |
|||
.packages |
|||
build/ |
@ -0,0 +1,10 @@ |
|||
# This file tracks properties of this Flutter project. |
|||
# Used by Flutter tool to assess capabilities and perform upgrades etc. |
|||
# |
|||
# This file should be version controlled and should not be manually edited. |
|||
|
|||
version: |
|||
revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 |
|||
channel: stable |
|||
|
|||
project_type: package |
@ -0,0 +1,3 @@ |
|||
## 0.0.1 |
|||
|
|||
* TODO: Describe initial release. |
@ -0,0 +1,39 @@ |
|||
<!-- |
|||
This README describes the package. If you publish this package to pub.dev, |
|||
this README's contents appear on the landing page for your package. |
|||
|
|||
For information about how to write a good package README, see the guide for |
|||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). |
|||
|
|||
For general information about developing packages, see the Dart guide for |
|||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) |
|||
and the Flutter guide for |
|||
[developing packages and plugins](https://flutter.dev/developing-packages). |
|||
--> |
|||
|
|||
TODO: Put a short description of the package here that helps potential users |
|||
know whether this package might be useful for them. |
|||
|
|||
## Features |
|||
|
|||
TODO: List what your package can do. Maybe include images, gifs, or videos. |
|||
|
|||
## Getting started |
|||
|
|||
TODO: List prerequisites and provide or point to information on how to |
|||
start using the package. |
|||
|
|||
## Usage |
|||
|
|||
TODO: Include short and useful examples for package users. Add longer examples |
|||
to `/example` folder. |
|||
|
|||
```dart |
|||
const like = 'sample'; |
|||
``` |
|||
|
|||
## Additional information |
|||
|
|||
TODO: Tell users more about the package: where to find more information, how to |
|||
contribute to the package, how to file issues, what response they can expect |
|||
from the package authors, and more. |
@ -0,0 +1,102 @@ |
|||
import 'dart:convert'; |
|||
|
|||
import 'package:local_db_core/lib/boxes/box_list/setting_box/app_setting_box.dart'; |
|||
import 'package:repositories/app_setting_box_domain/model/user_data_model.dart'; |
|||
import 'package:repositories/app_setting_box_domain/repository/app_setting_box_repository.dart'; |
|||
|
|||
class AppSettingBoxRepositoryImpl extends AppSettingBoxRepository { |
|||
final AppSettingBox _appSettingBox; |
|||
|
|||
AppSettingBoxRepositoryImpl({required AppSettingBox appSettingBox}) : _appSettingBox = appSettingBox; |
|||
|
|||
@override |
|||
String? getAppDirection() { |
|||
return _appSettingBox.getAppDirection(); |
|||
} |
|||
|
|||
@override |
|||
String? getCurrentLanguage() { |
|||
return _appSettingBox.getCurrentLanguage(); |
|||
} |
|||
|
|||
@override |
|||
Future<void> setCurrentLanguage(String language) async { |
|||
await _appSettingBox.setCurrentLanguage(language); |
|||
return; |
|||
} |
|||
|
|||
@override |
|||
Future<void> openBox() async { |
|||
await _appSettingBox.openBox(); |
|||
} |
|||
|
|||
@override |
|||
void setAppDirection(String value) { |
|||
_appSettingBox.setAppDirection(value); |
|||
} |
|||
|
|||
@override |
|||
Future<UserDataModel?> getUserData() async { |
|||
return await _appSettingBox.getUserData(); |
|||
} |
|||
|
|||
@override |
|||
Future<void> setUserData(Map<String, dynamic> data) async { |
|||
return await _appSettingBox.setUserData(data); |
|||
} |
|||
|
|||
@override |
|||
Future<bool> isUserLogin() async { |
|||
return await _appSettingBox.getUserData() != null; |
|||
} |
|||
|
|||
@override |
|||
Future<String?> getUserId() async { |
|||
bool isLogin = await isUserLogin(); |
|||
if (!isLogin) { |
|||
return null; |
|||
} |
|||
UserDataModel? data = await _appSettingBox.getUserData(); |
|||
if (data == null) { |
|||
return null; |
|||
} |
|||
Map<String, dynamic> tokenData = parseJwt(data.token); |
|||
if (tokenData.containsKey('muid')) { |
|||
return tokenData['muid']; |
|||
} |
|||
if (tokenData.containsKey('data')) { |
|||
return tokenData['data']; |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
Map<String, dynamic> parseJwt(String token) { |
|||
final parts = token.split('.'); |
|||
if (parts.length != 3) { |
|||
throw Exception('invalid token'); |
|||
} |
|||
final payload = decodeBase64(parts[1]); |
|||
final payloadMap = json.decode(payload); |
|||
if (payloadMap is! Map<String, dynamic>) { |
|||
throw Exception('invalid payload'); |
|||
} |
|||
return payloadMap; |
|||
} |
|||
|
|||
String decodeBase64(String str) { |
|||
String output = str.replaceAll('-', '+').replaceAll('_', '/'); |
|||
switch (output.length % 4) { |
|||
case 0: |
|||
break; |
|||
case 2: |
|||
output += '=='; |
|||
break; |
|||
case 3: |
|||
output += '='; |
|||
break; |
|||
default: |
|||
throw Exception('Illegal base64url string!"'); |
|||
} |
|||
return utf8.decode(base64Url.decode(output)); |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
name: data |
|||
description: A new Flutter package project. |
|||
version: 0.0.1 |
|||
publish_to: 'none' |
|||
|
|||
environment: |
|||
sdk: '>=2.18.5 <3.0.0' |
|||
flutter: ">=1.17.0" |
|||
|
|||
dependencies: |
|||
flutter: |
|||
sdk: flutter |
|||
repositories: |
|||
path: ../../../domain/repositories |
|||
local_db_core: |
|||
path: ../../data_core/local_db/local_db_core |
|||
|
|||
dev_dependencies: |
|||
flutter_test: |
|||
sdk: flutter |
|||
flutter_lints: ^2.0.0 |
|||
flutter: |
@ -0,0 +1,30 @@ |
|||
# Miscellaneous |
|||
*.class |
|||
*.log |
|||
*.pyc |
|||
*.swp |
|||
.DS_Store |
|||
.atom/ |
|||
.buildlog/ |
|||
.history |
|||
.svn/ |
|||
migrate_working_dir/ |
|||
|
|||
# IntelliJ related |
|||
*.iml |
|||
*.ipr |
|||
*.iws |
|||
.idea/ |
|||
|
|||
# The .vscode folder contains launch configuration and tasks you configure in |
|||
# VS Code which you may wish to be included in version control, so this line |
|||
# is commented out by default. |
|||
#.vscode/ |
|||
|
|||
# Flutter/Dart/Pub related |
|||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
|||
/pubspec.lock |
|||
**/doc/api/ |
|||
.dart_tool/ |
|||
.packages |
|||
build/ |
@ -0,0 +1,4 @@ |
|||
include: package:flutter_lints/flutter.yaml |
|||
|
|||
# Additional information about this file can be found at |
|||
# https://dart.dev/guides/language/analysis-options |
@ -0,0 +1,13 @@ |
|||
class UserDataModel { |
|||
final String token; |
|||
|
|||
UserDataModel({required this.token}); |
|||
|
|||
Map<String, dynamic> toJson() { |
|||
return {"token": token}; |
|||
} |
|||
|
|||
factory UserDataModel.fromJson(Map<dynamic, dynamic> json) { |
|||
return UserDataModel(token: json['token']); |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
import 'package:repositories/app_setting_box_domain/model/user_data_model.dart'; |
|||
|
|||
abstract class AppSettingBoxRepository { |
|||
Future<void> openBox(); |
|||
|
|||
String? getAppDirection(); |
|||
|
|||
void setAppDirection(String value); |
|||
|
|||
String? getCurrentLanguage(); |
|||
|
|||
Future<void> setCurrentLanguage(String language); |
|||
|
|||
Future<UserDataModel?> getUserData(); |
|||
|
|||
Future<void> setUserData(Map<String,dynamic> data); |
|||
|
|||
Future<bool> isUserLogin(); |
|||
|
|||
Future<String?> getUserId(); |
|||
} |
@ -0,0 +1,6 @@ |
|||
import 'package:flutter/material.dart'; |
|||
|
|||
typedef JSON = Map<String, dynamic>; |
|||
typedef QueryParams = Map<String, String>; |
|||
typedef RouteBuilder = Widget Function(BuildContext); |
|||
typedef ItemBuilder<T> = Widget Function(BuildContext, T); |
@ -0,0 +1,17 @@ |
|||
name: repositories |
|||
description: A new Flutter project. |
|||
version: 0.0.1 |
|||
|
|||
environment: |
|||
sdk: ">=2.17.6 <3.0.0" |
|||
flutter: ">=1.17.0" |
|||
|
|||
dependencies: |
|||
flutter: |
|||
sdk: flutter |
|||
|
|||
dev_dependencies: |
|||
flutter_test: |
|||
sdk: flutter |
|||
flutter_lints: ^2.0.0 |
|||
flutter: |
@ -0,0 +1,34 @@ |
|||
**/dgph |
|||
*.mode1v3 |
|||
*.mode2v3 |
|||
*.moved-aside |
|||
*.pbxuser |
|||
*.perspectivev3 |
|||
**/*sync/ |
|||
.sconsign.dblite |
|||
.tags* |
|||
**/.vagrant/ |
|||
**/DerivedData/ |
|||
Icon? |
|||
**/Pods/ |
|||
**/.symlinks/ |
|||
profile |
|||
xcuserdata |
|||
**/.generated/ |
|||
Flutter/App.framework |
|||
Flutter/Flutter.framework |
|||
Flutter/Flutter.podspec |
|||
Flutter/Generated.xcconfig |
|||
Flutter/ephemeral/ |
|||
Flutter/app.flx |
|||
Flutter/app.zip |
|||
Flutter/flutter_assets/ |
|||
Flutter/flutter_export_environment.sh |
|||
ServiceDefinitions.json |
|||
Runner/GeneratedPluginRegistrant.* |
|||
|
|||
# Exceptions to above rules. |
|||
!default.mode1v3 |
|||
!default.mode2v3 |
|||
!default.pbxuser |
|||
!default.perspectivev3 |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|||
<plist version="1.0"> |
|||
<dict> |
|||
<key>CFBundleDevelopmentRegion</key> |
|||
<string>en</string> |
|||
<key>CFBundleExecutable</key> |
|||
<string>App</string> |
|||
<key>CFBundleIdentifier</key> |
|||
<string>io.flutter.flutter.app</string> |
|||
<key>CFBundleInfoDictionaryVersion</key> |
|||
<string>6.0</string> |
|||
<key>CFBundleName</key> |
|||
<string>App</string> |
|||
<key>CFBundlePackageType</key> |
|||
<string>FMWK</string> |
|||
<key>CFBundleShortVersionString</key> |
|||
<string>1.0</string> |
|||
<key>CFBundleSignature</key> |
|||
<string>????</string> |
|||
<key>CFBundleVersion</key> |
|||
<string>1.0</string> |
|||
<key>MinimumOSVersion</key> |
|||
<string>11.0</string> |
|||
</dict> |
|||
</plist> |