diff --git a/android/app/app/build.gradle b/android/app/app/build.gradle
deleted file mode 100644
index e6c7983..0000000
--- a/android/app/app/build.gradle
+++ /dev/null
@@ -1,94 +0,0 @@
-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"
-
-def keystoreProperties = new Properties()
-def keystorePropertiesFile = rootProject.file('key.properties')
-if (keystorePropertiesFile.exists()) {
- keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
-}
-
-android {
- compileSdkVersion 34
- ndkVersion "25.1.8937393"
-
- 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.didvan.didvanapp"
- minSdkVersion 24
- targetSdkVersion 30
- versionCode flutterVersionCode.toInteger()
- versionName flutterVersionName
- }
-
- signingConfigs {
- release {
- keyAlias keystoreProperties['keyAlias']
- keyPassword keystoreProperties['keyPassword']
- storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
- storePassword keystoreProperties['storePassword']
- }
- }
- buildTypes {
- release {
- signingConfig signingConfigs.release
- }
- }
-
- lintOptions {
- disable 'InvalidPackage'
- checkReleaseBuilds false
- }
- buildFeatures {
- viewBinding true
- }
-}
-
-flutter {
- source '../..'
-}
-
-dependencies {
- implementation platform('com.google.firebase:firebase-bom:29.1.0')
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'com.google.code.gson:gson:2.10.1'
-// implementation 'com.github.bumptech.glide:glide:4.16.0'
- implementation 'com.squareup.picasso:picasso:2.8'
- implementation 'com.android.support:cardview-v7:28.0.0'
-}
diff --git a/android/app/app/google-services.json b/android/app/app/google-services.json
deleted file mode 100644
index 5cb370e..0000000
--- a/android/app/app/google-services.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "project_info": {
- "project_number": "935017686266",
- "project_id": "didvan-9b7da",
- "storage_bucket": "didvan-9b7da.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:935017686266:android:f9cbc9aba8e3d65ed2d543",
- "android_client_info": {
- "package_name": "com.didvan.didvanapp"
- }
- },
- "oauth_client": [
- {
- "client_id": "935017686266-lebnol7rb05oi9h0mripb41c892d2gij.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyBp-UHjWeM0H0UHtX5yguFKG-riMzvvCzw"
- }
- ],
- "services": {
- "appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "935017686266-lebnol7rb05oi9h0mripb41c892d2gij.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/android/app/app/src/debug/AndroidManifest.xml b/android/app/app/src/debug/AndroidManifest.xml
deleted file mode 100644
index 06824d8..0000000
--- a/android/app/app/src/debug/AndroidManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/android/app/app/src/main/AndroidManifest.xml b/android/app/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 4450b50..0000000
--- a/android/app/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/java/com/didvan/didvanapp/FavWidget.kt b/android/app/app/src/main/java/com/didvan/didvanapp/FavWidget.kt
deleted file mode 100644
index 320b616..0000000
--- a/android/app/app/src/main/java/com/didvan/didvanapp/FavWidget.kt
+++ /dev/null
@@ -1,144 +0,0 @@
-package com.didvan.didvanapp
-
-import android.annotation.SuppressLint
-import android.appwidget.AppWidgetManager
-import android.content.Context
-import android.content.SharedPreferences
-import android.net.Uri
-import android.widget.RemoteViews
-import com.squareup.picasso.MemoryPolicy
-import com.squareup.picasso.NetworkPolicy
-import com.squareup.picasso.Picasso
-import com.squareup.picasso.Transformation
-import es.antonborri.home_widget.HomeWidgetBackgroundIntent
-import es.antonborri.home_widget.HomeWidgetLaunchIntent
-import es.antonborri.home_widget.HomeWidgetProvider
-import java.lang.Exception
-
-
-/**
- * Implementation of App Widget functionality.
- */
-class FavWidget : HomeWidgetProvider() {
-
- @SuppressLint("RemoteViewLayout")
- override fun onUpdate(
- context: Context,
- appWidgetManager: AppWidgetManager,
- appWidgetIds: IntArray,
- widgetData: SharedPreferences
- ) {
- appWidgetIds.forEach { widgetId ->
- val views = RemoteViews(context.packageName, R.layout.favourite_widget).apply {
-
- // Open App on Widget Click
- val pendingIntent = HomeWidgetLaunchIntent.getActivity(
- context,
- MainActivity::class.java
- )
- setOnClickPendingIntent(R.id.logo_btn, pendingIntent)
-
- val responses: ArrayList = ArrayList();
- val token = widgetData.getString("token", "").toString()
-
- for (i in 0..2) {
- responses.add(
- WidgetResponse(
- id = widgetData.getString("id${i + 1}", "")?.toInt() ?: 0,
- title = widgetData.getString("title${i + 1}", "").toString(),
- createdAt = widgetData.getString("createdAt${i + 1}", "").toString(),
- type = widgetData.getString("type${i + 1}", "").toString(),
- link = widgetData.getString("link${i + 1}", "").toString(),
- category = widgetData.getString("category${i + 1}", "").toString(),
- image = widgetData.getString("image${i + 1}", "").toString(),
- )
- )
- }
-
- setTextViewText(R.id.first_title, responses[0].title.toString())
- setTextViewText(R.id.middle_title, responses[1].title.toString())
- setTextViewText(R.id.last_title, responses[2].title.toString())
-//
- setTextViewText(R.id.first_tag, responses[0].category)
- setTextViewText(R.id.middle_tag, responses[1].category)
- setTextViewText(R.id.last_tag, responses[2].category)
-
- setTextViewText(R.id.first_duration, responses[0].createdAt)
- setTextViewText(R.id.middle_duration, responses[1].createdAt)
- setTextViewText(R.id.last_duration, responses[2].createdAt)
-
- try {
- Picasso.get()
- .load("https://api.didvan.app${responses[0].image}?accessToken=${token}")
- .transform(RoundedTransformation(10, 0))
- .networkPolicy(NetworkPolicy.NO_STORE)
- .memoryPolicy(MemoryPolicy.NO_STORE)
- .error(R.drawable.test)
- .resize(100,100)
- .into(this, R.id.first_image, appWidgetIds);
- } catch (e: Exception) {
-
- }
-
- try {
- Picasso.get()
- .load("https://api.didvan.app${responses[1].image}?accessToken=${token}")
- .transform(RoundedTransformation(10, 0))
- .networkPolicy(NetworkPolicy.NO_STORE)
- .memoryPolicy(MemoryPolicy.NO_STORE)
- .error(R.drawable.test)
- .resize(100,100)
- .into(this, R.id.middle_image, appWidgetIds);
- } catch (e: Exception) {
-
- }
-
- try {
- Picasso.get()
- .load("https://api.didvan.app${responses[2].image}?accessToken=${token}")
- .transform(RoundedTransformation(10, 0))
- .networkPolicy(NetworkPolicy.NO_STORE)
- .memoryPolicy(MemoryPolicy.NO_STORE)
- .error(R.drawable.test)
- .resize(100,100)
- .into(this, R.id.last_image, appWidgetIds);
- } catch (e: Exception) {
-
- }
-
-
- // Pending intent to update counter on button click
- val settingIntent = HomeWidgetBackgroundIntent.getBroadcast(
- context,
- Uri.parse("myAppWidget://setting"),
-
- )
- setOnClickPendingIntent(R.id.setting_btn, settingIntent)
-
- val rowFirst = HomeWidgetBackgroundIntent.getBroadcast(
- context,
- Uri.parse("myAppWidget://rowFirst"),
-
- )
- setOnClickPendingIntent(R.id.first_row, rowFirst)
-
- val rowMiddle = HomeWidgetBackgroundIntent.getBroadcast(
- context,
- Uri.parse("myAppWidget://rowMiddle"),
-
- )
- setOnClickPendingIntent(R.id.middle_row, rowMiddle)
-
- val rowLast = HomeWidgetBackgroundIntent.getBroadcast(
- context,
- Uri.parse("myAppWidget://rowLast"),
-
- )
- setOnClickPendingIntent(R.id.last_row, rowLast)
-
- }
- appWidgetManager.updateAppWidget(widgetId, views)
- }
- }
-
-}
\ No newline at end of file
diff --git a/android/app/app/src/main/java/com/didvan/didvanapp/RoundedTransformation.kt b/android/app/app/src/main/java/com/didvan/didvanapp/RoundedTransformation.kt
deleted file mode 100644
index 78b6c77..0000000
--- a/android/app/app/src/main/java/com/didvan/didvanapp/RoundedTransformation.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.didvan.didvanapp
-
-import android.graphics.Bitmap
-import android.graphics.BitmapShader
-import android.graphics.Canvas
-import android.graphics.Paint
-import android.graphics.RectF
-import android.graphics.Shader
-import com.squareup.picasso.Transformation
-
-
-class RoundedTransformation(private val radius: Int, private val margin: Int) : Transformation {
- override fun transform(source: Bitmap): Bitmap {
- val paint = Paint()
- paint.isAntiAlias = true
- paint.setShader(
- BitmapShader(
- source, Shader.TileMode.CLAMP,
- Shader.TileMode.CLAMP
- )
- )
- val output = Bitmap.createBitmap(
- source.getWidth(), source.getHeight(),
- Bitmap.Config.ARGB_8888
- )
- val canvas = Canvas(output)
- canvas.drawRoundRect(
- RectF(
- margin.toFloat(), margin.toFloat(), (source.getWidth() - margin).toFloat(),
- (
- source.getHeight() - margin).toFloat()
- ), radius.toFloat(), radius.toFloat(), paint
- )
- if (source != output) {
- source.recycle()
- }
- return output
- }
-
- override fun key(): String {
- return "rounded(r=$radius, m=$margin)"
- }
-}
\ No newline at end of file
diff --git a/android/app/app/src/main/java/com/didvan/didvanapp/WidgetResponse.kt b/android/app/app/src/main/java/com/didvan/didvanapp/WidgetResponse.kt
deleted file mode 100644
index ac20408..0000000
--- a/android/app/app/src/main/java/com/didvan/didvanapp/WidgetResponse.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.didvan.didvanapp
-
-import com.google.gson.annotations.SerializedName
-
-data class WidgetResponse(
- @SerializedName("id")
- var id: Int = 0,
- @SerializedName("title")
- var title: String = "",
- @SerializedName("createdAt")
- var createdAt: String = "",
- @SerializedName("type")
- var type: String = "",
- @SerializedName("link")
- var link: String = "",
- @SerializedName("category")
- var category: String = "",
- @SerializedName("image")
- var image: String = "",
-
- )
diff --git a/android/app/app/src/main/kotlin/com/example/didvan/MainActivity.kt b/android/app/app/src/main/kotlin/com/example/didvan/MainActivity.kt
deleted file mode 100644
index c4aec60..0000000
--- a/android/app/app/src/main/kotlin/com/example/didvan/MainActivity.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didvan.didvanapp
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity() {
-}
diff --git a/android/app/app/src/main/res/drawable-nodpi/example_appwidget_preview.png b/android/app/app/src/main/res/drawable-nodpi/example_appwidget_preview.png
deleted file mode 100644
index 894b069..0000000
Binary files a/android/app/app/src/main/res/drawable-nodpi/example_appwidget_preview.png and /dev/null differ
diff --git a/android/app/app/src/main/res/drawable-v21/app_widget_background.xml b/android/app/app/src/main/res/drawable-v21/app_widget_background.xml
deleted file mode 100644
index 785445c..0000000
--- a/android/app/app/src/main/res/drawable-v21/app_widget_background.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml b/android/app/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml
deleted file mode 100644
index 007e287..0000000
--- a/android/app/app/src/main/res/drawable-v21/app_widget_inner_view_background.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/drawable-v21/launch_background.xml b/android/app/app/src/main/res/drawable-v21/launch_background.xml
deleted file mode 100644
index f74085f..0000000
--- a/android/app/app/src/main/res/drawable-v21/launch_background.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/android/app/app/src/main/res/drawable/favwidg.png b/android/app/app/src/main/res/drawable/favwidg.png
deleted file mode 100644
index 9956103..0000000
Binary files a/android/app/app/src/main/res/drawable/favwidg.png and /dev/null differ
diff --git a/android/app/app/src/main/res/drawable/launch_background.xml b/android/app/app/src/main/res/drawable/launch_background.xml
deleted file mode 100644
index 304732f..0000000
--- a/android/app/app/src/main/res/drawable/launch_background.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/android/app/app/src/main/res/drawable/logo.png b/android/app/app/src/main/res/drawable/logo.png
deleted file mode 100644
index 29d994f..0000000
Binary files a/android/app/app/src/main/res/drawable/logo.png and /dev/null differ
diff --git a/android/app/app/src/main/res/drawable/logo_v3.xml b/android/app/app/src/main/res/drawable/logo_v3.xml
deleted file mode 100644
index 46fa037..0000000
--- a/android/app/app/src/main/res/drawable/logo_v3.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/app/app/src/main/res/drawable/setting.xml b/android/app/app/src/main/res/drawable/setting.xml
deleted file mode 100644
index 3263a68..0000000
--- a/android/app/app/src/main/res/drawable/setting.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/android/app/app/src/main/res/drawable/setting_logo.png b/android/app/app/src/main/res/drawable/setting_logo.png
deleted file mode 100644
index 6345163..0000000
Binary files a/android/app/app/src/main/res/drawable/setting_logo.png and /dev/null differ
diff --git a/android/app/app/src/main/res/drawable/test.png b/android/app/app/src/main/res/drawable/test.png
deleted file mode 100644
index a1b31b0..0000000
Binary files a/android/app/app/src/main/res/drawable/test.png and /dev/null differ
diff --git a/android/app/app/src/main/res/font/d.ttf b/android/app/app/src/main/res/font/d.ttf
deleted file mode 100644
index 93200a1..0000000
Binary files a/android/app/app/src/main/res/font/d.ttf and /dev/null differ
diff --git a/android/app/app/src/main/res/layout/favourite_widget.xml b/android/app/app/src/main/res/layout/favourite_widget.xml
deleted file mode 100644
index eb628b0..0000000
--- a/android/app/app/src/main/res/layout/favourite_widget.xml
+++ /dev/null
@@ -1,320 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index 1ef9761..0000000
Binary files a/android/app/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/android/app/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index 96b7009..0000000
Binary files a/android/app/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index d32aa17..0000000
Binary files a/android/app/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 96dea43..0000000
Binary files a/android/app/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index 4bde9bc..0000000
Binary files a/android/app/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/android/app/app/src/main/res/values-hdpi/dimens.xml b/android/app/app/src/main/res/values-hdpi/dimens.xml
deleted file mode 100644
index 8e205ad..0000000
--- a/android/app/app/src/main/res/values-hdpi/dimens.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- 4
- 3
-
- 250dp
- 180dp
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values-mdpi/dimens.xml b/android/app/app/src/main/res/values-mdpi/dimens.xml
deleted file mode 100644
index 01a2002..0000000
--- a/android/app/app/src/main/res/values-mdpi/dimens.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- 4
- 3
-
- 250dp
- 250dp
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values-night/styles.xml b/android/app/app/src/main/res/values-night/styles.xml
deleted file mode 100644
index 449a9f9..0000000
--- a/android/app/app/src/main/res/values-night/styles.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
diff --git a/android/app/app/src/main/res/values-v21/styles.xml b/android/app/app/src/main/res/values-v21/styles.xml
deleted file mode 100644
index 0b35f7d..0000000
--- a/android/app/app/src/main/res/values-v21/styles.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values-xhdpi/dimens.xml b/android/app/app/src/main/res/values-xhdpi/dimens.xml
deleted file mode 100644
index fc3a862..0000000
--- a/android/app/app/src/main/res/values-xhdpi/dimens.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- 4
- 4
-
- 250dp
- 250dp
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values-xxhdpi/dimens.xml b/android/app/app/src/main/res/values-xxhdpi/dimens.xml
deleted file mode 100644
index fc3a862..0000000
--- a/android/app/app/src/main/res/values-xxhdpi/dimens.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- 4
- 4
-
- 250dp
- 250dp
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values-xxxhdpi/dimens.xml b/android/app/app/src/main/res/values-xxxhdpi/dimens.xml
deleted file mode 100644
index 8272e14..0000000
--- a/android/app/app/src/main/res/values-xxxhdpi/dimens.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- 4
- 4
-
- 300dp
- 300dp
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values/attrs.xml b/android/app/app/src/main/res/values/attrs.xml
deleted file mode 100644
index 7781ac8..0000000
--- a/android/app/app/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values/colors.xml b/android/app/app/src/main/res/values/colors.xml
deleted file mode 100644
index b2bffa8..0000000
--- a/android/app/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- #FFE1F5FE
- #FF81D4FA
- #FF039BE5
- #FF01579B
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values/dimens.xml b/android/app/app/src/main/res/values/dimens.xml
deleted file mode 100644
index e2d5ad1..0000000
--- a/android/app/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- 4
- 4
-
- 250dp
- 180dp
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values/strings.xml b/android/app/app/src/main/res/values/strings.xml
deleted file mode 100644
index e554823..0000000
--- a/android/app/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- EXAMPLE
- Add widget
- This is an app widget description
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/values/styles.xml b/android/app/app/src/main/res/values/styles.xml
deleted file mode 100644
index 08abd17..0000000
--- a/android/app/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/app/app/src/main/res/values/themes.xml b/android/app/app/src/main/res/values/themes.xml
deleted file mode 100644
index dcd8899..0000000
--- a/android/app/app/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/app/app/src/main/res/xml/favourite_widget_info.xml b/android/app/app/src/main/res/xml/favourite_widget_info.xml
deleted file mode 100644
index a8c4d25..0000000
--- a/android/app/app/src/main/res/xml/favourite_widget_info.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
\ No newline at end of file
diff --git a/android/app/app/src/profile/AndroidManifest.xml b/android/app/app/src/profile/AndroidManifest.xml
deleted file mode 100644
index 06824d8..0000000
--- a/android/app/app/src/profile/AndroidManifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/lib/assets/icons/prof.png b/lib/assets/icons/prof.png
new file mode 100644
index 0000000..4d53759
Binary files /dev/null and b/lib/assets/icons/prof.png differ
diff --git a/lib/assets/icons/profile.svg b/lib/assets/icons/profile.svg
new file mode 100644
index 0000000..2e1ffe0
--- /dev/null
+++ b/lib/assets/icons/profile.svg
@@ -0,0 +1,9 @@
+
diff --git a/lib/config/theme_data.dart b/lib/config/theme_data.dart
index 663b442..976eaa2 100644
--- a/lib/config/theme_data.dart
+++ b/lib/config/theme_data.dart
@@ -148,8 +148,8 @@ class _TextThemeData {
extension DidvanColorScheme on ColorScheme {
// Secondary colors
Color get secondaryDisabled => brightness == Brightness.dark
- ? const Color(0xFF703848)
- : const Color(0xFFFFC8D7);
+ ? const Color(0xFFFFC8D7)
+ : const Color(0xFF703848);
Color get white => const Color(0xFFFFFFFF);
Color get focused => brightness == Brightness.dark
@@ -161,6 +161,9 @@ extension DidvanColorScheme on ColorScheme {
Color get focusedBorder => brightness == Brightness.dark
? const Color(0xFF9FB2C2)
: const Color(0xFF195D80);
+ Color get checkFav => brightness == Brightness.dark
+ ? const Color(0xFF007EA7)
+ : const Color(0xFF1B3C59);
Color get title => brightness == Brightness.dark
? const Color(0xFFD6D6D6)
: const Color(0xFF1B3C59);
@@ -189,7 +192,7 @@ extension DidvanColorScheme on ColorScheme {
? const Color(0xFF333333)
: const Color(0xFFE0E0E0);
Color get secondCTA => brightness == Brightness.dark
- ? const Color(0xFF474747)
+ ? const Color(0xFF202224)
: const Color(0xFFF5F5F5);
Color get splash => brightness == Brightness.dark
? const Color(0xFF333333)
@@ -200,6 +203,9 @@ extension DidvanColorScheme on ColorScheme {
Color get overlay => brightness == Brightness.dark
? const Color(0xFF0F1011)
: const Color(0xFF292929);
+ Color get surface => brightness == Brightness.dark
+ ? const Color(0xFF191919)
+ : const Color(0xFFffffff);
Color get yellow => const Color(0XFFEAA92A);
// Error and success colors
diff --git a/lib/main.dart b/lib/main.dart
index 6456f7e..06c88b5 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -126,6 +126,7 @@ class _DidvanState extends State with WidgetsBindingObserver {
switch (value) {
case 'setting':
route = Routes.favouritesStep;
+ args = {"toTimer":false};
break;
case 'rowfirst':
row = 1;
diff --git a/lib/models/notification_message.dart b/lib/models/notification_message.dart
index 7d2ae86..049594c 100644
--- a/lib/models/notification_message.dart
+++ b/lib/models/notification_message.dart
@@ -6,6 +6,7 @@ class NotificationMessage {
String? type;
String? link;
String? image;
+ String? photo;
NotificationMessage(
{this.notificationType,
@@ -14,7 +15,9 @@ class NotificationMessage {
this.id,
this.type,
this.link,
- this.image});
+ this.image,
+ this.photo,
+ });
NotificationMessage.fromJson(Map json) {
notificationType = json['notificationType'];
@@ -24,6 +27,7 @@ class NotificationMessage {
type = json['type'];
link = json['link'];
image = json['image'];
+ photo = json['photo'];
}
Map toJson() {
@@ -35,6 +39,7 @@ class NotificationMessage {
data['type'] = this.type;
data['link'] = this.link;
data['image'] = this.image;
+ data['photo'] = this.photo;
return data;
}
Map toPayload() {
@@ -46,6 +51,7 @@ class NotificationMessage {
data['type'] = this.type!;
data['link'] = this.link!;
data['image'] = this.image!;
+ data['photo'] = this.photo!;
return data;
}
}
\ No newline at end of file
diff --git a/lib/routes/route_generator.dart b/lib/routes/route_generator.dart
index e5b0ff8..0b39708 100644
--- a/lib/routes/route_generator.dart
+++ b/lib/routes/route_generator.dart
@@ -56,25 +56,6 @@ import '../views/notification_time/notification_time.dart';
class RouteGenerator {
static Route generateRoute(RouteSettings settings) {
switch (settings.name) {
- case Routes.widgetSetting:
- _createRoute(
- const Splash(),
- );
- _createRoute(
- const ProfilePage(),
- );
- _createRoute(
- ChangeNotifierProvider(
- create: (context) => GeneralSettingsState(),
- child: const GeneralSettings(),
- ),
- );
-
- return _createRoute(
- ChangeNotifierProvider(
- create: (context) => CustomizeCategoryState(),
- child: FavoritesStep()),
- );
case Routes.splash:
return _createRoute(
@@ -93,14 +74,18 @@ class RouteGenerator {
return _createRoute(
ChangeNotifierProvider(
create: (context) => CustomizeCategoryState(),
- child: FavoritesStep()),
+ child: FavoritesStep(
+ pageData: settings.arguments as Map,
+ )),
);
case Routes.notificationStatusStep:
return _createRoute(
ChangeNotifierProvider(
create: (context) => CustomizeCategoryState(),
- child: NotificationStatusStep()),
+ child: NotificationStatusStep(
+ pageData: settings.arguments as Map,
+ )),
);
case Routes.authenticaion:
return _createRoute(
diff --git a/lib/services/network/request.dart b/lib/services/network/request.dart
index 287d6b8..e0bc80a 100644
--- a/lib/services/network/request.dart
+++ b/lib/services/network/request.dart
@@ -43,11 +43,12 @@ class RequestService {
}) {
if (body != null) _requestBody = body;
if (requestHeaders != null) _headers.addAll(requestHeaders);
- // if (useAutherization) _headers.addAll({'Authorization': 'Bearer $token'});
- _headers.addAll({
- 'Authorization':
- 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicm9sZUlkIjo0LCJhcHBJZCI6MCwiaWF0IjoxNzEzOTM1NzkwfQ.i-SO9tLy0M9j-_C2Wh8tdp01vtYGlDZIBFPygglHQF0'
- });
+ if (useAutherization) _headers.addAll({'Authorization': 'Bearer $token'});
+ // print('Authorization : Bearer $token');
+ // _headers.addAll({
+ // 'Authorization':
+ // 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicm9sZUlkIjo0LCJhcHBJZCI6MCwiaWF0IjoxNzEzOTM1NzkwfQ.i-SO9tLy0M9j-_C2Wh8tdp01vtYGlDZIBFPygglHQF0'
+ // });
if (body != null) _requestBody = body;
}
diff --git a/lib/services/notification/awsome/awsome_notification_controller.dart b/lib/services/notification/awsome/awsome_notification_controller.dart
index 43cabc2..2f8b4f4 100644
--- a/lib/services/notification/awsome/awsome_notification_controller.dart
+++ b/lib/services/notification/awsome/awsome_notification_controller.dart
@@ -59,8 +59,7 @@ class NotificationController {
'id': int.parse(data.id.toString()),
'args': const InfographyRequestArgs(page: 0),
'hasUnmarkConfirmation': false,
- 'goToComment':openComments
-
+ 'goToComment': openComments
};
break;
case "news":
@@ -71,8 +70,7 @@ class NotificationController {
'id': int.parse(data.id.toString()),
'args': const NewsRequestArgs(page: 0),
'hasUnmarkConfirmation': false,
- 'goToComment':openComments
-
+ 'goToComment': openComments
};
break;
case "radar":
@@ -83,8 +81,7 @@ class NotificationController {
'id': int.parse(data.id.toString()),
'args': const RadarRequestArgs(page: 0),
'hasUnmarkConfirmation': false,
- 'goToComment':openComments
-
+ 'goToComment': openComments
};
break;
case "video":
@@ -92,7 +89,7 @@ class NotificationController {
args = {
'type': 'podcast',
'id': int.parse(data.id.toString()),
- 'goToComment':openComments
+ 'goToComment': openComments
};
break;
}
@@ -105,13 +102,7 @@ class NotificationController {
}
}
if (route.isNotEmpty) {
- if (data.notificationType.toString() == "1") {
- navigatorKey.currentState!
- .pushNamedIfNotCurrent(route, arguments: args);
- } else {
-
- navigatorKey.currentState!.pushNamedIfNotCurrent(route, arguments: args);
- }
+ navigatorKey.currentState!.pushNamedIfNotCurrent(route, arguments: args);
}
// MyApp.navigatorKey.currentState?.pushNamedAndRemoveUntil('/notification-page',
diff --git a/lib/services/notification/awsome/awsome_notification_handler.dart b/lib/services/notification/awsome/awsome_notification_handler.dart
index 462dfda..deb5277 100644
--- a/lib/services/notification/awsome/awsome_notification_handler.dart
+++ b/lib/services/notification/awsome/awsome_notification_handler.dart
@@ -96,46 +96,62 @@ class AwsomeNotificationHandler {
}
showNotificationTypeNews(NotificationMessage message) async {
+ DateTime time = await _getTime();
+
AwesomeNotifications().createNotification(
- content: NotificationContent(
- id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
- channelKey: 'alerts',
- actionType: ActionType.Default,
- title: "\u200f ${message.title} \u200f",
- // body: message.body.toString(),
- notificationLayout: NotificationLayout.Default,
- largeIcon: message.image.toString(),
- payload: message.toPayload(),
- color: const Color(0xFF007EA7)),
- );
+ content: NotificationContent(
+ id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
+ channelKey: 'alerts',
+ actionType: ActionType.Default,
+ title: "\u200f ${message.title} \u200f",
+ // body: message.body.toString(),
+ notificationLayout: NotificationLayout.Default,
+ largeIcon: message.image.toString(),
+ payload: message.toPayload(),
+ color: const Color(0xFF007EA7)),
+ schedule: time.year != null
+ ? null
+ : NotificationCalendar(
+ hour: time.hour,
+ minute: time.minute,
+ ));
}
showNotificationTypeMessage(NotificationMessage message) async {
+ DateTime time = await _getTime();
+
AwesomeNotifications().createNotification(
- content: NotificationContent(
- id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
- channelKey: 'alerts',
- actionType: ActionType.Default,
- title: message.title.toString(),
- body: "${message.body.toString()}",
- largeIcon: message.image.toString(),
- roundedLargeIcon: true,
- payload: message.toPayload(),
- notificationLayout: NotificationLayout.Inbox,
- color: const Color(0xFF007EA7)),
- // actionButtons: [
- // NotificationActionButton(
- // key: 'REPLY',
- // label: 'جواب دادن',
- // requireInputText: true,
- // actionType: ActionType.SilentAction),
- // NotificationActionButton(
- // key: 'DISMISS',
- // label: 'خوانده شده',
- // actionType: ActionType.DismissAction,
- // isDangerousOption: true)
- // ]
- );
+ content: NotificationContent(
+ id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
+ channelKey: 'alerts',
+ actionType: ActionType.Default,
+ body:
+ "${message.title.toString()} ${message.body.toString()}",
+ largeIcon: message.photo.toString(),
+ roundedLargeIcon: true,
+ bigPicture: message.image.toString(),
+ payload: message.toPayload(),
+ notificationLayout: NotificationLayout.BigPicture,
+ color: const Color(0xFF007EA7)),
+ schedule: time.year != null
+ ? null
+ : NotificationCalendar(
+ hour: time.hour,
+ minute: time.minute,
+ )
+ // actionButtons: [
+ // NotificationActionButton(
+ // key: 'REPLY',
+ // label: 'جواب دادن',
+ // requireInputText: true,
+ // actionType: ActionType.SilentAction),
+ // NotificationActionButton(
+ // key: 'DISMISS',
+ // label: 'خوانده شده',
+ // actionType: ActionType.DismissAction,
+ // isDangerousOption: true)
+ // ]
+ );
}
showNotificationTypeEmoji(NotificationMessage message) async {
@@ -165,10 +181,14 @@ class AwsomeNotificationHandler {
await service.httpGet();
if (service.isSuccess) {
final time = service.data('time');
- DateFormat format = DateFormat("HH:mm");
- DateTime dateTime = format.parse(time);
- DateTime result =
- DateTime.now().copyWith(hour: dateTime.hour, minute: dateTime.minute);
+ DateTime result = DateTime.now();
+ if (time.toString().isNotEmpty) {
+ DateFormat format = DateFormat("HH:mm");
+ DateTime dateTime = format.parse(time);
+ result = DateTime.now()
+ .copyWith(hour: dateTime.hour, minute: dateTime.minute);
+ }
+
return result;
} else {
return DateTime.now();
diff --git a/lib/services/notification/fcm/firebase_notification_handler.dart b/lib/services/notification/fcm/firebase_notification_handler.dart
index d34d94d..9441a53 100644
--- a/lib/services/notification/fcm/firebase_notification_handler.dart
+++ b/lib/services/notification/fcm/firebase_notification_handler.dart
@@ -51,6 +51,8 @@ class FirebaseNotificationHandler {
debugPrint(
'User granted notifications permission: ${settings.authorizationStatus}');
+ // String? token = await FirebaseMessaging.instance.getToken();
+ // print("Firebase Token : ${token.toString()}");
// Handling background messages using the specified handler
// FirebaseMessaging.onBackgroundMessage(
diff --git a/lib/views/authentication/authentication_state.dart b/lib/views/authentication/authentication_state.dart
index 15bc772..935d753 100644
--- a/lib/views/authentication/authentication_state.dart
+++ b/lib/views/authentication/authentication_state.dart
@@ -11,6 +11,7 @@ class AuthenticationState extends CoreProvier {
String username = '';
String password = '';
String _verificationCode = '';
+ bool isShowCustomDialog = true;
set currentPageIndex(int value) {
_currentPageIndex = value;
diff --git a/lib/views/authentication/screens/password.dart b/lib/views/authentication/screens/password.dart
index a220d17..1f3e9dc 100644
--- a/lib/views/authentication/screens/password.dart
+++ b/lib/views/authentication/screens/password.dart
@@ -82,14 +82,12 @@ class _PasswordInputState extends State {
if (mounted) {
Navigator.of(context).pushReplacementNamed(Routes.home);
}
- _showCustomizeDialog();
_showResetPasswordDialog();
}
}
void _showResetPasswordDialog() {
ActionSheetUtils.openDialog(
-
data: ActionSheetData(
content: const DidvanText(
'خوش آمدید!\nبرای امنیت بیشتر، رمز عبور خود را تغییر دهید.',
@@ -104,34 +102,37 @@ class _PasswordInputState extends State {
dismissTitle: 'بعدا',
),
);
+ _showCustomizeDialog();
}
- void _showCustomizeDialog() {
+
+ void _showCustomizeDialog() {
ActionSheetUtils.openDialog(
data: ActionSheetData(
- backgroundColor: Colors.white,
- isBackgroundDropBlur: true,
-
+ backgroundColor: Theme.of(context).colorScheme.background,
+ isBackgroundDropBlur: true,
content: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWrapper(
- onPressed: () => Navigator.of(ActionSheetUtils.context).pop,
- child: const Icon(
+ onPressed:Navigator.of(ActionSheetUtils.context).pop,
+ child: Icon(
DidvanIcons.close_solid,
size: 24,
),
),
DidvanText(
- 'شخصی سازی برنامه',
+ 'شخصی سازی محتوا',
style: Theme.of(context).textTheme.displaySmall,
- color: Theme.of(context).colorScheme.title,
+ color: Theme.of(context).colorScheme.text,
),
- const Icon(
- DidvanIcons.close_regular,
- size: 24,
- color: Colors.transparent,
+ InkWrapper(
+ child: const Icon(
+ DidvanIcons.close_regular,
+ size: 24,
+ color: Colors.transparent,
+ ),
),
],
),
@@ -145,11 +146,11 @@ class _PasswordInputState extends State {
hasDismissButton: false,
onConfirmed: () => Navigator.of(ActionSheetUtils.context).pushNamed(
Routes.favouritesStep,
- arguments: true,
+ arguments: {"toTimer":true},
),
confrimTitle: 'تایید',
),
);
+
}
-
}
diff --git a/lib/views/comments/comments.dart b/lib/views/comments/comments.dart
index 6527465..f59c5fd 100644
--- a/lib/views/comments/comments.dart
+++ b/lib/views/comments/comments.dart
@@ -115,6 +115,13 @@ class _CommentsState extends State {
),
DidvanTitleDivider(
title: "نظرات پنهان شده",
+ color: Theme.of(context).colorScheme.primary,
+ icon: Icon(
+ commentsState.showPrivates
+ ? DidvanIcons.angle_up_regular
+ : DidvanIcons.angle_down_regular,
+ color: Theme.of(context).colorScheme.primary,
+ ),
onClick: () {
commentsState.showPrivates =
!commentsState.showPrivates;
@@ -332,12 +339,12 @@ class _MessageBoxState extends State<_MessageBox> {
children: [
DidvanText(
"اشاره به",
- color: Theme.of(context).colorScheme.inputText,
+ color: Theme.of(context).colorScheme.text,
style: Theme.of(context).textTheme.labelSmall,
),
DidvanText(
state.usersMentioned.name.toString(),
- color: Theme.of(context).colorScheme.navigation,
+ color: Theme.of(context).colorScheme.text,
style: Theme.of(context).textTheme.bodySmall,
),
],
diff --git a/lib/views/comments/widgets/comment.dart b/lib/views/comments/widgets/comment.dart
index f070cc1..9a0d3ed 100644
--- a/lib/views/comments/widgets/comment.dart
+++ b/lib/views/comments/widgets/comment.dart
@@ -132,19 +132,22 @@ class CommentState extends State {
children: [
Icon(
Icons.circle,
- color: Theme.of(context)
- .colorScheme
- .secondary
- .withOpacity(0.3),
+ color:
+ Theme.of(context).colorScheme.secondaryDisabled,
size: 18,
),
const SizedBox(width: 4),
DidvanText(
'در انتظار تایید',
- color: Theme.of(context)
- .colorScheme
- .secondary
- .withOpacity(0.3),
+ style: Theme.of(context)
+ .textTheme
+ .titleSmall!
+ .copyWith(
+ color: Theme.of(context)
+ .colorScheme
+ .secondaryDisabled),
+ color:
+ Theme.of(context).colorScheme.secondaryDisabled,
),
],
),
diff --git a/lib/views/customize_category/customize_category_state.dart b/lib/views/customize_category/customize_category_state.dart
index 1242132..391f056 100644
--- a/lib/views/customize_category/customize_category_state.dart
+++ b/lib/views/customize_category/customize_category_state.dart
@@ -2,11 +2,13 @@ import 'package:didvan/models/customize_categories/favorites_response.dart';
import 'package:didvan/models/enums.dart';
import 'package:flutter/cupertino.dart';
+import '../../models/view/alert_data.dart';
import '../../providers/core.dart';
import '../../routes/routes.dart';
import '../../services/app_home_widget/home_widget_repository.dart';
import '../../services/network/request.dart';
import '../../services/network/request_helper.dart';
+import '../../utils/action_sheet.dart';
class CustomizeCategoryState extends CoreProvier {
CustomizeCategoryState() {
@@ -17,6 +19,7 @@ class CustomizeCategoryState extends CoreProvier {
List selectedNotifIds = [];
final List faves = [];
final List notifs = [];
+ bool toTimer = false;
Future getFavourites() async {
appState = AppState.busy;
@@ -81,9 +84,8 @@ class CustomizeCategoryState extends CoreProvier {
);
await service.put();
if (service.isSuccess) {
- Navigator.of(context).pushNamed(
- Routes.notificationStatusStep,
- );
+ Navigator.of(context).pushNamed(Routes.notificationStatusStep,
+ arguments: {"toTimer": toTimer});
appState = AppState.idle;
await HomeWidgetRepository().fetchWidget();
@@ -102,8 +104,17 @@ class CustomizeCategoryState extends CoreProvier {
);
await service.put();
if (service.isSuccess) {
- Navigator.of(context).pop();
- Navigator.of(context).pop();
+ if (toTimer) {
+ Navigator.of(context).pushNamed(Routes.notificationTime,
+ arguments: {"fromFav": toTimer});
+ } else {
+ Navigator.of(context).pop();
+ Navigator.of(context).pop();
+ ActionSheetUtils.showAlert(AlertData(
+ message: "تغییرات شما با موفقیت اعمال شد.",
+ aLertType: ALertType.success));
+ }
+
appState = AppState.idle;
await HomeWidgetRepository().fetchWidget();
return;
@@ -112,7 +123,8 @@ class CustomizeCategoryState extends CoreProvier {
appState = AppState.failed;
}
- Future changeSelected(int index, List list,List selectedIds) async {
+ Future changeSelected(
+ int index, List list, List selectedIds) async {
list[index].selected = !list[index].selected!;
selectedIds.clear();
for (var ls in list) {
diff --git a/lib/views/customize_category/favorites_step.dart b/lib/views/customize_category/favorites_step.dart
index 049c839..88226cc 100644
--- a/lib/views/customize_category/favorites_step.dart
+++ b/lib/views/customize_category/favorites_step.dart
@@ -20,7 +20,9 @@ import '../widgets/state_handlers/sliver_state_handler.dart';
import '../widgets/user_mention.dart';
class FavoritesStep extends StatefulWidget {
- const FavoritesStep({super.key});
+ final Map pageData;
+
+ const FavoritesStep({super.key, required this.pageData});
@override
State createState() => _FavoritesStepState();
@@ -33,6 +35,9 @@ class _FavoritesStepState extends State {
void initState() {
super.initState();
state = context.read();
+ if (widget.pageData['toTimer'] != null) {
+ state.toTimer = widget.pageData['toTimer'];
+ }
Future.delayed(
Duration.zero,
@@ -50,7 +55,7 @@ class _FavoritesStepState extends State {
DidvanScaffold(
appBarData: AppBarData(
hasBack: true,
- title: 'شخصیسازی برنامه',
+ title: 'شخصیسازی محتوا',
),
physics: const BouncingScrollPhysics(),
hidePlayer: true,
@@ -93,9 +98,10 @@ class _FavoritesStepState extends State {
child: CustomizeCategoryCheckbox(
title: state.faves[index].name!,
value: state.faves[index].selected,
- color: Theme.of(context).colorScheme.title,
+ checkColor: Theme.of(context).colorScheme.checkFav,
onChanged: (val) {
- state.changeSelected(index, state.faves,state.selectedFavIds);
+ state.changeSelected(
+ index, state.faves, state.selectedFavIds);
})),
),
),
diff --git a/lib/views/customize_category/notification_status_step.dart b/lib/views/customize_category/notification_status_step.dart
index 0e7ab5b..9e9021f 100644
--- a/lib/views/customize_category/notification_status_step.dart
+++ b/lib/views/customize_category/notification_status_step.dart
@@ -21,7 +21,9 @@ import '../widgets/state_handlers/sliver_state_handler.dart';
import '../widgets/user_mention.dart';
class NotificationStatusStep extends StatefulWidget {
- const NotificationStatusStep({super.key});
+ final Map pageData;
+
+ const NotificationStatusStep({super.key, required this.pageData});
@override
State createState() => _NotificationStatusStepState();
@@ -34,6 +36,9 @@ class _NotificationStatusStepState extends State {
void initState() {
super.initState();
state = context.read();
+ if (widget.pageData['toTimer'] != null) {
+ state.toTimer = widget.pageData['toTimer'];
+ }
Future.delayed(
Duration.zero,
@@ -85,7 +90,8 @@ class _NotificationStatusStepState extends State {
value: state.notifs[index].selected!,
title: state.notifs[index].name!,
onChanged: (val) {
- state.changeSelected(index, state.notifs,state.selectedNotifIds);
+ state.changeSelected(index, state.notifs,
+ state.selectedNotifIds);
}),
index != state.notifs.length - 1
? Padding(
diff --git a/lib/views/customize_category/widgets/customize_category_checkbox.dart b/lib/views/customize_category/widgets/customize_category_checkbox.dart
index 07ec708..a250dfd 100644
--- a/lib/views/customize_category/widgets/customize_category_checkbox.dart
+++ b/lib/views/customize_category/widgets/customize_category_checkbox.dart
@@ -9,13 +9,14 @@ class CustomizeCategoryCheckbox extends StatefulWidget {
final String title;
final bool? value;
final double size;
- final Color? color;
+ final Color? checkColor;
+ final Color? textColor;
final void Function(bool value) onChanged;
const CustomizeCategoryCheckbox({
Key? key,
required this.title,
required this.value,
- required this.onChanged, this.size = 15, this.color,
+ required this.onChanged, this.size = 15, this.checkColor, this.textColor,
}) : super(key: key);
@override
@@ -35,8 +36,11 @@ class _CustomizeCategoryCheckboxState extends State {
@override
Widget build(BuildContext context) {
- Color? _color = widget.color;
- _color ??= Theme.of(context).colorScheme.caption;
+ Color? _checkColor = widget.checkColor;
+ _checkColor ??= Theme.of(context).colorScheme.text;
+
+ Color? _textColor = widget.textColor;
+ _textColor ??= Theme.of(context).colorScheme.text;
return GestureDetector(
onTap: () {
@@ -57,17 +61,17 @@ class _CustomizeCategoryCheckboxState extends State {
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(6),
- border: Border.all(width: 1.0, color: _value? _color: Theme.of(context).colorScheme.caption),
+ border: Border.all(width: 1.0, color: _value? _checkColor: Theme.of(context).colorScheme.text),
),
margin: EdgeInsets.all(8),
child: AnimatedVisibility(
isVisible: _value,
duration: DesignConfig.mediumAnimationDuration,
- child: Center(child: Icon(Icons.check,size: 12,color: _value? _color: Theme.of(context).colorScheme.caption,))
+ child: Center(child: Icon(Icons.check,size: 12,color: _value? _checkColor: Theme.of(context).colorScheme.text,))
),
),
- ), DidvanText(widget.title,fontSize: widget.size,color: _value? _color: Theme.of(context).colorScheme.caption, ),
+ ), DidvanText(widget.title,fontSize: widget.size,color: _value? _textColor: Theme.of(context).colorScheme.text, ),
],
),
),
diff --git a/lib/views/notification_time/notification_time.dart b/lib/views/notification_time/notification_time.dart
index 8ddb499..b1a3046 100644
--- a/lib/views/notification_time/notification_time.dart
+++ b/lib/views/notification_time/notification_time.dart
@@ -4,6 +4,7 @@ import 'package:didvan/models/enums.dart';
import 'package:didvan/models/users_mention.dart';
import 'package:didvan/models/view/app_bar_data.dart';
import 'package:didvan/views/customize_category/customize_category_state.dart';
+import 'package:didvan/views/customize_category/widgets/customize_category_switch.dart';
import 'package:didvan/views/notification_time/notification_time_state.dart';
import 'package:didvan/views/notification_time/widgets/custom_cupertino_date_picker.dart';
import 'package:didvan/views/customize_category/widgets/customize_category_checkbox.dart';
@@ -40,7 +41,14 @@ class _NotificationTimeState extends State {
void initState() {
super.initState();
state = context.read();
- state.onTimeChanged = widget.pageData['onTimeChanged'];
+ if (widget.pageData['onTimeChanged'] != null) {
+ state.onTimeChanged = widget.pageData['onTimeChanged'];
+ }
+
+ if (widget.pageData['fromFav'] != null) {
+ state.fromFav = widget.pageData['fromFav'];
+ }
+
Future.delayed(
Duration.zero,
() => state.getTime(),
@@ -56,7 +64,7 @@ class _NotificationTimeState extends State {
DidvanScaffold(
appBarData: AppBarData(
hasBack: true,
- title: 'شخصیسازی برنامه',
+ title: 'زمان دریافت اعلان',
),
physics: const BouncingScrollPhysics(),
hidePlayer: true,
@@ -66,26 +74,30 @@ class _NotificationTimeState extends State {
slivers: [],
children: [
Consumer(
- builder: (context, state, child) => Column(
- children: [
- DidvanText(
- "لطفا زمان دریافت اعلانات خود را مشخص کنید",
- style: Theme.of(context).textTheme.bodyMedium,
- ),
- state.appState == AppState.idle
- ? Container(
+ builder: (context, state, child) => state.appState ==
+ AppState.idle
+ ? Column(
+ children: [
+ DidvanText(
+ "لطفا زمان دریافت اعلانات خود را مشخص کنید",
+ style: Theme.of(context).textTheme.bodyMedium,
+ ),
+ Container(
margin: EdgeInsets.all(24),
height: 210,
child: CustomCupertinoDatePicker(
+ disable: state.isAnytime,
itemExtent: 64,
selectedTime: state.selectedTime,
selectedStyle: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
- color: Theme.of(context)
- .colorScheme
- .white),
+ color: state.isAnytime
+ ? Color(0xFFC8E0F4)
+ : Theme.of(context)
+ .colorScheme
+ .white),
unselectedStyle:
Theme.of(context).textTheme.titleSmall,
disabledStyle: Theme.of(context)
@@ -98,10 +110,30 @@ class _NotificationTimeState extends State {
onSelectedItemChanged: (date) {
state.selectedTime = date;
}),
- )
- : SizedBox(),
- ],
- ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Container(
+ padding: EdgeInsets.all(16),
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.surface,
+ border: Border.all(
+ color:
+ Theme.of(context).colorScheme.border,
+ width: 1),
+ borderRadius: BorderRadius.circular(18)),
+ child: DidvanSwitch(
+ value: state.isAnytime,
+ title: "دریافت آنی اعلانات",
+ onChanged: (val) {
+ state.isAnytime = val;
+ state.update();
+ }),
+ ),
+ ),
+ ],
+ )
+ : SizedBox(),
)
],
),
diff --git a/lib/views/notification_time/notification_time_state.dart b/lib/views/notification_time/notification_time_state.dart
index 7ab4a03..8ab7d03 100644
--- a/lib/views/notification_time/notification_time_state.dart
+++ b/lib/views/notification_time/notification_time_state.dart
@@ -1,20 +1,27 @@
+import 'package:didvan/main.dart';
import 'package:didvan/models/enums.dart';
import 'package:didvan/providers/core.dart';
+import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../../models/day_time.dart';
+import '../../models/view/alert_data.dart';
import '../../routes/routes.dart';
import '../../services/network/request.dart';
import '../../services/network/request_helper.dart';
+import '../../utils/action_sheet.dart';
import '../../utils/date_time.dart';
import '../profile/general_settings/settings_state.dart';
class NotificationTimeState extends CoreProvier {
late DayTime selectedTime;
+ bool isAnytime = false;
+ bool fromFav = false;
- late void Function( ) onTimeChanged;
+ late void Function() onTimeChanged = (){};
Future getTime() async {
appState = AppState.busy;
@@ -24,7 +31,11 @@ class NotificationTimeState extends CoreProvier {
);
await service.httpGet();
if (service.isSuccess) {
- final time = service.data('time');
+ var time = service.data('time');
+ if (time.toString().isEmpty) {
+ time = "12:00";
+ isAnytime = true;
+ }
selectedTime = DateTimeUtils.handleDayTime(time);
appState = AppState.idle;
@@ -39,7 +50,7 @@ class NotificationTimeState extends CoreProvier {
appState = AppState.busy;
final favoritesRequest = {
- "time": DateTimeUtils.handleDayTimeReverse(selectedTime)
+ "time": isAnytime ? "" : DateTimeUtils.handleDayTimeReverse(selectedTime)
};
final service = RequestService(
RequestHelper.notificationTime(),
@@ -49,9 +60,15 @@ class NotificationTimeState extends CoreProvier {
if (service.isSuccess) {
onTimeChanged();
- // Navigator.of(context).pushNamed(
- // Routes.notificationStatusStep,
- // );
+ if (fromFav) {
+ Navigator.of(context).pop();
+ Navigator.of(context).pop();
+ Navigator.of(context).pop();
+ } else {
+ Navigator.of(context).pop();
+ }
+ ActionSheetUtils.showAlert(AlertData(message: "تغییرات شما با موفقیت اعمال شد.",aLertType: ALertType.success));
+
appState = AppState.idle;
return;
}
diff --git a/lib/views/notification_time/widgets/custom_cupertino_date_picker.dart b/lib/views/notification_time/widgets/custom_cupertino_date_picker.dart
index 2977a9b..9ea7f8d 100644
--- a/lib/views/notification_time/widgets/custom_cupertino_date_picker.dart
+++ b/lib/views/notification_time/widgets/custom_cupertino_date_picker.dart
@@ -16,6 +16,7 @@ class CustomCupertinoDatePicker extends StatefulWidget {
final TextStyle? unselectedStyle; // Text style of disabled item
final TextStyle? disabledStyle; // Minimum selectable date
final DayTime? selectedTime;
+ final bool disable;
const CustomCupertinoDatePicker({
Key? key,
@@ -25,6 +26,7 @@ class CustomCupertinoDatePicker extends StatefulWidget {
this.selectedStyle,
this.unselectedStyle,
this.disabledStyle,
+ this.disable = false,
}) : super(key: key);
@override
@@ -33,7 +35,7 @@ class CustomCupertinoDatePicker extends StatefulWidget {
}
class _CustomCupertinoDatePickerState extends State {
- late DayTime selectedTime = DateTimeUtils.handleDayTime(
+ late DayTime selectedTime = DateTimeUtils.handleDayTime(
"${DateTime.now().hour.toString()}:${DateTime.now().minute.toString()}");
late int _selectedMeridiemIndex;
@@ -57,7 +59,6 @@ class _CustomCupertinoDatePickerState extends State {
void initState() {
super.initState();
-
for (int i = 1; i < 12 + 1; i++) {
String twoDigitNumber = i.toString().padLeft(2, '0');
_timeH.add(twoDigitNumber);
@@ -73,9 +74,8 @@ class _CustomCupertinoDatePickerState extends State {
_meridiemScrollController = FixedExtentScrollController();
_hourScrollController = FixedExtentScrollController();
_minuteScrollController = FixedExtentScrollController();
- if(widget.selectedTime !=null){
+ if (widget.selectedTime != null) {
selectedTime = widget.selectedTime!;
-
}
_initDates();
}
@@ -83,16 +83,16 @@ class _CustomCupertinoDatePickerState extends State {
void _initDates() {
_selectedMeridiemIndex = 0;
- switch(selectedTime.meridiem){
+ switch (selectedTime.meridiem) {
case Meridiem.AM:
_selectedMeridiemIndex = 0;
- _selectedHourIndex = int.parse(selectedTime.hour)-1;
+ _selectedHourIndex = int.parse(selectedTime.hour) - 1;
break;
case Meridiem.PM:
_selectedMeridiemIndex = 1;
- _selectedHourIndex = (int.parse(selectedTime.hour)+12)-1;
+ _selectedHourIndex = (int.parse(selectedTime.hour) + 12) - 1;
break;
}
@@ -123,7 +123,6 @@ class _CustomCupertinoDatePickerState extends State {
void _onSelectedItemChanged(int index, SelectorType type) {
switch (type) {
case SelectorType.meridiem:
-
_selectedMeridiemIndex = index; // if month is changed to february &
if (_selectedMeridiemIndex == 0) {
if (_selectedHourIndex > 12 - 1) {
@@ -136,16 +135,14 @@ class _CustomCupertinoDatePickerState extends State {
_hourScrollController.jumpToItem(_selectedHourIndex);
}
}
- if(index == 0){
+ if (index == 0) {
selectedTime.meridiem = Meridiem.AM;
- }else{
+ } else {
selectedTime.meridiem = Meridiem.PM;
-
}
break;
case SelectorType.hour:
-
_selectedHourIndex = index; // if month is changed to february &
if (_selectedHourIndex > 12 - 1) {
_selectedMeridiemIndex = 1;
@@ -171,98 +168,99 @@ class _CustomCupertinoDatePickerState extends State {
/// check if the given day, month or year index is disabled
bool _isDisabled(int index, SelectorType type) {
- switch (type) {
- case SelectorType.meridiem:
-
- break;
-
- case SelectorType.hour:
- break;
-
- case SelectorType.minute:
-
- break;
- }
+ // switch (type) {
+ // case SelectorType.meridiem:
+ // break;
+ //
+ // case SelectorType.hour:
+ // break;
+ //
+ // case SelectorType.minute:
+ // break;
+ // }
return false;
}
@override
Widget build(BuildContext context) {
Color _shadow = Theme.of(context).colorScheme.background;
- return Stack(
- children: [
- Positioned.fill(
- child: Center(
- child: Container(
- height: 64,
- decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.primary,
- borderRadius: BorderRadius.circular(18)),
- child: const Padding(
- padding: EdgeInsets.symmetric(vertical: 12),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- SizedBox(),
- VerticalDivider(
- color: Colors.white,
- ),
- VerticalDivider(
- color: Colors.white,
- ),
- SizedBox(),
- ],
+ return IgnorePointer(
+ ignoring: widget.disable,
+ child: Stack(
+ children: [
+ Positioned.fill(
+ child: Center(
+ child: Container(
+ height: 64,
+ decoration: BoxDecoration(
+ color: Theme.of(context).colorScheme.primary.withOpacity(widget.disable? 0.2: 1),
+ borderRadius: BorderRadius.circular(18)),
+ child: const Padding(
+ padding: EdgeInsets.symmetric(vertical: 12),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ SizedBox(),
+ VerticalDivider(
+ color: Colors.white,
+ ),
+ VerticalDivider(
+ color: Colors.white,
+ ),
+ SizedBox(),
+ ],
+ ),
),
),
),
),
- ),
- Row(
- children: [
- Expanded(child: _meridiemSelector()),
- Expanded(child: _minuteSelector()),
- Expanded(child: _hourSelector()),
- ],
- ),
- Positioned(
- top: 0,
- left: 0,
- right: 0,
- child: Container(
- height: 32,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- _shadow.withOpacity(1),
- _shadow.withOpacity(0.9),
- _shadow.withOpacity(0.8),
- _shadow.withOpacity(0.6),
- _shadow.withOpacity(0.5),
- _shadow.withOpacity(0.4),
- ])),
- )),
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: Container(
- height: 32,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.bottomCenter,
- end: Alignment.topCenter,
- colors: [
- _shadow.withOpacity(1),
- _shadow.withOpacity(0.9),
- _shadow.withOpacity(0.8),
- _shadow.withOpacity(0.6),
- _shadow.withOpacity(0.5),
- _shadow.withOpacity(0.4),
- ])),
- )),
- ],
+ Row(
+ children: [
+ Expanded(child: _meridiemSelector()),
+ Expanded(child: _minuteSelector()),
+ Expanded(child: _hourSelector()),
+ ],
+ ),
+ Positioned(
+ top: 0,
+ left: 0,
+ right: 0,
+ child: Container(
+ height: 32,
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [
+ _shadow.withOpacity(1),
+ _shadow.withOpacity(0.9),
+ _shadow.withOpacity(0.8),
+ _shadow.withOpacity(0.6),
+ _shadow.withOpacity(0.5),
+ _shadow.withOpacity(0.4),
+ ])),
+ )),
+ Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: Container(
+ height: 32,
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.bottomCenter,
+ end: Alignment.topCenter,
+ colors: [
+ _shadow.withOpacity(1),
+ _shadow.withOpacity(0.9),
+ _shadow.withOpacity(0.8),
+ _shadow.withOpacity(0.6),
+ _shadow.withOpacity(0.5),
+ _shadow.withOpacity(0.4),
+ ])),
+ )),
+ ],
+ ),
);
}
diff --git a/lib/views/profile/general_settings/settings.dart b/lib/views/profile/general_settings/settings.dart
index b82f941..2ace192 100644
--- a/lib/views/profile/general_settings/settings.dart
+++ b/lib/views/profile/general_settings/settings.dart
@@ -69,13 +69,14 @@ class _GeneralSettingsState extends State {
onTap: () => Navigator.of(context).pushNamed(
Routes.notificationTime,
arguments: {
+ "fromFav": false,
'onTimeChanged': () => Future.delayed(
Duration.zero,
() => state.getTime(),
)
},
),
- icon: DidvanIcons.notification_regular,
+ icon: DidvanIcons.notification_solid,
suffix: state.time,
// suffix: 'از${DateTimeUtils.normalizeTimeDuration(
// Duration(minutes: state.notificationTimeRange[0]),
@@ -91,9 +92,9 @@ class _GeneralSettingsState extends State {
child: MenuOption(
title: 'شخصی سازی محتوا',
onTap: () => Navigator.of(context).pushNamed(
- Routes.favouritesStep,
- ),
- icon: DidvanIcons.notification_regular,
+ Routes.favouritesStep,
+ arguments: {"toTimer": false}),
+ icon: DidvanIcons.note_solid,
// suffix: 'از${DateTimeUtils.normalizeTimeDuration(
// Duration(minutes: state.notificationTimeRange[0]),
// )} تا ${DateTimeUtils.normalizeTimeDuration(
diff --git a/lib/views/widgets/didvan/didvan_title_divider.dart b/lib/views/widgets/didvan/didvan_title_divider.dart
index 53b92d3..5ff63c3 100644
--- a/lib/views/widgets/didvan/didvan_title_divider.dart
+++ b/lib/views/widgets/didvan/didvan_title_divider.dart
@@ -4,12 +4,14 @@ import 'package:flutter/material.dart';
import 'text.dart';
import '../ink_wrapper.dart';
-class DidvanTitleDivider extends StatelessWidget{
-
+class DidvanTitleDivider extends StatelessWidget {
final String title;
+ final Icon? icon;
+ final Color? color;
final Function()? onClick;
- const DidvanTitleDivider({super.key, required this.title, this.onClick});
+ const DidvanTitleDivider(
+ {super.key, required this.title, this.onClick, this.icon, this.color});
@override
Widget build(BuildContext context) {
@@ -19,26 +21,36 @@ class DidvanTitleDivider extends StatelessWidget{
children: [
Expanded(
child: Divider(
- height: 1,
- color: Theme.of(context).colorScheme.border,
- )),
+ height: 1,
+ color: Theme.of(context).colorScheme.border,
+ )),
Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
- child: DidvanText(
- title,
- style: Theme.of(context).textTheme.bodySmall,
- color: Theme.of(context).colorScheme.inputText,
+ child: Row(
+ children: [
+ DidvanText(
+ title,
+ style: Theme.of(context).textTheme.bodySmall,
+ color: color != null
+ ? color!
+ : Theme.of(context).colorScheme.inputText,
+ ),
+ icon != null
+ ? Padding(
+ padding: const EdgeInsets.only(right: 8),
+ child: icon!,
+ )
+ : const SizedBox(),
+ ],
),
),
Expanded(
child: Divider(
- height: 1,
- color: Theme.of(context).colorScheme.border,
- )),
+ height: 1,
+ color: Theme.of(context).colorScheme.border,
+ )),
],
),
);
}
-
-
-}
\ No newline at end of file
+}