Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -36,7 +36,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.hungry"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="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
Expand Down
13 changes: 8 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.8.0'
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -24,6 +27,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
53 changes: 34 additions & 19 deletions lib/models/core/recipe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ class Recipe {
String time;
String description;

List<Ingridient> ingridients;
List<TutorialStep> tutorial;
List<Review> reviews;
List<Ingridient>? ingridients;
List<TutorialStep>? tutorial;
List<Review>? reviews;

Recipe({this.title, this.photo, this.calories, this.time, this.description, this.ingridients, this.tutorial, this.reviews});
Recipe(
{required this.title,
required this.photo,
required this.calories,
required this.time,
required this.description,
this.ingridients,
this.tutorial,
this.reviews});

factory Recipe.fromJson(Map<String, Object> json) {
factory Recipe.fromJson(Map json) {
return Recipe(
title: json['title'],
photo: json['photo'],
Expand All @@ -24,32 +32,35 @@ class Recipe {

class TutorialStep {
String step;
String description;
TutorialStep({this.step, this.description});
String? description;
TutorialStep({required this.step, this.description});

Map<String, Object> toMap() {
Map<String, dynamic> toMap() {
return {
'step': step,
'description': description,
'description': description ?? '',
};
}

factory TutorialStep.fromJson(Map<String, Object> json) => TutorialStep(
factory TutorialStep.fromJson(Map json) => TutorialStep(
step: json['step'],
description: json['description'],
);

static List<TutorialStep> toList(List<Map<String, Object>> json) {
return List.from(json).map((e) => TutorialStep(step: e['step'], description: e['description'])).toList();
static List<TutorialStep> toList(List<Map<String, dynamic>> json) {
return List.from(json)
.map(
(e) => TutorialStep(step: e['step'], description: e['description']))
.toList();
}
}

class Review {
String username;
String review;
Review({this.username, this.review});
Review({required this.username, required this.review});

factory Review.fromJson(Map<String, Object> json) => Review(
factory Review.fromJson(Map json) => Review(
review: json['review'],
username: json['username'],
);
Expand All @@ -61,17 +72,19 @@ class Review {
};
}

static List<Review> toList(List<Map<String, Object>> json) {
return List.from(json).map((e) => Review(username: e['username'], review: e['review'])).toList();
static List<Review> toList(List<Map<String, dynamic>> json) {
return List.from(json)
.map((e) => Review(username: e['username'], review: e['review']))
.toList();
}
}

class Ingridient {
String name;
String size;

Ingridient({this.name, this.size});
factory Ingridient.fromJson(Map<String, Object> json) => Ingridient(
Ingridient({required this.name, required this.size});
factory Ingridient.fromJson(Map<String, dynamic> json) => Ingridient(
name: json['name'],
size: json['size'],
);
Expand All @@ -84,6 +97,8 @@ class Ingridient {
}

static List<Ingridient> toList(List<Map<String, Object>> json) {
return List.from(json).map((e) => Ingridient(name: e['name'], size: e['size'])).toList();
return List.from(json)
.map((e) => Ingridient(name: e['name'], size: e['size']))
.toList();
}
}
Loading