Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
aymendn committed Apr 6, 2022
1 parent 55814f6 commit c59ce7a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 60 deletions.
Binary file added assets/images/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 0 additions & 59 deletions lib/providers/cart.dart

This file was deleted.

12 changes: 11 additions & 1 deletion lib/providers/foods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,27 @@ class FoodList with ChangeNotifier {
return _foods.where((foodItem) => foodItem.category == category).toList();
}

var initial = 100;

int get credits {
return _credits;
}

void updateCredits() {
_credits = 100;
_credits = initial;
var sum = 0;
for (var food in foods) {
sum += food.price * food.count;
}
_credits -= sum;
notifyListeners();
}

void clear() {
initial = _credits;
for (var food in foods) {
food.count = 0;
}
notifyListeners();
}
}
1 change: 1 addition & 0 deletions lib/screens/needy_demand_screen/needy_demand_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class NeedyDemandScreen extends StatelessWidget {
onTapHome: () {
Navigator.of(context).pushReplacementNamed('/');
},
onTapText: Provider.of<FoodList>(context).clear,
),
),
),
Expand Down
42 changes: 42 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -43,6 +57,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -62,6 +83,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.2"
flutter_lints:
dependency: "direct dev"
description:
Expand All @@ -86,6 +114,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
intl:
dependency: transitive
description:
Expand Down Expand Up @@ -231,6 +266,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.16.1 <3.0.0"
flutter: ">=2.4.0-0.0.pre"
6 changes: 6 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies:
cupertino_icons: ^1.0.2
flutter_svg: ^1.0.3
provider: ^6.0.2
flutter_launcher_icons: ^0.9.2

dev_dependencies:
flutter_test:
Expand All @@ -53,6 +54,11 @@ dev_dependencies:
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

flutte_icons:
android: true
ios: true
image_path: "assets/images/app-icon.png"

# The following section is specific to Flutter.
flutter:

Expand Down

0 comments on commit c59ce7a

Please sign in to comment.