Skip to content

Commit e909a88

Browse files
improvement, network streaming,internet error and something went wrong screen added"
1 parent 61cbdbf commit e909a88

File tree

80 files changed

+1617
-1708
lines changed

Some content is hidden

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

80 files changed

+1617
-1708
lines changed

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1-
# Provider Pattern
1+
#Flutter-MVC
22

3-
Repo for provider pattern in flutter
3+
Repo For MVC Pattern In Flutter.
44

5-
#SDK used Flutter 3.3.1 • channel stable Dart 2.18.0 • DevTools 2.15.0
5+
#Write Project Objective In This Place For Another Developer Knowledge;
6+
7+
#SDK used Flutter 3.19.3 • channel stable Dart 3.3.1 • DevTools 2.31.1
68

79
Code Generation This project uses code generation using built_value for generating code related to
810
json serialization/deserialization. The generated part files are put in .gitignore. So in order to
9-
generate those files run the following command:
11+
generate those files run the following command:
1012
#flutter pub run build_runner build --delete-conflicting-outputs
13+
14+
#Api:- maintain these response on each scenario:-
15+
1.) ResponseCode key which is int type like:- 200,201,204;
16+
2.) ResponseMessage key which is String type, this is contain all error and success msg;
17+
3.) Succeeded key which is bool type, this will contain api response is true or false like
18+
success or any error found;
19+
4.) ResponseBody key which is object type, contain all type of data in object when data is not available it can be null;
20+
Example:-
21+
(Api Success):- {
22+
“ResponseCode”:200,
23+
“ResponseMessage”: “logged in Successfully”,
24+
“Succeeded”:true,
25+
“ResponseBody”:{
26+
“id”:id123455,
27+
“name”: “User Name”
28+
“Profile”: “www.profile.xn--com-9o0a
29+
}
30+
}
31+
(Api Error):- {
32+
“ResponseCode”:201,
33+
“ResponseMessage”: “User And Password not matched”,
34+
“Succeeded”:false,
35+
“ResponseBody”:null
36+
}
37+
}
38+
39+

android/app/build.gradle

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
// id "com.google.gms.google-services"
6+
7+
}
8+
19
def localProperties = new Properties()
210
def localPropertiesFile = rootProject.file('local.properties')
311
if (localPropertiesFile.exists()) {
@@ -6,11 +14,6 @@ if (localPropertiesFile.exists()) {
614
}
715
}
816

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1417
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1518
if (flutterVersionCode == null) {
1619
flutterVersionCode = '1'
@@ -21,12 +24,9 @@ if (flutterVersionName == null) {
2124
flutterVersionName = '1.0'
2225
}
2326

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2827
android {
29-
compileSdkVersion flutter.compileSdkVersion
28+
namespace "flutter.mvc.app"
29+
compileSdkVersion 34
3030
ndkVersion flutter.ndkVersion
3131

3232
compileOptions {
@@ -43,12 +43,9 @@ android {
4343
}
4444

4545
defaultConfig {
46-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47-
applicationId "com.interview.task.interview_task"
48-
// You can update the following values to match your application needs.
49-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50-
minSdkVersion flutter.minSdkVersion
51-
targetSdkVersion flutter.targetSdkVersion
46+
applicationId "flutter.mvc.app"
47+
minSdkVersion 21
48+
targetSdkVersion 34
5249
versionCode flutterVersionCode.toInteger()
5350
versionName flutterVersionName
5451
}
@@ -67,5 +64,5 @@ flutter {
6764
}
6865

6966
dependencies {
70-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
67+
implementation(platform("com.google.firebase:firebase-bom:32.7.2"))
7168
}

android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.interview.task.interview_task">
2+
package="flutter.mvc.app">
33
<!-- The INTERNET permission is required for development. Specifically,
44
the Flutter tool needs it to communicate with the running application
55
to allow setting breakpoints, to provide hot reload, etc.

android/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.interview.task.interview_task">
2+
package="flutter.mvc.app">
3+
4+
<uses-permission android:name="android.permission.INTERNET"/>
35
<application
4-
android:label="interview_task"
6+
android:label="MVC-Flutter"
57
android:name="${applicationName}"
68
android:icon="@mipmap/ic_launcher">
79
<activity

android/app/src/main/kotlin/com/interview/task/interview_task/MainActivity.kt renamed to android/app/src/main/kotlin/flutter/mvc/app/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.interview.task.interview_task
1+
package flutter.mvc.app
22

33
import io.flutter.embedding.android.FlutterActivity
44

android/app/src/profile/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.interview.task.interview_task">
2+
package="flutter.mvc.app">
33
<!-- The INTERNET permission is required for development. Specifically,
44
the Flutter tool needs it to communicate with the running application
55
to allow setting breakpoints, to provide hot reload, etc.

android/build.gradle

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
@@ -26,6 +13,6 @@ subprojects {
2613
project.evaluationDependsOn(':app')
2714
}
2815

29-
task clean(type: Delete) {
16+
tasks.register("clean", Delete) {
3017
delete rootProject.buildDir
3118
}

android/settings.gradle

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}
9+
settings.ext.flutterSdkPath = flutterSdkPath()
210

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
11+
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
512

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
18+
}
819

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
20+
plugins {
21+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22+
id "com.android.application" version "7.3.0" apply false
23+
// id "com.google.gms.google-services" version "4.4.1" apply false
24+
id "org.jetbrains.kotlin.android" version "1.8.21" apply false
25+
}
26+
27+
include ":app"

assets/error_png/no_image.jpeg

12.9 KB
Loading

assets/error_png/no_internet.png

24.2 KB
Loading

assets/error_png/something_wrong.png

17.8 KB
Loading

assets/icons/facebook_icon.png

-15.5 KB
Binary file not shown.

assets/icons/google-icon.webp

-6.41 KB
Binary file not shown.

assets/icons/linkdin.png

-12.3 KB
Binary file not shown.

lib/data/local/shared_pref_helper.dart renamed to lib/data/local/local_storage.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ class Prefs {
1111
prefs = await SharedPreferences.getInstance();
1212
}
1313

14-
static final localData = SharedPrefValue<String>('local_data', prefs);
15-
static final email = SharedPrefValue<String>('_email', prefs);
16-
static final password = SharedPrefValue<String>('_password', prefs);
17-
static final remember = SharedPrefValue<bool>('_is_remember', prefs);
14+
static final example = SharedPrefValue<String>('_example', prefs);
15+
static final theme = SharedPrefValue<String>('_theme', prefs);
1816

1917
static void clear() {
2018
prefs.clear();

lib/data/remote/date_time_serializers.dart

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/data/remote/endpoints.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
class Endpoints {
2+
//Sample Api Url https://mocki.io/v1/39ab1e09-d0f9-4e53-9bf5-f1b5f20f0935
23
Endpoints._();
34

45
//base url
5-
static const baseUrl = 'https://api.coindesk.com/v1/';
6-
static const authority = 'api.coindesk.com';
7-
static const path = '/v1/bpi';
6+
static const baseUrl = 'https://mocki.io/';
7+
static const authority = 'mocki.io';
8+
static const path = 'v1';
89

910
// auth APIs
10-
static const getCurrency = 'currentprice.json';
11+
static const getProduct = '39ab1e09-d0f9-4e53-9bf5-f1b5f20f0935';
1112
}

lib/data/remote/logging_interceptor.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import 'dart:convert';
22
import 'dart:developer' as developer;
3+
34
import 'package:http_interceptor/http_interceptor.dart';
4-
import 'package:interview_task/data/utils/log_tags.dart';
5+
import 'package:mvc_flutter/data/utils/log_tags.dart';
56

67
class LoggingInterceptor implements InterceptorContract {
78
@override
@@ -12,7 +13,8 @@ class LoggingInterceptor implements InterceptorContract {
1213

1314
@override
1415
Future<ResponseData> interceptResponse({required ResponseData data}) async {
15-
developer.log('>>>----------->>>calling api ${data.url}', name: LogTags.apiCall);
16+
developer.log('>>>----------->>>calling api ${data.url}',
17+
name: LogTags.apiCall);
1618
developer.log('Headers:- ');
1719
developer.log(data.request?.headers.toString() ?? '');
1820
developer.log('Request body:- ', name: LogTags.apiCall);
@@ -49,4 +51,4 @@ class LoggingInterceptor implements InterceptorContract {
4951
);
5052
return data;
5153
}
52-
}
54+
}

lib/data/remote/model/bpi.dart

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)