Moved veggieseasons out of experimental (#752)
45
veggieseasons/.gitignore
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# This app is designed to show how to use Flutter's cupertino package to build UI for iOS. It's not intended to run on Android, desktop, or web.
|
||||
android
|
||||
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code related
|
||||
.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
|
||||
|
||||
# Exceptions to above rules.
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
10
veggieseasons/.metadata
Normal file
@@ -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: 9299c02cf708497d6f72edda8efae0bb8340660e
|
||||
channel: beta
|
||||
|
||||
project_type: app
|
||||
@@ -1,15 +1,42 @@
|
||||
# Veggie Seasons
|
||||
|
||||
The Veggie Seasons app has temporarily been moved to the
|
||||
[experimental](https://github.com/flutter/samples/tree/master/experimental/veggieseasons)
|
||||
directory of this repository due to the integration of state restoration into
|
||||
the app. Not all features of state restoration are available on the stable
|
||||
channel of flutter yet. Once commit
|
||||
[flutter/flutter@053ebf2](https://github.com/flutter/flutter/commit/053ebf2c080c7b8efbf4020683a5ba27d9daa3b8)
|
||||
has reached the stable channel, the app can move back to its old home in
|
||||
this directory.
|
||||
An iOS app that shows which fruits and vegetables are currently in season. It
|
||||
showcases Flutter's Cupertino package.
|
||||
|
||||
For more info on how to run the samples in the `experimental` directory,
|
||||
see the
|
||||
[README](https://github.com/flutter/samples/tree/master/experimental/README.md)
|
||||
in that folder.
|
||||
[Available now in the App Store!](https://itunes.apple.com/is/app/veggie-seasons/id1450855435)
|
||||
|
||||
**NOTE:** While Flutter supports many platforms, this application is designed
|
||||
specifically for iOS. It's not intended to be run on Android, web, or desktop.
|
||||
|
||||
## Goals
|
||||
|
||||
* Show how to build an interface that iOS users will feel right at home
|
||||
with.
|
||||
* Show how Flutter's Cupertino widgets work together.
|
||||
|
||||
## The important bits
|
||||
|
||||
### `/screens/*`
|
||||
|
||||
These are the screens presented in the app, roughly analogous to
|
||||
UIViewControllers. `HomeScreen` is the root, and the others are shown
|
||||
as the user navigates.
|
||||
|
||||
### `/widgets/search_bar.dart`
|
||||
|
||||
An example of how to construct an Cupertino-style search bar. The
|
||||
Flutter team [is working on an official widget](https://github.com/flutter/flutter/issues/9784)
|
||||
for this. Once that effort is complete, developers will not need to roll
|
||||
their own search bars, so to speak.
|
||||
|
||||
## Questions/issues
|
||||
|
||||
If you have a general question about any of the techniques you see in
|
||||
the sample, the best places to go are:
|
||||
|
||||
* [The FlutterDev Google Group](https://groups.google.com/forum/#!forum/flutter-dev)
|
||||
* [The Flutter Gitter channel](https://gitter.im/flutter/flutter)
|
||||
* [StackOverflow](https://stackoverflow.com/questions/tagged/flutter)
|
||||
|
||||
If you run into an issue with the sample itself, please file an issue
|
||||
in the [main Flutter repo](https://github.com/flutter/flutter/issues).
|
||||
|
||||
31
veggieseasons/analysis_options.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
BIN
veggieseasons/assets/fonts/NotoSans-Bold.ttf
Executable file
BIN
veggieseasons/assets/fonts/NotoSans-BoldItalic.ttf
Executable file
BIN
veggieseasons/assets/fonts/NotoSans-Italic.ttf
Executable file
BIN
veggieseasons/assets/fonts/NotoSans-Regular.ttf
Executable file
BIN
veggieseasons/assets/icon/launcher_icon.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
veggieseasons/assets/images/apple.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
veggieseasons/assets/images/artichoke.jpg
Normal file
|
After Width: | Height: | Size: 197 KiB |
BIN
veggieseasons/assets/images/asparagus.jpg
Normal file
|
After Width: | Height: | Size: 210 KiB |
BIN
veggieseasons/assets/images/avocado.jpg
Normal file
|
After Width: | Height: | Size: 155 KiB |
BIN
veggieseasons/assets/images/blackberry.jpg
Normal file
|
After Width: | Height: | Size: 305 KiB |
BIN
veggieseasons/assets/images/cantaloupe.jpg
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
veggieseasons/assets/images/cauliflower.jpg
Normal file
|
After Width: | Height: | Size: 281 KiB |
BIN
veggieseasons/assets/images/endive.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
veggieseasons/assets/images/fig.jpg
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
veggieseasons/assets/images/grape.jpg
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
veggieseasons/assets/images/green_bell_pepper.jpg
Normal file
|
After Width: | Height: | Size: 146 KiB |
BIN
veggieseasons/assets/images/habanero.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
veggieseasons/assets/images/kale.jpg
Normal file
|
After Width: | Height: | Size: 271 KiB |
BIN
veggieseasons/assets/images/kiwi.jpg
Normal file
|
After Width: | Height: | Size: 187 KiB |
BIN
veggieseasons/assets/images/lemon.jpg
Normal file
|
After Width: | Height: | Size: 134 KiB |
BIN
veggieseasons/assets/images/lime.jpg
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
veggieseasons/assets/images/mango.jpg
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
veggieseasons/assets/images/mushroom.jpg
Normal file
|
After Width: | Height: | Size: 198 KiB |
BIN
veggieseasons/assets/images/nectarine.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
veggieseasons/assets/images/orange_bell_pepper.jpg
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
veggieseasons/assets/images/persimmon.jpg
Normal file
|
After Width: | Height: | Size: 168 KiB |
BIN
veggieseasons/assets/images/plum.jpg
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
veggieseasons/assets/images/potato.jpg
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
veggieseasons/assets/images/radicchio.jpg
Normal file
|
After Width: | Height: | Size: 214 KiB |
BIN
veggieseasons/assets/images/radish.jpg
Normal file
|
After Width: | Height: | Size: 225 KiB |
BIN
veggieseasons/assets/images/squash.jpg
Normal file
|
After Width: | Height: | Size: 106 KiB |
BIN
veggieseasons/assets/images/strawberry.jpg
Normal file
|
After Width: | Height: | Size: 274 KiB |
BIN
veggieseasons/assets/images/tangelo.jpg
Normal file
|
After Width: | Height: | Size: 196 KiB |
BIN
veggieseasons/assets/images/tomato.jpg
Normal file
|
After Width: | Height: | Size: 178 KiB |
BIN
veggieseasons/assets/images/watermelon.jpg
Normal file
|
After Width: | Height: | Size: 190 KiB |
32
veggieseasons/ios/.gitignore
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
*.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/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
|
||||
26
veggieseasons/ios/Flutter/AppFrameworkInfo.plist
Normal file
@@ -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>$(DEVELOPMENT_LANGUAGE)</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>8.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
3
veggieseasons/ios/Flutter/Debug.xcconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
3
veggieseasons/ios/Flutter/Release.xcconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
41
veggieseasons/ios/Podfile
Normal file
@@ -0,0 +1,41 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
22
veggieseasons/ios/Podfile.lock
Normal file
@@ -0,0 +1,22 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- shared_preferences (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
shared_preferences:
|
||||
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
|
||||
|
||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||
576
veggieseasons/ios/Runner.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,576 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
2E95CE9079F9F85ED7195813 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AD80F83341224E3A8E331A3 /* Pods_Runner.framework */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0AD80F83341224E3A8E331A3 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
4AD930A692F4F8E268DBD0A5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
AD1A5E1763BFC877DB2B446F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
FA5155759DF040A4C0CC04E0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2E95CE9079F9F85ED7195813 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
22B442D4168A7B892F29E026 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0AD80F83341224E3A8E331A3 /* Pods_Runner.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7C8B7C066005877B50E89DBE /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AD1A5E1763BFC877DB2B446F /* Pods-Runner.debug.xcconfig */,
|
||||
4AD930A692F4F8E268DBD0A5 /* Pods-Runner.release.xcconfig */,
|
||||
FA5155759DF040A4C0CC04E0 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
7C8B7C066005877B50E89DBE /* Pods */,
|
||||
22B442D4168A7B892F29E026 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
97C146F11CF9000F007C117D /* Supporting Files */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F11CF9000F007C117D /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
E3A3864E2B275E7A06552155 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
8F50AE35C319C5A3612840AA /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
8F50AE35C319C5A3612840AA /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
|
||||
"${PODS_ROOT}/../Flutter/Flutter.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
E3A3864E2B275E7A06552155 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
249021D3217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
249021D4217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.VeggieSeasons;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.VeggieSeasons;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
MARKETING_VERSION = 1.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.VeggieSeasons;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
249021D3217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
249021D4217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
7
veggieseasons/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
10
veggieseasons/ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
13
veggieseasons/ios/Runner/AppDelegate.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 685 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
23
veggieseasons/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
veggieseasons/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
BIN
veggieseasons/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
BIN
veggieseasons/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 68 B |
5
veggieseasons/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
37
veggieseasons/ios/Runner/Base.lproj/LaunchScreen.storyboard
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
26
veggieseasons/ios/Runner/Base.lproj/Main.storyboard
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController restorationIdentifier="main" id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
46
veggieseasons/ios/Runner/Info.plist
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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>CFBundleDisplayName</key>
|
||||
<string>Veg. Seasons</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>veggieseasons</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
1
veggieseasons/ios/Runner/Runner-Bridging-Header.h
Normal file
@@ -0,0 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
80
veggieseasons/lib/data/app_state.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:veggieseasons/data/local_veggie_provider.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
|
||||
class AppState extends ChangeNotifier {
|
||||
final List<Veggie> _veggies;
|
||||
|
||||
AppState() : _veggies = LocalVeggieProvider.veggies;
|
||||
|
||||
List<Veggie> get allVeggies => List<Veggie>.from(_veggies);
|
||||
|
||||
List<Veggie> get availableVeggies {
|
||||
var currentSeason = _getSeasonForDate(DateTime.now());
|
||||
return _veggies.where((v) => v.seasons.contains(currentSeason)).toList();
|
||||
}
|
||||
|
||||
List<Veggie> get favoriteVeggies =>
|
||||
_veggies.where((v) => v.isFavorite).toList();
|
||||
|
||||
List<Veggie> get unavailableVeggies {
|
||||
var currentSeason = _getSeasonForDate(DateTime.now());
|
||||
return _veggies.where((v) => !v.seasons.contains(currentSeason)).toList();
|
||||
}
|
||||
|
||||
Veggie getVeggie(int id) => _veggies.singleWhere((v) => v.id == id);
|
||||
|
||||
List<Veggie> searchVeggies(String terms) => _veggies
|
||||
.where((v) => v.name.toLowerCase().contains(terms.toLowerCase()))
|
||||
.toList();
|
||||
|
||||
void setFavorite(int id, bool isFavorite) {
|
||||
var veggie = getVeggie(id);
|
||||
veggie.isFavorite = isFavorite;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Used in tests to set the season independent of the current date.
|
||||
static Season debugCurrentSeason;
|
||||
|
||||
static Season _getSeasonForDate(DateTime date) {
|
||||
if (debugCurrentSeason != null) {
|
||||
return debugCurrentSeason;
|
||||
}
|
||||
|
||||
// Technically the start and end dates of seasons can vary by a day or so,
|
||||
// but this is close enough for produce.
|
||||
switch (date.month) {
|
||||
case 1:
|
||||
return Season.winter;
|
||||
case 2:
|
||||
return Season.winter;
|
||||
case 3:
|
||||
return date.day < 21 ? Season.winter : Season.spring;
|
||||
case 4:
|
||||
return Season.spring;
|
||||
case 5:
|
||||
return Season.spring;
|
||||
case 6:
|
||||
return date.day < 21 ? Season.spring : Season.summer;
|
||||
case 7:
|
||||
return Season.summer;
|
||||
case 8:
|
||||
return Season.summer;
|
||||
case 9:
|
||||
return date.day < 22 ? Season.autumn : Season.winter;
|
||||
case 10:
|
||||
return Season.autumn;
|
||||
case 11:
|
||||
return Season.autumn;
|
||||
case 12:
|
||||
return date.day < 22 ? Season.autumn : Season.winter;
|
||||
default:
|
||||
throw ArgumentError('Can\'t return a season for month #${date.month}.');
|
||||
}
|
||||
}
|
||||
}
|
||||
1398
veggieseasons/lib/data/local_veggie_provider.dart
Normal file
90
veggieseasons/lib/data/preferences.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// A model class that mirrors the options in [SettingsScreen] and stores data
|
||||
/// in shared preferences.
|
||||
class Preferences extends ChangeNotifier {
|
||||
// Keys to use with shared preferences.
|
||||
static const _caloriesKey = 'calories';
|
||||
static const _preferredCategoriesKey = 'preferredCategories';
|
||||
|
||||
// Indicates whether a call to [_loadFromSharedPrefs] is in progress;
|
||||
Future<void> _loading;
|
||||
|
||||
int _desiredCalories = 2000;
|
||||
|
||||
final Set<VeggieCategory> _preferredCategories = <VeggieCategory>{};
|
||||
|
||||
Future<int> get desiredCalories async {
|
||||
await _loading;
|
||||
return _desiredCalories;
|
||||
}
|
||||
|
||||
Future<Set<VeggieCategory>> get preferredCategories async {
|
||||
await _loading;
|
||||
return Set.from(_preferredCategories);
|
||||
}
|
||||
|
||||
Future<void> addPreferredCategory(VeggieCategory category) async {
|
||||
_preferredCategories.add(category);
|
||||
await _saveToSharedPrefs();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> removePreferredCategory(VeggieCategory category) async {
|
||||
_preferredCategories.remove(category);
|
||||
await _saveToSharedPrefs();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> setDesiredCalories(int calories) async {
|
||||
_desiredCalories = calories;
|
||||
await _saveToSharedPrefs();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> restoreDefaults() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
load();
|
||||
}
|
||||
|
||||
void load() {
|
||||
_loading = _loadFromSharedPrefs();
|
||||
}
|
||||
|
||||
Future<void> _saveToSharedPrefs() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setInt(_caloriesKey, _desiredCalories);
|
||||
|
||||
// Store preferred categories as a comma-separated string containing their
|
||||
// indices.
|
||||
await prefs.setString(_preferredCategoriesKey,
|
||||
_preferredCategories.map((c) => c.index.toString()).join(','));
|
||||
}
|
||||
|
||||
Future<void> _loadFromSharedPrefs() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
_desiredCalories = prefs.getInt(_caloriesKey) ?? 2000;
|
||||
_preferredCategories.clear();
|
||||
final names = prefs.getString(_preferredCategoriesKey);
|
||||
|
||||
if (names != null && names.isNotEmpty) {
|
||||
for (final name in names.split(',')) {
|
||||
final index = int.tryParse(name) ?? -1;
|
||||
if (VeggieCategory.values[index] != null) {
|
||||
_preferredCategories.add(VeggieCategory.values[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
131
veggieseasons/lib/data/veggie.dart
Normal file
@@ -0,0 +1,131 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
enum VeggieCategory {
|
||||
allium,
|
||||
berry,
|
||||
citrus,
|
||||
cruciferous,
|
||||
fern,
|
||||
flower,
|
||||
fruit,
|
||||
fungus,
|
||||
gourd,
|
||||
leafy,
|
||||
legume,
|
||||
melon,
|
||||
root,
|
||||
stealthFruit,
|
||||
stoneFruit,
|
||||
tropical,
|
||||
tuber,
|
||||
vegetable,
|
||||
}
|
||||
|
||||
enum Season {
|
||||
winter,
|
||||
spring,
|
||||
summer,
|
||||
autumn,
|
||||
}
|
||||
|
||||
class Trivia {
|
||||
final String question;
|
||||
final List<String> answers;
|
||||
final int correctAnswerIndex;
|
||||
|
||||
const Trivia(this.question, this.answers, this.correctAnswerIndex);
|
||||
}
|
||||
|
||||
const Map<VeggieCategory, String> veggieCategoryNames = {
|
||||
VeggieCategory.allium: 'Allium',
|
||||
VeggieCategory.berry: 'Berry',
|
||||
VeggieCategory.citrus: 'Citrus',
|
||||
VeggieCategory.cruciferous: 'Cruciferous',
|
||||
VeggieCategory.fern: 'Technically a fern',
|
||||
VeggieCategory.flower: 'Flower',
|
||||
VeggieCategory.fruit: 'Fruit',
|
||||
VeggieCategory.fungus: 'Fungus',
|
||||
VeggieCategory.gourd: 'Gourd',
|
||||
VeggieCategory.leafy: 'Leafy',
|
||||
VeggieCategory.legume: 'Legume',
|
||||
VeggieCategory.melon: 'Melon',
|
||||
VeggieCategory.root: 'Root vegetable',
|
||||
VeggieCategory.stealthFruit: 'Stealth fruit',
|
||||
VeggieCategory.stoneFruit: 'Stone fruit',
|
||||
VeggieCategory.tropical: 'Tropical',
|
||||
VeggieCategory.tuber: 'Tuber',
|
||||
VeggieCategory.vegetable: 'Vegetable',
|
||||
};
|
||||
|
||||
const Map<Season, String> seasonNames = {
|
||||
Season.winter: 'Winter',
|
||||
Season.spring: 'Spring',
|
||||
Season.summer: 'Summer',
|
||||
Season.autumn: 'Autumn',
|
||||
};
|
||||
|
||||
class Veggie {
|
||||
Veggie({
|
||||
@required this.id,
|
||||
@required this.name,
|
||||
@required this.imageAssetPath,
|
||||
@required this.category,
|
||||
@required this.shortDescription,
|
||||
@required this.accentColor,
|
||||
@required this.seasons,
|
||||
@required this.vitaminAPercentage,
|
||||
@required this.vitaminCPercentage,
|
||||
@required this.servingSize,
|
||||
@required this.caloriesPerServing,
|
||||
@required this.trivia,
|
||||
this.isFavorite = false,
|
||||
});
|
||||
|
||||
final int id;
|
||||
|
||||
final String name;
|
||||
|
||||
/// Each veggie has an associated image asset that's used as a background
|
||||
/// image and icon.
|
||||
final String imageAssetPath;
|
||||
|
||||
final VeggieCategory category;
|
||||
|
||||
/// A short, snappy line.
|
||||
final String shortDescription;
|
||||
|
||||
/// A color value to use when constructing UI elements to match the image
|
||||
/// found at [imageAssetPath].
|
||||
final Color accentColor;
|
||||
|
||||
/// Seasons during which a veggie is harvested.
|
||||
final List<Season> seasons;
|
||||
|
||||
/// Percentage of the FDA's recommended daily value of vitamin A for someone
|
||||
/// with a 2,000 calorie diet.
|
||||
final int vitaminAPercentage;
|
||||
|
||||
/// Percentage of the FDA's recommended daily value of vitamin C for someone
|
||||
/// with a 2,000 calorie diet.
|
||||
final int vitaminCPercentage;
|
||||
|
||||
/// A text description of a single serving (e.g. '1 apple' or '1/2 cup').
|
||||
final String servingSize;
|
||||
|
||||
/// Calories per serving (as described in [servingSize]).
|
||||
final int caloriesPerServing;
|
||||
|
||||
/// Whether or not the veggie has been saved to the user's garden (i.e. marked
|
||||
/// as a favorite).
|
||||
bool isFavorite;
|
||||
|
||||
/// A set of trivia questions and answers related to the veggie.
|
||||
final List<Trivia> trivia;
|
||||
|
||||
String get categoryName => veggieCategoryNames[category];
|
||||
}
|
||||
91
veggieseasons/lib/main.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart' show DeviceOrientation, SystemChrome;
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/preferences.dart';
|
||||
import 'package:veggieseasons/screens/home.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
|
||||
runApp(
|
||||
RootRestorationScope(
|
||||
restorationId: 'root',
|
||||
child: VeggieApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class VeggieApp extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _VeggieAppState();
|
||||
}
|
||||
|
||||
class _VeggieAppState extends State<VeggieApp> with RestorationMixin {
|
||||
final _RestorableAppState _appState = _RestorableAppState();
|
||||
|
||||
@override
|
||||
String get restorationId => 'wrapper';
|
||||
|
||||
@override
|
||||
void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
registerForRestoration(_appState, 'state');
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_appState.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider.value(
|
||||
value: _appState.value,
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => Preferences()..load(),
|
||||
),
|
||||
],
|
||||
child: CupertinoApp(
|
||||
theme: Styles.veggieThemeData,
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: HomeScreen(restorationId: 'home'),
|
||||
restorationScopeId: 'app',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RestorableAppState extends RestorableListenable<AppState> {
|
||||
@override
|
||||
AppState createDefaultValue() {
|
||||
return AppState();
|
||||
}
|
||||
|
||||
@override
|
||||
AppState fromPrimitives(Object data) {
|
||||
final appState = AppState();
|
||||
final favorites = (data as List<dynamic>).cast<int>();
|
||||
for (var id in favorites) {
|
||||
appState.setFavorite(id, true);
|
||||
}
|
||||
return appState;
|
||||
}
|
||||
|
||||
@override
|
||||
Object toPrimitives() {
|
||||
return value.favoriteVeggies.map((veggie) => veggie.id).toList();
|
||||
}
|
||||
}
|
||||
350
veggieseasons/lib/screens/details.dart
Normal file
@@ -0,0 +1,350 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/preferences.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
import 'package:veggieseasons/widgets/close_button.dart';
|
||||
import 'package:veggieseasons/widgets/trivia.dart';
|
||||
|
||||
class ServingInfoChart extends StatelessWidget {
|
||||
const ServingInfoChart(this.veggie, this.prefs);
|
||||
|
||||
final Veggie veggie;
|
||||
|
||||
final Preferences prefs;
|
||||
|
||||
// Creates a [Text] widget to display a veggie's "percentage of your daily
|
||||
// value of this vitamin" data adjusted for the user's preferred calorie
|
||||
// target.
|
||||
Widget _buildVitaminText(int standardPercentage, Future<int> targetCalories) {
|
||||
return FutureBuilder<int>(
|
||||
future: targetCalories,
|
||||
builder: (context, snapshot) {
|
||||
final target = snapshot?.data ?? 2000;
|
||||
final percent = standardPercentage * 2000 ~/ target;
|
||||
|
||||
return Text(
|
||||
'$percent% DV',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 9,
|
||||
bottom: 4,
|
||||
),
|
||||
child: Text(
|
||||
'Serving info',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Styles.servingInfoBorderColor),
|
||||
),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Text(
|
||||
'Serving size:',
|
||||
style: Styles.detailsServingLabelText(themeData),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Text(
|
||||
veggie.servingSize,
|
||||
textAlign: TextAlign.end,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Text(
|
||||
'Calories:',
|
||||
style: Styles.detailsServingLabelText(themeData),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: Text(
|
||||
'${veggie.caloriesPerServing} kCal',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Text(
|
||||
'Vitamin A:',
|
||||
style: Styles.detailsServingLabelText(themeData),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: _buildVitaminText(
|
||||
veggie.vitaminAPercentage,
|
||||
prefs.desiredCalories,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
child: Text(
|
||||
'Vitamin C:',
|
||||
style: Styles.detailsServingLabelText(themeData),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
child: _buildVitaminText(
|
||||
veggie.vitaminCPercentage,
|
||||
prefs.desiredCalories,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: FutureBuilder(
|
||||
future: prefs.desiredCalories,
|
||||
builder: (context, snapshot) {
|
||||
return Text(
|
||||
'Percent daily values based on a diet of '
|
||||
'${snapshot?.data ?? '2,000'} calories.',
|
||||
style: Styles.detailsServingNoteText(themeData),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InfoView extends StatelessWidget {
|
||||
final int id;
|
||||
|
||||
const InfoView(this.id);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appState = Provider.of<AppState>(context);
|
||||
final prefs = Provider.of<Preferences>(context);
|
||||
final veggie = appState.getVeggie(id);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
FutureBuilder<Set<VeggieCategory>>(
|
||||
future: prefs.preferredCategories,
|
||||
builder: (context, snapshot) {
|
||||
return Text(
|
||||
veggie.categoryName.toUpperCase(),
|
||||
style: (snapshot.hasData &&
|
||||
snapshot.data.contains(veggie.category))
|
||||
? Styles.detailsPreferredCategoryText(themeData)
|
||||
: themeData.textTheme.textStyle,
|
||||
);
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
for (Season season in veggie.seasons) ...[
|
||||
SizedBox(width: 12),
|
||||
Padding(
|
||||
padding: Styles.seasonIconPadding[season],
|
||||
child: Icon(
|
||||
Styles.seasonIconData[season],
|
||||
semanticLabel: seasonNames[season],
|
||||
color: Styles.seasonColors[season],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.detailsTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
ServingInfoChart(veggie, prefs),
|
||||
SizedBox(height: 24),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CupertinoSwitch(
|
||||
value: veggie.isFavorite,
|
||||
onChanged: (value) {
|
||||
appState.setFavorite(id, value);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Save to Garden',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DetailsScreen extends StatefulWidget {
|
||||
final int id;
|
||||
final String restorationId;
|
||||
|
||||
DetailsScreen({this.id, this.restorationId});
|
||||
|
||||
static String show(NavigatorState navigator, int veggieId) {
|
||||
return navigator.restorablePush<void>(_routeBuilder, arguments: veggieId);
|
||||
}
|
||||
|
||||
static Route<void> _routeBuilder(BuildContext context, Object arguments) {
|
||||
final veggieId = arguments as int;
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
DetailsScreen(id: veggieId, restorationId: 'details'),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
_DetailsScreenState createState() => _DetailsScreenState();
|
||||
}
|
||||
|
||||
class _DetailsScreenState extends State<DetailsScreen> with RestorationMixin {
|
||||
final RestorableInt _selectedViewIndex = RestorableInt(0);
|
||||
|
||||
@override
|
||||
String get restorationId => widget.restorationId;
|
||||
|
||||
@override
|
||||
void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
registerForRestoration(_selectedViewIndex, 'tab');
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_selectedViewIndex.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _buildHeader(BuildContext context, AppState model) {
|
||||
final veggie = model.getVeggie(widget.id);
|
||||
|
||||
return SizedBox(
|
||||
height: 150,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
right: 0,
|
||||
left: 0,
|
||||
child: Image.asset(
|
||||
veggie.imageAssetPath,
|
||||
fit: BoxFit.cover,
|
||||
semanticLabel: 'A background image of ${veggie.name}',
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 16,
|
||||
left: 16,
|
||||
child: SafeArea(
|
||||
child: CloseButton(() {
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appState = Provider.of<AppState>(context);
|
||||
|
||||
return UnmanagedRestorationScope(
|
||||
bucket: bucket,
|
||||
child: CupertinoPageScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView(
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
_buildHeader(context, appState),
|
||||
SizedBox(height: 20),
|
||||
CupertinoSegmentedControl<int>(
|
||||
children: {
|
||||
0: Text(
|
||||
'Facts & Info',
|
||||
),
|
||||
1: Text(
|
||||
'Trivia',
|
||||
)
|
||||
},
|
||||
groupValue: _selectedViewIndex.value,
|
||||
onValueChanged: (value) {
|
||||
setState(() => _selectedViewIndex.value = value);
|
||||
},
|
||||
),
|
||||
_selectedViewIndex.value == 0
|
||||
? InfoView(widget.id)
|
||||
: TriviaView(id: widget.id, restorationId: 'trivia'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
53
veggieseasons/lib/screens/favorites.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
||||
|
||||
class FavoritesScreen extends StatelessWidget {
|
||||
FavoritesScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoTabView(
|
||||
restorationScopeId: restorationId,
|
||||
builder: (context) {
|
||||
final model = Provider.of<AppState>(context);
|
||||
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('My Garden'),
|
||||
),
|
||||
child: Center(
|
||||
child: model.favoriteVeggies.isEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
'You haven\'t added any favorite veggies to your garden yet.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
)
|
||||
: ListView(
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
SizedBox(height: 24),
|
||||
for (Veggie veggie in model.favoriteVeggies)
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 0, 16, 24),
|
||||
child: VeggieHeadline(veggie),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
55
veggieseasons/lib/screens/home.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:veggieseasons/screens/favorites.dart';
|
||||
import 'package:veggieseasons/screens/list.dart';
|
||||
import 'package:veggieseasons/screens/search.dart';
|
||||
import 'package:veggieseasons/screens/settings.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
HomeScreen({Key key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoTabScaffold(
|
||||
restorationId: 'scaffold',
|
||||
tabBar: CupertinoTabBar(items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(CupertinoIcons.home),
|
||||
label: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(CupertinoIcons.book),
|
||||
label: 'My Garden',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(CupertinoIcons.search),
|
||||
label: 'Search',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(CupertinoIcons.settings),
|
||||
label: 'Settings',
|
||||
),
|
||||
]),
|
||||
tabBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return ListScreen(restorationId: 'list');
|
||||
} else if (index == 1) {
|
||||
return FavoritesScreen(restorationId: 'favorites');
|
||||
} else if (index == 2) {
|
||||
return SearchScreen(restorationId: 'search');
|
||||
} else {
|
||||
return SettingsScreen(restorationId: 'settings');
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
91
veggieseasons/lib/screens/list.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/preferences.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_card.dart';
|
||||
|
||||
class ListScreen extends StatelessWidget {
|
||||
ListScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
Widget _generateVeggieRow(Veggie veggie, Preferences prefs,
|
||||
{bool inSeason = true}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
child: FutureBuilder<Set<VeggieCategory>>(
|
||||
future: prefs.preferredCategories,
|
||||
builder: (context, snapshot) {
|
||||
final data = snapshot.data ?? <VeggieCategory>{};
|
||||
return VeggieCard(veggie, inSeason, data.contains(veggie.category));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoTabView(
|
||||
restorationScopeId: restorationId,
|
||||
builder: (context) {
|
||||
var dateString = DateFormat('MMMM y').format(DateTime.now());
|
||||
|
||||
final appState = Provider.of<AppState>(context);
|
||||
final prefs = Provider.of<Preferences>(context);
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarBrightness: MediaQuery.platformBrightnessOf(context)),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: ListView.builder(
|
||||
restorationId: 'list',
|
||||
itemCount: appState.allVeggies.length + 2,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(dateString.toUpperCase(),
|
||||
style: Styles.minorText(themeData)),
|
||||
Text('In season today',
|
||||
style: Styles.headlineText(themeData)),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else if (index <= appState.availableVeggies.length) {
|
||||
return _generateVeggieRow(
|
||||
appState.availableVeggies[index - 1],
|
||||
prefs,
|
||||
);
|
||||
} else if (index <= appState.availableVeggies.length + 1) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
|
||||
child: Text('Not in season',
|
||||
style: Styles.headlineText(themeData)),
|
||||
);
|
||||
} else {
|
||||
var relativeIndex =
|
||||
index - (appState.availableVeggies.length + 2);
|
||||
return _generateVeggieRow(
|
||||
appState.unavailableVeggies[relativeIndex], prefs,
|
||||
inSeason: false);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
123
veggieseasons/lib/screens/search.dart
Normal file
@@ -0,0 +1,123 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
||||
|
||||
class SearchScreen extends StatefulWidget {
|
||||
SearchScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
@override
|
||||
_SearchScreenState createState() => _SearchScreenState();
|
||||
}
|
||||
|
||||
class _SearchScreenState extends State<SearchScreen> with RestorationMixin {
|
||||
final controller = RestorableTextEditingController();
|
||||
final focusNode = FocusNode();
|
||||
String terms;
|
||||
|
||||
@override
|
||||
String get restorationId => widget.restorationId;
|
||||
|
||||
@override
|
||||
void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
registerForRestoration(controller, 'text');
|
||||
controller.addListener(_onTextChanged);
|
||||
terms = controller.value.text;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
focusNode.dispose();
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onTextChanged() {
|
||||
setState(() => terms = controller.value.text);
|
||||
}
|
||||
|
||||
Widget _createSearchBox() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: CupertinoSearchTextField(
|
||||
controller: controller.value,
|
||||
focusNode: focusNode,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSearchResults(List<Veggie> veggies) {
|
||||
if (veggies.isEmpty) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
'No veggies matching your search terms were found.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
restorationId: 'list',
|
||||
itemCount: veggies.length + 1,
|
||||
itemBuilder: (context, i) {
|
||||
if (i == 0) {
|
||||
return Visibility(
|
||||
// This invisible and otherwise unnecessary search box is used to
|
||||
// pad the list entries downward, so none will be underneath the
|
||||
// real search box when the list is at its top scroll position.
|
||||
child: _createSearchBox(),
|
||||
visible: false,
|
||||
maintainSize: true,
|
||||
maintainAnimation: true,
|
||||
maintainState: true,
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||
child: VeggieHeadline(veggies[i - 1]),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final model = Provider.of<AppState>(context);
|
||||
|
||||
return UnmanagedRestorationScope(
|
||||
bucket: bucket,
|
||||
child: CupertinoTabView(
|
||||
restorationScopeId: 'tabview',
|
||||
builder: (context) {
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarBrightness: MediaQuery.platformBrightnessOf(context),
|
||||
),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildSearchResults(model.searchVeggies(terms)),
|
||||
_createSearchBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
292
veggieseasons/lib/screens/settings.dart
Normal file
@@ -0,0 +1,292 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/preferences.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
import 'package:veggieseasons/widgets/settings_group.dart';
|
||||
import 'package:veggieseasons/widgets/settings_item.dart';
|
||||
|
||||
class VeggieCategorySettingsScreen extends StatelessWidget {
|
||||
VeggieCategorySettingsScreen({Key key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
static String show(NavigatorState navigator) {
|
||||
return navigator.restorablePush(_routeBuilder);
|
||||
}
|
||||
|
||||
static Route<void> _routeBuilder(BuildContext context, Object argument) {
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
VeggieCategorySettingsScreen(restorationId: 'category'),
|
||||
title: 'Preferred Categories',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final model = Provider.of<Preferences>(context);
|
||||
final currentPrefs = model.preferredCategories;
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Preferred Categories'),
|
||||
previousPageTitle: 'Settings',
|
||||
),
|
||||
backgroundColor: Styles.scaffoldBackground(brightness),
|
||||
child: FutureBuilder<Set<VeggieCategory>>(
|
||||
future: currentPrefs,
|
||||
builder: (context, snapshot) {
|
||||
final items = <SettingsItem>[];
|
||||
|
||||
for (final category in VeggieCategory.values) {
|
||||
CupertinoSwitch toggle;
|
||||
|
||||
// It's possible that category data hasn't loaded from shared prefs
|
||||
// yet, so display it if possible and fall back to disabled switches
|
||||
// otherwise.
|
||||
if (snapshot.hasData) {
|
||||
toggle = CupertinoSwitch(
|
||||
value: snapshot.data.contains(category),
|
||||
onChanged: (value) {
|
||||
if (value) {
|
||||
model.addPreferredCategory(category);
|
||||
} else {
|
||||
model.removePreferredCategory(category);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
toggle = CupertinoSwitch(
|
||||
value: false,
|
||||
onChanged: null,
|
||||
);
|
||||
}
|
||||
|
||||
items.add(SettingsItem(
|
||||
label: veggieCategoryNames[category],
|
||||
content: toggle,
|
||||
));
|
||||
}
|
||||
|
||||
return ListView(
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
SettingsGroup(
|
||||
items: items,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CalorieSettingsScreen extends StatelessWidget {
|
||||
CalorieSettingsScreen({Key key, this.restorationId}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
static const max = 1000;
|
||||
static const min = 2600;
|
||||
static const step = 200;
|
||||
|
||||
static String show(NavigatorState navigator) {
|
||||
return navigator.restorablePush(_routeBuilder);
|
||||
}
|
||||
|
||||
static Route<void> _routeBuilder(BuildContext context, Object argument) {
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (context) => CalorieSettingsScreen(restorationId: 'calorie'),
|
||||
title: 'Calorie Target',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final model = Provider.of<Preferences>(context);
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
previousPageTitle: 'Settings',
|
||||
),
|
||||
backgroundColor: Styles.scaffoldBackground(brightness),
|
||||
child: ListView(
|
||||
restorationId: 'list',
|
||||
children: [
|
||||
FutureBuilder<int>(
|
||||
future: model.desiredCalories,
|
||||
builder: (context, snapshot) {
|
||||
final steps = <SettingsItem>[];
|
||||
|
||||
for (var cals = max; cals < min; cals += step) {
|
||||
steps.add(
|
||||
SettingsItem(
|
||||
label: cals.toString(),
|
||||
icon: SettingsIcon(
|
||||
icon: Styles.checkIcon,
|
||||
foregroundColor:
|
||||
snapshot.hasData && snapshot.data == cals
|
||||
? CupertinoColors.activeBlue
|
||||
: Styles.transparentColor,
|
||||
backgroundColor: Styles.transparentColor,
|
||||
),
|
||||
onPress: snapshot.hasData
|
||||
? () => model.setDesiredCalories(cals)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SettingsGroup(
|
||||
items: steps,
|
||||
header: SettingsGroupHeader('Available calorie levels'),
|
||||
footer: SettingsGroupFooter('These are used for serving '
|
||||
'calculations'),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
SettingsScreen({this.restorationId, Key key}) : super(key: key);
|
||||
|
||||
final String restorationId;
|
||||
|
||||
SettingsItem _buildCaloriesItem(BuildContext context, Preferences prefs) {
|
||||
return SettingsItem(
|
||||
label: 'Calorie Target',
|
||||
icon: SettingsIcon(
|
||||
backgroundColor: Styles.iconBlue,
|
||||
icon: Styles.calorieIcon,
|
||||
),
|
||||
content: FutureBuilder<int>(
|
||||
future: prefs.desiredCalories,
|
||||
builder: (context, snapshot) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
snapshot.data?.toString() ?? '',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
SettingsNavigationIndicator(),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
onPress: () {
|
||||
CalorieSettingsScreen.show(Navigator.of(context));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
SettingsItem _buildCategoriesItem(BuildContext context, Preferences prefs) {
|
||||
return SettingsItem(
|
||||
label: 'Preferred Categories',
|
||||
subtitle: 'What types of veggies you prefer!',
|
||||
icon: SettingsIcon(
|
||||
backgroundColor: Styles.iconGold,
|
||||
icon: Styles.preferenceIcon,
|
||||
),
|
||||
content: SettingsNavigationIndicator(),
|
||||
onPress: () {
|
||||
VeggieCategorySettingsScreen.show(Navigator.of(context));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
SettingsItem _buildRestoreDefaultsItem(
|
||||
BuildContext context, Preferences prefs) {
|
||||
return SettingsItem(
|
||||
label: 'Restore Defaults',
|
||||
icon: SettingsIcon(
|
||||
backgroundColor: CupertinoColors.systemRed,
|
||||
icon: Styles.resetIcon,
|
||||
),
|
||||
content: SettingsNavigationIndicator(),
|
||||
onPress: () {
|
||||
showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text('Are you sure?'),
|
||||
content: Text(
|
||||
'Are you sure you want to reset the current settings?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
isDestructiveAction: true,
|
||||
child: Text('Yes'),
|
||||
onPressed: () async {
|
||||
await prefs.restoreDefaults();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
child: Text('No'),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final prefs = Provider.of<Preferences>(context);
|
||||
|
||||
return RestorationScope(
|
||||
restorationId: restorationId,
|
||||
child: CupertinoPageScaffold(
|
||||
child: Container(
|
||||
color:
|
||||
Styles.scaffoldBackground(CupertinoTheme.brightnessOf(context)),
|
||||
child: CustomScrollView(
|
||||
restorationId: 'list',
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(
|
||||
largeTitle: Text('Settings'),
|
||||
),
|
||||
SliverSafeArea(
|
||||
top: false,
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
<Widget>[
|
||||
SettingsGroup(
|
||||
items: [
|
||||
_buildCaloriesItem(context, prefs),
|
||||
_buildCategoriesItem(context, prefs),
|
||||
_buildRestoreDefaultsItem(context, prefs),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
240
veggieseasons/lib/styles.dart
Normal file
@@ -0,0 +1,240 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
|
||||
abstract class Styles {
|
||||
static CupertinoThemeData veggieThemeData = CupertinoThemeData(
|
||||
textTheme: CupertinoTextThemeData(
|
||||
textStyle: TextStyle(
|
||||
color: CupertinoColors.label,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontStyle: FontStyle.normal,
|
||||
fontFamily: 'NotoSans',
|
||||
letterSpacing: -0.41,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
static TextStyle headlineText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle minorText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(128, 128, 128, 1),
|
||||
);
|
||||
|
||||
static TextStyle headlineName(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle cardTitleText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle cardCategoryText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(255, 255, 255, 0.9),
|
||||
);
|
||||
|
||||
static TextStyle cardDescriptionText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
);
|
||||
|
||||
static TextStyle detailsTitleText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsPreferredCategoryText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsBoldDescriptionText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsServingHeaderText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Color.fromRGBO(176, 176, 176, 1),
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsServingLabelText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
static TextStyle detailsServingNoteText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontStyle: FontStyle.italic,
|
||||
);
|
||||
|
||||
static TextStyle triviaFinishedTitleText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 32,
|
||||
);
|
||||
|
||||
static TextStyle triviaFinishedBigText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 48,
|
||||
);
|
||||
|
||||
static TextStyle settingsGroupHeaderText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: CupertinoColors.inactiveGray,
|
||||
fontSize: 13.5,
|
||||
letterSpacing: -0.5,
|
||||
);
|
||||
|
||||
static TextStyle settingsGroupFooterText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
color: Styles.settingsGroupSubtitle,
|
||||
fontSize: 13,
|
||||
letterSpacing: -0.08,
|
||||
);
|
||||
|
||||
static const appBackground = Color(0xffd0d0d0);
|
||||
|
||||
static Color scaffoldBackground(Brightness brightness) =>
|
||||
brightness == Brightness.light
|
||||
? CupertinoColors.lightBackgroundGray
|
||||
: null;
|
||||
|
||||
static const frostedBackground = Color(0xccf8f8f8);
|
||||
|
||||
static const closeButtonUnpressed = Color(0xff101010);
|
||||
|
||||
static const closeButtonPressed = Color(0xff808080);
|
||||
|
||||
static TextStyle settingsItemSubtitleText(CupertinoThemeData themeData) =>
|
||||
themeData.textTheme.textStyle.copyWith(
|
||||
fontSize: 12,
|
||||
letterSpacing: -0.2,
|
||||
);
|
||||
|
||||
static const Color searchCursorColor = Color.fromRGBO(0, 122, 255, 1);
|
||||
|
||||
static const Color searchIconColor = Color.fromRGBO(128, 128, 128, 1);
|
||||
|
||||
static const seasonColors = <Season, Color>{
|
||||
Season.winter: Color(0xff336dcc),
|
||||
Season.spring: Color(0xff2fa02b),
|
||||
Season.summer: Color(0xff287213),
|
||||
Season.autumn: Color(0xff724913),
|
||||
};
|
||||
|
||||
// While handy, some of the Font Awesome icons sometimes bleed over their
|
||||
// allotted bounds. This padding is used to adjust for that.
|
||||
static const seasonIconPadding = {
|
||||
Season.winter: EdgeInsets.only(right: 0),
|
||||
Season.spring: EdgeInsets.only(right: 4),
|
||||
Season.summer: EdgeInsets.only(right: 6),
|
||||
Season.autumn: EdgeInsets.only(right: 0),
|
||||
};
|
||||
|
||||
static const seasonIconData = {
|
||||
Season.winter: FontAwesomeIcons.snowflake,
|
||||
Season.spring: FontAwesomeIcons.leaf,
|
||||
Season.summer: FontAwesomeIcons.umbrellaBeach,
|
||||
Season.autumn: FontAwesomeIcons.canadianMapleLeaf,
|
||||
};
|
||||
|
||||
static const seasonBorder = Border(
|
||||
top: BorderSide(color: Color(0xff606060)),
|
||||
left: BorderSide(color: Color(0xff606060)),
|
||||
bottom: BorderSide(color: Color(0xff606060)),
|
||||
right: BorderSide(color: Color(0xff606060)),
|
||||
);
|
||||
|
||||
static const uncheckedIcon = IconData(
|
||||
0xf372,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const checkedIcon = IconData(
|
||||
0xf373,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const transparentColor = Color(0x00000000);
|
||||
|
||||
static const shadowColor = Color(0xa0000000);
|
||||
|
||||
static const shadowGradient = LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [transparentColor, shadowColor],
|
||||
);
|
||||
|
||||
static const Color settingsMediumGray = Color(0xffc7c7c7);
|
||||
|
||||
static const Color settingsItemPressed = Color(0xffd9d9d9);
|
||||
|
||||
static Color settingsItemColor(Brightness brightness) =>
|
||||
brightness == Brightness.light
|
||||
? CupertinoColors.tertiarySystemBackground
|
||||
: CupertinoColors.darkBackgroundGray;
|
||||
|
||||
static Color settingsLineation(Brightness brightness) =>
|
||||
brightness == Brightness.light ? Color(0xffbcbbc1) : Color(0xff4c4b4b);
|
||||
|
||||
static const Color settingsBackground = Color(0xffefeff4);
|
||||
|
||||
static const Color settingsGroupSubtitle = Color(0xff777777);
|
||||
|
||||
static const Color iconBlue = Color(0xff0000ff);
|
||||
|
||||
static const Color iconGold = Color(0xffdba800);
|
||||
|
||||
static const preferenceIcon = IconData(
|
||||
0xf443,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const resetIcon = IconData(
|
||||
0xf4c4,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const calorieIcon = IconData(
|
||||
0xf3bb,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const checkIcon = IconData(
|
||||
0xf383,
|
||||
fontFamily: CupertinoIcons.iconFont,
|
||||
fontPackage: CupertinoIcons.iconFontPackage,
|
||||
);
|
||||
|
||||
static const servingInfoBorderColor = Color(0xffb0b0b0);
|
||||
|
||||
static const ColorFilter desaturatedColorFilter =
|
||||
// 222222 is a random color that has low color saturation.
|
||||
ColorFilter.mode(Color(0xff222222), BlendMode.saturation);
|
||||
}
|
||||
132
veggieseasons/lib/widgets/close_button.dart
Normal file
@@ -0,0 +1,132 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
/// Partially overlays and then blurs its child's background.
|
||||
class FrostedBox extends StatelessWidget {
|
||||
const FrostedBox({
|
||||
this.child,
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.frostedBackground,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// An Icon that implicitly animates changes to its color.
|
||||
class ColorChangingIcon extends ImplicitlyAnimatedWidget {
|
||||
const ColorChangingIcon(
|
||||
this.icon, {
|
||||
this.color = CupertinoColors.black,
|
||||
this.size,
|
||||
@required Duration duration,
|
||||
Key key,
|
||||
}) : assert(icon != null),
|
||||
assert(color != null),
|
||||
assert(duration != null),
|
||||
super(key: key, duration: duration);
|
||||
|
||||
final Color color;
|
||||
|
||||
final IconData icon;
|
||||
|
||||
final double size;
|
||||
|
||||
@override
|
||||
_ColorChangingIconState createState() => _ColorChangingIconState();
|
||||
}
|
||||
|
||||
class _ColorChangingIconState
|
||||
extends AnimatedWidgetBaseState<ColorChangingIcon> {
|
||||
ColorTween _colorTween;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
widget.icon,
|
||||
semanticLabel: 'Close button',
|
||||
size: widget.size,
|
||||
color: _colorTween?.evaluate(animation),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_colorTween = visitor(
|
||||
_colorTween,
|
||||
widget.color,
|
||||
(dynamic value) => ColorTween(begin: value as Color),
|
||||
) as ColorTween;
|
||||
}
|
||||
}
|
||||
|
||||
/// A simple "close this modal" button that invokes a callback when pressed.
|
||||
class CloseButton extends StatefulWidget {
|
||||
const CloseButton(this.onPressed);
|
||||
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
CloseButtonState createState() {
|
||||
return CloseButtonState();
|
||||
}
|
||||
}
|
||||
|
||||
class CloseButtonState extends State<CloseButton> {
|
||||
bool tapInProgress = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTapDown: (details) {
|
||||
setState(() => tapInProgress = true);
|
||||
},
|
||||
onTapUp: (details) {
|
||||
setState(() => tapInProgress = false);
|
||||
widget.onPressed();
|
||||
},
|
||||
onTapCancel: () {
|
||||
setState(() => tapInProgress = false);
|
||||
},
|
||||
child: ClipOval(
|
||||
child: FrostedBox(
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Center(
|
||||
child: ColorChangingIcon(
|
||||
CupertinoIcons.clear_thick,
|
||||
duration: Duration(milliseconds: 300),
|
||||
color: tapInProgress
|
||||
? Styles.closeButtonPressed
|
||||
: Styles.closeButtonUnpressed,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
111
veggieseasons/lib/widgets/settings_group.dart
Normal file
@@ -0,0 +1,111 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
import 'settings_item.dart';
|
||||
|
||||
// The widgets in this file present a group of Cupertino-style settings items to
|
||||
// the user. In the future, the Cupertino package in the Flutter SDK will
|
||||
// include dedicated widgets for this purpose, but for now they're done here.
|
||||
//
|
||||
// See https://github.com/flutter/flutter/projects/29 for more info.
|
||||
|
||||
class SettingsGroupHeader extends StatelessWidget {
|
||||
const SettingsGroupHeader(this.title);
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
bottom: 6,
|
||||
),
|
||||
child: Text(
|
||||
title.toUpperCase(),
|
||||
style: Styles.settingsGroupHeaderText(CupertinoTheme.of(context)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsGroupFooter extends StatelessWidget {
|
||||
const SettingsGroupFooter(this.title);
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 15,
|
||||
right: 15,
|
||||
top: 7.5,
|
||||
),
|
||||
child: Text(title,
|
||||
style: Styles.settingsGroupFooterText(CupertinoTheme.of(context))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsGroup extends StatelessWidget {
|
||||
SettingsGroup({
|
||||
@required this.items,
|
||||
this.header,
|
||||
this.footer,
|
||||
}) : assert(items != null),
|
||||
assert(items.isNotEmpty);
|
||||
|
||||
final List<SettingsItem> items;
|
||||
final Widget header;
|
||||
final Widget footer;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
final dividedItems = <Widget>[items[0]];
|
||||
for (var i = 1; i < items.length; i++) {
|
||||
dividedItems.add(Container(
|
||||
color: Styles.settingsLineation(brightness),
|
||||
height: 0.3,
|
||||
));
|
||||
dividedItems.add(items[i]);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: header == null ? 35 : 22,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (header != null) header,
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.white,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Styles.settingsLineation(brightness),
|
||||
width: 0,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: Styles.settingsLineation(brightness),
|
||||
width: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: dividedItems,
|
||||
),
|
||||
),
|
||||
if (footer != null) footer,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
163
veggieseasons/lib/widgets/settings_item.dart
Normal file
@@ -0,0 +1,163 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
// The widgets in this file present a Cupertino-style settings item to the user.
|
||||
// In the future, the Cupertino package in the Flutter SDK will include
|
||||
// dedicated widgets for this purpose, but for now they're done here.
|
||||
//
|
||||
// See https://github.com/flutter/flutter/projects/29 for more info.
|
||||
|
||||
typedef SettingsItemCallback = FutureOr<void> Function();
|
||||
|
||||
class SettingsNavigationIndicator extends StatelessWidget {
|
||||
const SettingsNavigationIndicator({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Icon(
|
||||
CupertinoIcons.forward,
|
||||
color: Styles.settingsMediumGray,
|
||||
size: 21,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsIcon extends StatelessWidget {
|
||||
const SettingsIcon({
|
||||
@required this.icon,
|
||||
this.foregroundColor = CupertinoColors.white,
|
||||
this.backgroundColor = CupertinoColors.black,
|
||||
Key key,
|
||||
}) : assert(icon != null),
|
||||
super(key: key);
|
||||
|
||||
final Color backgroundColor;
|
||||
final Color foregroundColor;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: backgroundColor,
|
||||
),
|
||||
child: Center(
|
||||
child: Icon(
|
||||
icon,
|
||||
color: foregroundColor,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsItem extends StatefulWidget {
|
||||
const SettingsItem({
|
||||
@required this.label,
|
||||
this.icon,
|
||||
this.content,
|
||||
this.subtitle,
|
||||
this.onPress,
|
||||
Key key,
|
||||
}) : assert(label != null),
|
||||
super(key: key);
|
||||
|
||||
final String label;
|
||||
final Widget icon;
|
||||
final Widget content;
|
||||
final String subtitle;
|
||||
final SettingsItemCallback onPress;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => SettingsItemState();
|
||||
}
|
||||
|
||||
class SettingsItemState extends State<SettingsItem> {
|
||||
bool pressed = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var themeData = CupertinoTheme.of(context);
|
||||
var brightness = CupertinoTheme.brightnessOf(context);
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
color: Styles.settingsItemColor(brightness),
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () async {
|
||||
if (widget.onPress != null) {
|
||||
setState(() {
|
||||
pressed = true;
|
||||
});
|
||||
await widget.onPress();
|
||||
Future.delayed(
|
||||
Duration(milliseconds: 150),
|
||||
() {
|
||||
setState(() {
|
||||
pressed = false;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: SizedBox(
|
||||
height: widget.subtitle == null ? 44 : 57,
|
||||
child: Row(
|
||||
children: [
|
||||
if (widget.icon != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
bottom: 2,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 29,
|
||||
width: 29,
|
||||
child: widget.icon,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
),
|
||||
child: widget.subtitle != null
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 8.5),
|
||||
Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
widget.subtitle,
|
||||
style: Styles.settingsItemSubtitleText(themeData),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(top: 1.5),
|
||||
child: Text(widget.label,
|
||||
style: themeData.textTheme.textStyle),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 11),
|
||||
child: widget.content ?? Container(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
250
veggieseasons/lib/widgets/trivia.dart
Normal file
@@ -0,0 +1,250 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:veggieseasons/data/app_state.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
/// Presents a series of trivia questions about a particular widget, and tracks
|
||||
/// the user's score.
|
||||
class TriviaView extends StatefulWidget {
|
||||
final int id;
|
||||
final String restorationId;
|
||||
|
||||
const TriviaView({this.id, this.restorationId});
|
||||
|
||||
@override
|
||||
_TriviaViewState createState() => _TriviaViewState();
|
||||
}
|
||||
|
||||
/// Possible states of the game.
|
||||
enum PlayerStatus {
|
||||
readyToAnswer,
|
||||
wasCorrect,
|
||||
wasIncorrect,
|
||||
}
|
||||
|
||||
class _TriviaViewState extends State<TriviaView> with RestorationMixin {
|
||||
/// Current app state. This is used to fetch veggie data.
|
||||
AppState appState;
|
||||
|
||||
/// The veggie trivia about which to show.
|
||||
Veggie veggie;
|
||||
|
||||
/// Index of the current trivia question.
|
||||
RestorableInt triviaIndex = RestorableInt(0);
|
||||
|
||||
/// User's score on the current veggie.
|
||||
RestorableInt score = RestorableInt(0);
|
||||
|
||||
/// Trivia question currently being displayed.
|
||||
Trivia get currentTrivia => veggie.trivia[triviaIndex.value];
|
||||
|
||||
/// The current state of the game.
|
||||
_RestorablePlayerStatus status =
|
||||
_RestorablePlayerStatus(PlayerStatus.readyToAnswer);
|
||||
|
||||
@override
|
||||
String get restorationId => widget.restorationId;
|
||||
|
||||
@override
|
||||
void restoreState(RestorationBucket oldBucket, bool initialRestore) {
|
||||
registerForRestoration(triviaIndex, 'index');
|
||||
registerForRestoration(score, 'score');
|
||||
registerForRestoration(status, 'status');
|
||||
}
|
||||
|
||||
// Called at init and again if any dependencies (read: InheritedWidgets) on
|
||||
// on which this object relies are changed.
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
final newAppState = Provider.of<AppState>(context);
|
||||
|
||||
setState(() {
|
||||
appState = newAppState;
|
||||
veggie = appState.getVeggie(widget.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Called when the widget associated with this object is swapped out for a new
|
||||
// one. If the new widget has a different Veggie ID value, the state object
|
||||
// needs to do a little work to reset itself for the new Veggie.
|
||||
@override
|
||||
void didUpdateWidget(TriviaView oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (oldWidget.id != widget.id) {
|
||||
setState(() {
|
||||
veggie = appState.getVeggie(widget.id);
|
||||
});
|
||||
|
||||
_resetGame();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
triviaIndex.dispose();
|
||||
score.dispose();
|
||||
status.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (triviaIndex.value >= veggie.trivia.length) {
|
||||
return _buildFinishedView();
|
||||
} else if (status.value == PlayerStatus.readyToAnswer) {
|
||||
return _buildQuestionView();
|
||||
} else {
|
||||
return _buildResultView();
|
||||
}
|
||||
}
|
||||
|
||||
void _resetGame() {
|
||||
setState(() {
|
||||
triviaIndex.value = 0;
|
||||
score.value = 0;
|
||||
status.value = PlayerStatus.readyToAnswer;
|
||||
});
|
||||
}
|
||||
|
||||
void _processAnswer(int answerIndex) {
|
||||
setState(() {
|
||||
if (answerIndex == currentTrivia.correctAnswerIndex) {
|
||||
status.value = PlayerStatus.wasCorrect;
|
||||
score.value++;
|
||||
} else {
|
||||
status.value = PlayerStatus.wasIncorrect;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Widget shown when the game is over. It includes the score and a button to
|
||||
// restart everything.
|
||||
Widget _buildFinishedView() {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'All done!',
|
||||
style: Styles.triviaFinishedTitleText(themeData),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text('You answered', style: themeData.textTheme.textStyle),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
textBaseline: TextBaseline.alphabetic,
|
||||
children: [
|
||||
Text(
|
||||
'${score.value}',
|
||||
style: Styles.triviaFinishedBigText(themeData),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(' of ', style: themeData.textTheme.textStyle),
|
||||
),
|
||||
Text(
|
||||
'${veggie.trivia.length}',
|
||||
style: Styles.triviaFinishedBigText(themeData),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text('questions correctly!', style: themeData.textTheme.textStyle),
|
||||
SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Try Again'),
|
||||
onPressed: () => _resetGame(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Presents the current trivia's question and answer choices.
|
||||
Widget _buildQuestionView() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
currentTrivia.question,
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 32),
|
||||
for (int i = 0; i < currentTrivia.answers.length; i++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: CupertinoButton(
|
||||
color: CupertinoColors.activeBlue,
|
||||
child: Text(
|
||||
currentTrivia.answers[i],
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
onPressed: () => _processAnswer(i),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Shows whether the last answer was right or wrong and prompts the user to
|
||||
// continue through the game.
|
||||
Widget _buildResultView() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
status.value == PlayerStatus.wasCorrect
|
||||
? 'That\'s right!'
|
||||
: 'Sorry, that wasn\'t the right answer.',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
CupertinoButton(
|
||||
child: Text('Next Question'),
|
||||
onPressed: () => setState(() {
|
||||
triviaIndex.value++;
|
||||
status.value = PlayerStatus.readyToAnswer;
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _RestorablePlayerStatus extends RestorableValue<PlayerStatus> {
|
||||
_RestorablePlayerStatus(this._defaultValue);
|
||||
|
||||
final PlayerStatus _defaultValue;
|
||||
|
||||
@override
|
||||
PlayerStatus createDefaultValue() {
|
||||
return _defaultValue;
|
||||
}
|
||||
|
||||
@override
|
||||
PlayerStatus fromPrimitives(Object data) {
|
||||
return PlayerStatus.values[data as int];
|
||||
}
|
||||
|
||||
@override
|
||||
Object toPrimitives() {
|
||||
return value.index;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateValue(PlayerStatus oldValue) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
175
veggieseasons/lib/widgets/veggie_card.dart
Normal file
@@ -0,0 +1,175 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/screens/details.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
class FrostyBackground extends StatelessWidget {
|
||||
const FrostyBackground({
|
||||
this.color,
|
||||
this.intensity = 25,
|
||||
this.child,
|
||||
});
|
||||
|
||||
final Color color;
|
||||
final double intensity;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: intensity, sigmaY: intensity),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A Card-like Widget that responds to tap events by animating changes to its
|
||||
/// elevation and invoking an optional [onPressed] callback.
|
||||
class PressableCard extends StatefulWidget {
|
||||
const PressableCard({
|
||||
@required this.child,
|
||||
this.borderRadius = const BorderRadius.all(Radius.circular(5)),
|
||||
this.upElevation = 2,
|
||||
this.downElevation = 0,
|
||||
this.shadowColor = CupertinoColors.black,
|
||||
this.duration = const Duration(milliseconds: 100),
|
||||
this.onPressed,
|
||||
Key key,
|
||||
}) : assert(child != null),
|
||||
assert(borderRadius != null),
|
||||
assert(upElevation != null),
|
||||
assert(downElevation != null),
|
||||
assert(shadowColor != null),
|
||||
assert(duration != null),
|
||||
super(key: key);
|
||||
|
||||
final VoidCallback onPressed;
|
||||
|
||||
final Widget child;
|
||||
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
final double upElevation;
|
||||
|
||||
final double downElevation;
|
||||
|
||||
final Color shadowColor;
|
||||
|
||||
final Duration duration;
|
||||
|
||||
@override
|
||||
_PressableCardState createState() => _PressableCardState();
|
||||
}
|
||||
|
||||
class _PressableCardState extends State<PressableCard> {
|
||||
bool cardIsDown = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() => cardIsDown = false);
|
||||
if (widget.onPressed != null) {
|
||||
widget.onPressed();
|
||||
}
|
||||
},
|
||||
onTapDown: (details) => setState(() => cardIsDown = true),
|
||||
onTapCancel: () => setState(() => cardIsDown = false),
|
||||
child: AnimatedPhysicalModel(
|
||||
elevation: cardIsDown ? widget.downElevation : widget.upElevation,
|
||||
borderRadius: widget.borderRadius,
|
||||
shape: BoxShape.rectangle,
|
||||
shadowColor: widget.shadowColor,
|
||||
duration: widget.duration,
|
||||
color: CupertinoColors.lightBackgroundGray,
|
||||
child: ClipRRect(
|
||||
borderRadius: widget.borderRadius,
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VeggieCard extends StatelessWidget {
|
||||
VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory);
|
||||
|
||||
/// Veggie to be displayed by the card.
|
||||
final Veggie veggie;
|
||||
|
||||
/// If the veggie is in season, it's displayed more prominently and the
|
||||
/// image is fully saturated. Otherwise, it's reduced and de-saturated.
|
||||
final bool isInSeason;
|
||||
|
||||
/// Whether [veggie] falls into one of user's preferred [VeggieCategory]s
|
||||
final bool isPreferredCategory;
|
||||
|
||||
Widget _buildDetails(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
return FrostyBackground(
|
||||
color: Color(0x90ffffff),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.cardTitleText(themeData),
|
||||
),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
style: Styles.cardDescriptionText(themeData),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PressableCard(
|
||||
onPressed: () => DetailsScreen.show(Navigator.of(context), veggie.id),
|
||||
child: Stack(
|
||||
children: [
|
||||
Semantics(
|
||||
label: 'A card background featuring ${veggie.name}',
|
||||
child: Container(
|
||||
height: isInSeason ? 300 : 150,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
colorFilter:
|
||||
isInSeason ? null : Styles.desaturatedColorFilter,
|
||||
image: AssetImage(
|
||||
veggie.imageAssetPath,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: _buildDetails(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
109
veggieseasons/lib/widgets/veggie_headline.dart
Normal file
@@ -0,0 +1,109 @@
|
||||
// Copyright 2018 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:veggieseasons/data/veggie.dart';
|
||||
import 'package:veggieseasons/screens/details.dart';
|
||||
import 'package:veggieseasons/styles.dart';
|
||||
|
||||
class ZoomClipAssetImage extends StatelessWidget {
|
||||
const ZoomClipAssetImage(
|
||||
{@required this.zoom,
|
||||
this.height,
|
||||
this.width,
|
||||
@required this.imageAsset});
|
||||
|
||||
final double zoom;
|
||||
final double height;
|
||||
final double width;
|
||||
final String imageAsset;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: height,
|
||||
width: width,
|
||||
alignment: Alignment.center,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: OverflowBox(
|
||||
maxHeight: height * zoom,
|
||||
maxWidth: width * zoom,
|
||||
child: Image.asset(
|
||||
imageAsset,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VeggieHeadline extends StatelessWidget {
|
||||
final Veggie veggie;
|
||||
|
||||
const VeggieHeadline(this.veggie);
|
||||
|
||||
List<Widget> _buildSeasonDots(List<Season> seasons) {
|
||||
var widgets = <Widget>[];
|
||||
|
||||
for (var season in seasons) {
|
||||
widgets.add(SizedBox(width: 4));
|
||||
widgets.add(
|
||||
Container(
|
||||
height: 10,
|
||||
width: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: Styles.seasonColors[season],
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => DetailsScreen.show(Navigator.of(context), veggie.id),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ZoomClipAssetImage(
|
||||
imageAsset: veggie.imageAssetPath,
|
||||
zoom: 2.4,
|
||||
height: 72,
|
||||
width: 72,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Flexible(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.headlineName(themeData),
|
||||
),
|
||||
..._buildSeasonDots(veggie.seasons),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
style: themeData.textTheme.textStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
6
veggieseasons/macos/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Flutter-related
|
||||
**/Flutter/ephemeral/
|
||||
**/Pods/
|
||||
|
||||
# Xcode-related
|
||||
**/xcuserdata/
|
||||
2
veggieseasons/macos/Flutter/Flutter-Debug.xcconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
2
veggieseasons/macos/Flutter/Flutter-Release.xcconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
12
veggieseasons/macos/Flutter/GeneratedPluginRegistrant.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import shared_preferences_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
}
|
||||
82
veggieseasons/macos/Podfile
Normal file
@@ -0,0 +1,82 @@
|
||||
platform :osx, '10.11'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
end
|
||||
pods_ary = []
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) { |line|
|
||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||
plugin = line.split(pattern=separator)
|
||||
if plugin.length == 2
|
||||
podname = plugin[0].strip()
|
||||
path = plugin[1].strip()
|
||||
podpath = File.expand_path("#{path}", file_abs_path)
|
||||
pods_ary.push({:name => podname, :path => podpath});
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
}
|
||||
return pods_ary
|
||||
end
|
||||
|
||||
def pubspec_supports_macos(file)
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return false;
|
||||
end
|
||||
File.foreach(file_abs_path) { |line|
|
||||
return true if line =~ /^\s*macos:/
|
||||
}
|
||||
return false
|
||||
end
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
ephemeral_dir = File.join('Flutter', 'ephemeral')
|
||||
symlink_dir = File.join(ephemeral_dir, '.symlinks')
|
||||
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
|
||||
system("rm -rf #{symlink_dir}")
|
||||
system("mkdir -p #{symlink_plugins_dir}")
|
||||
|
||||
# Flutter Pods
|
||||
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
|
||||
if generated_xcconfig.empty?
|
||||
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
|
||||
end
|
||||
generated_xcconfig.map { |p|
|
||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||
symlink = File.join(symlink_dir, 'flutter')
|
||||
File.symlink(File.dirname(p[:path]), symlink)
|
||||
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
|
||||
end
|
||||
}
|
||||
|
||||
# Plugin Pods
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.map { |p|
|
||||
symlink = File.join(symlink_plugins_dir, p[:name])
|
||||
File.symlink(p[:path], symlink)
|
||||
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
|
||||
pod p[:name], :path => File.join(symlink, 'macos')
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
|
||||
install! 'cocoapods', :disable_input_output_paths => true
|
||||
27
veggieseasons/macos/Podfile.lock
Normal file
@@ -0,0 +1,27 @@
|
||||
PODS:
|
||||
- FlutterMacOS (1.0.0)
|
||||
- shared_preferences (0.0.1)
|
||||
- shared_preferences_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
|
||||
- shared_preferences (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences/macos`)
|
||||
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
FlutterMacOS:
|
||||
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
|
||||
shared_preferences:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences/macos
|
||||
shared_preferences_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
|
||||
shared_preferences: 9fec34d1bd906196a4da48fcf6c3ad521cc00b8d
|
||||
shared_preferences_macos: 5e5c2839894accb56b7d23328905b757f2bafaf6
|
||||
|
||||
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||