diff --git a/shrine/.gitignore b/shrine/.gitignore new file mode 100644 index 000000000..87fcc079d --- /dev/null +++ b/shrine/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.dart_tool/ +.packages +.pub/ +.idea +.atom +.vscode +.flutter-plugins +build/ +*.iml diff --git a/shrine/.metadata b/shrine/.metadata new file mode 100644 index 000000000..82403edb5 --- /dev/null +++ b/shrine/.metadata @@ -0,0 +1,8 @@ +# 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: c7ea3ca377e909469c68f2ab878a5bc53d3cf66b + channel: beta diff --git a/shrine/README.md b/shrine/README.md new file mode 100644 index 000000000..1e725f425 --- /dev/null +++ b/shrine/README.md @@ -0,0 +1,45 @@ +# Shrine + +A sample shopping app that uses Material Component widgets in its UI and +[`scoped_model`](https://pub.dartlang.org/packages/scoped_model) to +manage the state of its shopping cart. + +## Goals + +* Show how to customize Flutter's Material Component widgets to produce + a unique design for an app. +* Show how to use `scoped_model` to manage an app's state and access it + across different routes and in different widgets. + +This is a modified version of the app featured in Flutter's +[Material codelabs](https://codelabs.developers.google.com/?cat=Flutter). + +## The important bits + +### `/model/app_state_model.dart` + +The model object representing the state of the app. It holds the +available products as well as what's in the shopping cart. + +### `/supplemental` + +A bunch of widgets that customize Material to produce the look and feel +of the app. + +### `shopping_cart.dart` + +The shopping cart widgets. They access the app state model via +`ScopedModelDescendant`, display the contents of the shopping cart, and +allow the user to edit them. + +## 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). diff --git a/shrine/android/.gitignore b/shrine/android/.gitignore new file mode 100644 index 000000000..65b7315af --- /dev/null +++ b/shrine/android/.gitignore @@ -0,0 +1,10 @@ +*.iml +*.class +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +GeneratedPluginRegistrant.java diff --git a/shrine/android/app/build.gradle b/shrine/android/app/build.gradle new file mode 100644 index 000000000..2c16fbafe --- /dev/null +++ b/shrine/android/app/build.gradle @@ -0,0 +1,51 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 27 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.flutter.shrine" + minSdkVersion 16 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' +} diff --git a/shrine/android/app/src/main/AndroidManifest.xml b/shrine/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..f288ca93f --- /dev/null +++ b/shrine/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/shrine/android/app/src/main/java/com/example/flutter/shrine/MainActivity.java b/shrine/android/app/src/main/java/com/example/flutter/shrine/MainActivity.java new file mode 100644 index 000000000..f9c24edde --- /dev/null +++ b/shrine/android/app/src/main/java/com/example/flutter/shrine/MainActivity.java @@ -0,0 +1,13 @@ +package com.example.flutter.shrine; + +import android.os.Bundle; +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } +} diff --git a/shrine/android/app/src/main/res/drawable/launch_background.xml b/shrine/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/shrine/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/shrine/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/shrine/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..db77bb4b7 Binary files /dev/null and b/shrine/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/shrine/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/shrine/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..17987b79b Binary files /dev/null and b/shrine/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/shrine/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/shrine/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..09d439148 Binary files /dev/null and b/shrine/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/shrine/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/shrine/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..d5f1c8d34 Binary files /dev/null and b/shrine/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/shrine/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/shrine/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4d6372eeb Binary files /dev/null and b/shrine/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/shrine/android/app/src/main/res/values/styles.xml b/shrine/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..00fa4417c --- /dev/null +++ b/shrine/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/shrine/android/build.gradle b/shrine/android/build.gradle new file mode 100644 index 000000000..447688755 --- /dev/null +++ b/shrine/android/build.gradle @@ -0,0 +1,29 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/shrine/android/gradle.properties b/shrine/android/gradle.properties new file mode 100644 index 000000000..8bd86f680 --- /dev/null +++ b/shrine/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/shrine/android/gradle/wrapper/gradle-wrapper.jar b/shrine/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..13372aef5 Binary files /dev/null and b/shrine/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/shrine/android/gradle/wrapper/gradle-wrapper.properties b/shrine/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..aa901e1e0 --- /dev/null +++ b/shrine/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/shrine/android/gradlew b/shrine/android/gradlew new file mode 100755 index 000000000..9d82f7891 --- /dev/null +++ b/shrine/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/shrine/android/gradlew.bat b/shrine/android/gradlew.bat new file mode 100644 index 000000000..aec99730b --- /dev/null +++ b/shrine/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/shrine/android/settings.gradle b/shrine/android/settings.gradle new file mode 100644 index 000000000..5a2f14fb1 --- /dev/null +++ b/shrine/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/shrine/assets/2.0x/diamond.png b/shrine/assets/2.0x/diamond.png new file mode 100644 index 000000000..602e2ea51 Binary files /dev/null and b/shrine/assets/2.0x/diamond.png differ diff --git a/shrine/assets/2.0x/slanted_menu.png b/shrine/assets/2.0x/slanted_menu.png new file mode 100755 index 000000000..5958055e4 Binary files /dev/null and b/shrine/assets/2.0x/slanted_menu.png differ diff --git a/shrine/assets/3.0x/diamond.png b/shrine/assets/3.0x/diamond.png new file mode 100644 index 000000000..78af7cd64 Binary files /dev/null and b/shrine/assets/3.0x/diamond.png differ diff --git a/shrine/assets/3.0x/slanted_menu.png b/shrine/assets/3.0x/slanted_menu.png new file mode 100755 index 000000000..9b4920d4b Binary files /dev/null and b/shrine/assets/3.0x/slanted_menu.png differ diff --git a/shrine/assets/diamond.png b/shrine/assets/diamond.png new file mode 100644 index 000000000..1978a0a5a Binary files /dev/null and b/shrine/assets/diamond.png differ diff --git a/shrine/assets/slanted_menu.png b/shrine/assets/slanted_menu.png new file mode 100644 index 000000000..c80d2d47e Binary files /dev/null and b/shrine/assets/slanted_menu.png differ diff --git a/shrine/fonts/Rubik-Medium.ttf b/shrine/fonts/Rubik-Medium.ttf new file mode 100755 index 000000000..c0b7965f9 Binary files /dev/null and b/shrine/fonts/Rubik-Medium.ttf differ diff --git a/shrine/fonts/Rubik-Regular.ttf b/shrine/fonts/Rubik-Regular.ttf new file mode 100755 index 000000000..fb52c8eec Binary files /dev/null and b/shrine/fonts/Rubik-Regular.ttf differ diff --git a/shrine/ios/.gitignore b/shrine/ios/.gitignore new file mode 100644 index 000000000..79cc4da80 --- /dev/null +++ b/shrine/ios/.gitignore @@ -0,0 +1,45 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/flutter_assets/ +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/ +.symlinks/ diff --git a/shrine/ios/Flutter/AppFrameworkInfo.plist b/shrine/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..9367d483e --- /dev/null +++ b/shrine/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/shrine/ios/Flutter/Debug.xcconfig b/shrine/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/shrine/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/shrine/ios/Flutter/Release.xcconfig b/shrine/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/shrine/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/shrine/ios/Runner.xcodeproj/project.pbxproj b/shrine/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..62a37cf8c --- /dev/null +++ b/shrine/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,438 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 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 = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + 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 = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + 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 */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets 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\" thin"; + }; + 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"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m 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 = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + 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_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_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; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + 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_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_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; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + ENABLE_BITCODE = NO; + 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", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutter.shrine; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + ENABLE_BITCODE = NO; + 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", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutter.shrine; + PRODUCT_NAME = "$(TARGET_NAME)"; + 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 */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/shrine/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/shrine/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/shrine/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/shrine/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/shrine/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..1263ac84b --- /dev/null +++ b/shrine/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shrine/ios/Runner.xcworkspace/contents.xcworkspacedata b/shrine/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/shrine/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/shrine/ios/Runner/AppDelegate.h b/shrine/ios/Runner/AppDelegate.h new file mode 100644 index 000000000..36e21bbf9 --- /dev/null +++ b/shrine/ios/Runner/AppDelegate.h @@ -0,0 +1,6 @@ +#import +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/shrine/ios/Runner/AppDelegate.m b/shrine/ios/Runner/AppDelegate.m new file mode 100644 index 000000000..59a72e90b --- /dev/null +++ b/shrine/ios/Runner/AppDelegate.m @@ -0,0 +1,13 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -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" + } +} diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..3d43d11e6 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..28c6bf030 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..f091b6b0b Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..4cde12118 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..d0ef06e7e Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..dcdc2306c Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..c8f9ed8f5 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..75b2d164a Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..c4df70d39 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..6a84f41e1 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..d0e1f5853 Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -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" + } +} diff --git a/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/shrine/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -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. \ No newline at end of file diff --git a/shrine/ios/Runner/Base.lproj/LaunchScreen.storyboard b/shrine/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/shrine/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shrine/ios/Runner/Base.lproj/Main.storyboard b/shrine/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/shrine/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shrine/ios/Runner/Info.plist b/shrine/ios/Runner/Info.plist new file mode 100644 index 000000000..bff936f44 --- /dev/null +++ b/shrine/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + shrine + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/shrine/ios/Runner/main.m b/shrine/ios/Runner/main.m new file mode 100644 index 000000000..dff6597e4 --- /dev/null +++ b/shrine/ios/Runner/main.m @@ -0,0 +1,9 @@ +#import +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/shrine/lib/app.dart b/shrine/lib/app.dart new file mode 100644 index 000000000..95e72c418 --- /dev/null +++ b/shrine/lib/app.dart @@ -0,0 +1,124 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; + +import 'backdrop.dart'; +import 'category_menu_page.dart'; +import 'colors.dart'; +import 'home.dart'; +import 'login.dart'; +import 'model/product.dart'; +import 'supplemental/cut_corners_border.dart'; + +class ShrineApp extends StatefulWidget { + @override + _ShrineAppState createState() => _ShrineAppState(); +} + +class _ShrineAppState extends State { + Category _currentCategory = Category.all; + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Shrine', + home: Backdrop( + currentCategory: _currentCategory, + frontLayer: HomePage(category: _currentCategory), + backLayer: CategoryMenuPage( + currentCategory: _currentCategory, + onCategoryTap: _onCategoryTap, + ), + frontTitle: Text('SHRINE'), + backTitle: Text('MENU'), + ), + initialRoute: '/login', + onGenerateRoute: _getRoute, + theme: _kShrineTheme, + ); + } + + /// Function to call when a [Category] is tapped. + void _onCategoryTap(Category category) { + setState(() { + _currentCategory = category; + }); + } +} + +Route _getRoute(RouteSettings settings) { + if (settings.name != '/login') { + return null; + } + + return MaterialPageRoute( + settings: settings, + builder: (BuildContext context) => LoginPage(), + fullscreenDialog: true, + ); +} + +final ThemeData _kShrineTheme = _buildShrineTheme(); + +IconThemeData _customIconTheme(IconThemeData original) { + return original.copyWith(color: kShrineBrown900); +} + +ThemeData _buildShrineTheme() { + final ThemeData base = ThemeData.light(); + return base.copyWith( + accentColor: kShrineBrown900, + primaryColor: kShrinePink100, + buttonColor: kShrinePink100, + scaffoldBackgroundColor: kShrineBackgroundWhite, + cardColor: kShrineBackgroundWhite, + textSelectionColor: kShrinePink100, + errorColor: kShrineErrorRed, + buttonTheme: ButtonThemeData( + textTheme: ButtonTextTheme.accent, + ), + primaryIconTheme: base.iconTheme.copyWith(color: kShrineBrown900), + inputDecorationTheme: InputDecorationTheme( + border: CutCornersBorder(), + ), + textTheme: _buildShrineTextTheme(base.textTheme), + primaryTextTheme: _buildShrineTextTheme(base.primaryTextTheme), + accentTextTheme: _buildShrineTextTheme(base.accentTextTheme), + iconTheme: _customIconTheme(base.iconTheme), + ); +} + +TextTheme _buildShrineTextTheme(TextTheme base) { + return base + .copyWith( + headline: base.headline.copyWith( + fontWeight: FontWeight.w500, + ), + title: base.title.copyWith(fontSize: 18.0), + caption: base.caption.copyWith( + fontWeight: FontWeight.w400, + fontSize: 14.0, + ), + body2: base.body2.copyWith( + fontWeight: FontWeight.w500, + fontSize: 16.0, + ), + ) + .apply( + fontFamily: 'Rubik', + displayColor: kShrineBrown900, + bodyColor: kShrineBrown900, + ); +} diff --git a/shrine/lib/backdrop.dart b/shrine/lib/backdrop.dart new file mode 100644 index 000000000..fc3bbbe8c --- /dev/null +++ b/shrine/lib/backdrop.dart @@ -0,0 +1,291 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; + +import 'login.dart'; +import 'model/product.dart'; +import 'shopping_cart.dart'; + +const double _kFlingVelocity = 2.0; + +class _FrontLayer extends StatelessWidget { + const _FrontLayer({ + Key key, + this.onTap, + this.child, + }) : super(key: key); + + final VoidCallback onTap; + final Widget child; + + @override + Widget build(BuildContext context) { + return Material( + elevation: 16.0, + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: onTap, + child: Container( + height: 40.0, + alignment: AlignmentDirectional.centerStart, + ), + ), + Expanded( + child: child, + ), + ], + ), + ); + } +} + +class _BackdropTitle extends AnimatedWidget { + final Function onPress; + final Widget frontTitle; + final Widget backTitle; + + const _BackdropTitle({ + Key key, + Listenable listenable, + this.onPress, + @required this.frontTitle, + @required this.backTitle, + }) : assert(frontTitle != null), + assert(backTitle != null), + super(key: key, listenable: listenable); + + @override + Widget build(BuildContext context) { + final Animation animation = this.listenable; + + return DefaultTextStyle( + style: Theme.of(context).primaryTextTheme.title, + softWrap: false, + overflow: TextOverflow.ellipsis, + child: Row(children: [ + // branded icon + SizedBox( + width: 72.0, + child: IconButton( + padding: EdgeInsets.only(right: 8.0), + onPressed: this.onPress, + icon: Stack(children: [ + Opacity( + opacity: animation.value, + child: ImageIcon(AssetImage('assets/slanted_menu.png')), + ), + FractionalTranslation( + translation: Tween( + begin: Offset.zero, + end: Offset(1.0, 0.0), + ).evaluate(animation), + child: ImageIcon(AssetImage('assets/diamond.png')), + ) + ]), + ), + ), + // Here, we do a custom cross fade between backTitle and frontTitle. + // This makes a smooth animation between the two texts. + Stack( + children: [ + Opacity( + opacity: CurvedAnimation( + parent: ReverseAnimation(animation), + curve: Interval(0.5, 1.0), + ).value, + child: FractionalTranslation( + translation: Tween( + begin: Offset.zero, + end: Offset(0.5, 0.0), + ).evaluate(animation), + child: backTitle, + ), + ), + Opacity( + opacity: CurvedAnimation( + parent: animation, + curve: Interval(0.5, 1.0), + ).value, + child: FractionalTranslation( + translation: Tween( + begin: Offset(-0.25, 0.0), + end: Offset.zero, + ).evaluate(animation), + child: frontTitle, + ), + ), + ], + ) + ]), + ); + } +} + +/// Builds a Backdrop. +/// +/// A Backdrop widget has two layers, front and back. The front layer is shown +/// by default, and slides down to show the back layer, from which a user +/// can make a selection. The user can also configure the titles for when the +/// front or back layer is showing. +class Backdrop extends StatefulWidget { + final Category currentCategory; + final Widget frontLayer; + final Widget backLayer; + final Widget frontTitle; + final Widget backTitle; + + const Backdrop({ + @required this.currentCategory, + @required this.frontLayer, + @required this.backLayer, + @required this.frontTitle, + @required this.backTitle, + }) : assert(currentCategory != null), + assert(frontLayer != null), + assert(backLayer != null), + assert(frontTitle != null), + assert(backTitle != null); + + @override + _BackdropState createState() => _BackdropState(); +} + +class _BackdropState extends State + with SingleTickerProviderStateMixin { + final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop'); + AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + duration: Duration(milliseconds: 300), + value: 1.0, + vsync: this, + ); + } + + @override + void didUpdateWidget(Backdrop old) { + super.didUpdateWidget(old); + + if (widget.currentCategory != old.currentCategory) { + _toggleBackdropLayerVisibility(); + } else if (!_frontLayerVisible) { + _controller.fling(velocity: _kFlingVelocity); + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + bool get _frontLayerVisible { + final AnimationStatus status = _controller.status; + return status == AnimationStatus.completed || + status == AnimationStatus.forward; + } + + void _toggleBackdropLayerVisibility() { + _controller.fling( + velocity: _frontLayerVisible ? -_kFlingVelocity : _kFlingVelocity); + } + + Widget _buildStack(BuildContext context, BoxConstraints constraints) { + const double layerTitleHeight = 48.0; + final Size layerSize = constraints.biggest; + final double layerTop = layerSize.height - layerTitleHeight; + + Animation layerAnimation = RelativeRectTween( + begin: RelativeRect.fromLTRB( + 0.0, layerTop, 0.0, layerTop - layerSize.height), + end: RelativeRect.fromLTRB(0.0, 0.0, 0.0, 0.0), + ).animate(_controller.view); + + return Stack( + key: _backdropKey, + children: [ + widget.backLayer, + PositionedTransition( + rect: layerAnimation, + child: _FrontLayer( + onTap: _toggleBackdropLayerVisibility, + child: widget.frontLayer, + ), + ), + ], + ); + } + + @override + Widget build(BuildContext context) { + var appBar = AppBar( + brightness: Brightness.light, + elevation: 0.0, + titleSpacing: 0.0, + title: _BackdropTitle( + listenable: _controller.view, + onPress: _toggleBackdropLayerVisibility, + frontTitle: widget.frontTitle, + backTitle: widget.backTitle, + ), + actions: [ + IconButton( + icon: const Icon(Icons.shopping_cart), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => ShoppingCartPage()), + ); + }, + ), + IconButton( + icon: const Icon(Icons.search), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (BuildContext context) => LoginPage()), + ); + }, + ), + IconButton( + icon: const Icon(Icons.tune), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute(builder: (BuildContext context) => LoginPage()), + ); + }, + ), + ], + ); + return Scaffold( + appBar: appBar, + body: LayoutBuilder( + builder: _buildStack, + ), + ); + } +} diff --git a/shrine/lib/category_menu_page.dart b/shrine/lib/category_menu_page.dart new file mode 100644 index 000000000..453071a38 --- /dev/null +++ b/shrine/lib/category_menu_page.dart @@ -0,0 +1,81 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:meta/meta.dart'; + +import 'colors.dart'; +import 'model/product.dart'; + +class CategoryMenuPage extends StatelessWidget { + final Category currentCategory; + final ValueChanged onCategoryTap; + final List _categories = Category.values; + + const CategoryMenuPage({ + Key key, + @required this.currentCategory, + @required this.onCategoryTap, + }) : assert(currentCategory != null), + assert(onCategoryTap != null); + + Widget _buildCategory(Category category, BuildContext context) { + final categoryString = + category.toString().replaceAll('Category.', '').toUpperCase(); + final ThemeData theme = Theme.of(context); + return GestureDetector( + onTap: () => onCategoryTap(category), + child: category == currentCategory + ? Column( + children: [ + SizedBox(height: 16.0), + Text( + categoryString, + style: theme.textTheme.body2, + textAlign: TextAlign.center, + ), + SizedBox(height: 14.0), + Container( + width: 70.0, + height: 2.0, + color: kShrinePink400, + ), + ], + ) + : Padding( + padding: EdgeInsets.symmetric(vertical: 16.0), + child: Text( + categoryString, + style: theme.textTheme.body2 + .copyWith(color: kShrineBrown900.withAlpha(153)), + textAlign: TextAlign.center, + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + padding: EdgeInsets.only(top: 40.0), + color: kShrinePink100, + child: ListView( + children: _categories + .map((Category c) => _buildCategory(c, context)) + .toList()), + ), + ); + } +} diff --git a/shrine/lib/colors.dart b/shrine/lib/colors.dart new file mode 100644 index 000000000..04298a0bc --- /dev/null +++ b/shrine/lib/colors.dart @@ -0,0 +1,28 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; + +const kShrinePink50 = const Color(0xFFFEEAE6); +const kShrinePink100 = const Color(0xFFFEDBD0); +const kShrinePink300 = const Color(0xFFFBB8AC); +const kShrinePink400 = const Color(0xFFEAA4A4); + +const kShrineBrown900 = const Color(0xFF442B2D); +const kShrineBrown600 = const Color(0xFF7D4F52); + +const kShrineErrorRed = const Color(0xFFC5032B); + +const kShrineSurfaceWhite = const Color(0xFFFFFBFA); +const kShrineBackgroundWhite = Colors.white; diff --git a/shrine/lib/home.dart b/shrine/lib/home.dart new file mode 100644 index 000000000..ba5dd370d --- /dev/null +++ b/shrine/lib/home.dart @@ -0,0 +1,35 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:scoped_model/scoped_model.dart'; + +import 'model/app_state_model.dart'; +import 'model/product.dart'; +import 'supplemental/asymmetric_view.dart'; + +class HomePage extends StatelessWidget { + final Category category; + + const HomePage({this.category: Category.all}); + + @override + Widget build(BuildContext context) { + return ScopedModelDescendant( + builder: (context, child, model) => AsymmetricView( + products: model.getProducts(), + ), + ); + } +} diff --git a/shrine/lib/login.dart b/shrine/lib/login.dart new file mode 100644 index 000000000..030ee79b3 --- /dev/null +++ b/shrine/lib/login.dart @@ -0,0 +1,111 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; + +import 'colors.dart'; + +class LoginPage extends StatefulWidget { + @override + _LoginPageState createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + final _usernameController = TextEditingController(); + final _passwordController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 24.0), + children: [ + SizedBox(height: 80.0), + Column( + children: [ + Image.asset('assets/diamond.png'), + SizedBox(height: 16.0), + Text( + 'SHRINE', + style: Theme.of(context).textTheme.headline, + ), + ], + ), + SizedBox(height: 120.0), + PrimaryColorOverride( + color: kShrineBrown900, + child: TextField( + controller: _usernameController, + decoration: InputDecoration( + labelText: 'Username', + ), + ), + ), + const SizedBox(height: 12.0), + PrimaryColorOverride( + color: kShrineBrown900, + child: TextField( + controller: _passwordController, + decoration: InputDecoration( + labelText: 'Password', + ), + ), + ), + ButtonBar( + children: [ + FlatButton( + child: Text('CANCEL'), + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(7.0)), + ), + onPressed: () { + _usernameController.clear(); + _passwordController.clear(); + }, + ), + RaisedButton( + child: Text('NEXT'), + elevation: 8.0, + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(7.0)), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + ], + ), + ), + ); + } +} + +class PrimaryColorOverride extends StatelessWidget { + const PrimaryColorOverride({Key key, this.color, this.child}) + : super(key: key); + + final Color color; + final Widget child; + + @override + Widget build(BuildContext context) { + return Theme( + child: child, + data: Theme.of(context).copyWith(primaryColor: color), + ); + } +} diff --git a/shrine/lib/main.dart b/shrine/lib/main.dart new file mode 100644 index 000000000..ce4a46e11 --- /dev/null +++ b/shrine/lib/main.dart @@ -0,0 +1,31 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:scoped_model/scoped_model.dart'; + +import 'app.dart'; +import 'model/app_state_model.dart'; + +void main() { + AppStateModel model = AppStateModel(); + model.loadProducts(); + + runApp( + ScopedModel( + model: model, + child: ShrineApp(), + ), + ); +} diff --git a/shrine/lib/model/app_state_model.dart b/shrine/lib/model/app_state_model.dart new file mode 100644 index 000000000..249334247 --- /dev/null +++ b/shrine/lib/model/app_state_model.dart @@ -0,0 +1,107 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:scoped_model/scoped_model.dart'; + +import 'product.dart'; +import 'products_repository.dart'; + +double _salesTaxRate = 0.06; +double _shippingCostPerItem = 7.0; + +class AppStateModel extends Model { + // All the available products. + List _availableProducts; + + // The currently selected category of products. + Category _selectedCategory = Category.all; + + // The IDs and quantities of products currently in the cart. + Map _productsInCart = {}; + + Map get productsInCart => Map.from(_productsInCart); + + // Total number of items in the cart. + int get totalCartQuantity => _productsInCart.values.fold(0, (v, e) => v + e); + + Category get selectedCategory => _selectedCategory; + + // Totaled prices of the items in the cart. + double get subtotalCost => _productsInCart.keys + .map((id) => _availableProducts[id].price * _productsInCart[id]) + .fold(0.0, (sum, e) => sum + e); + + // Total shipping cost for the items in the cart. + double get shippingCost => + _shippingCostPerItem * + _productsInCart.values.fold(0.0, (sum, e) => sum + e); + + // Sales tax for the items in the cart + double get tax => subtotalCost * _salesTaxRate; + + // Total cost to order everything in the cart. + double get totalCost => subtotalCost + shippingCost + tax; + + // Returns a copy of the list of available products, filtered by category. + List getProducts() { + if (_availableProducts == null) return List(); + + if (_selectedCategory == Category.all) { + return List.from(_availableProducts); + } else { + return _availableProducts.where((p) => p.category == _selectedCategory); + } + } + + // Adds a product to the cart. + void addProductToCart(int productId) { + if (!_productsInCart.containsKey(productId)) { + _productsInCart[productId] = 1; + } else { + _productsInCart[productId]++; + } + + notifyListeners(); + } + + // Removes an item from the cart. + void removeItemFromCart(int productId) { + if (_productsInCart.containsKey(productId)) { + if (_productsInCart[productId] == 1) { + _productsInCart.remove(productId); + } else { + _productsInCart[productId]--; + } + } + + notifyListeners(); + } + + // Returns the Product instance matching the provided id. + Product getProductById(int id) { + return _availableProducts.firstWhere((p) => p.id == id); + } + + // Removes everything from the cart. + void clearCart() { + _productsInCart.clear(); + notifyListeners(); + } + + // Loads the list of available products from the repo. + void loadProducts() { + _availableProducts = ProductsRepository.loadProducts(); + notifyListeners(); + } +} diff --git a/shrine/lib/model/product.dart b/shrine/lib/model/product.dart new file mode 100644 index 000000000..ffedcc321 --- /dev/null +++ b/shrine/lib/model/product.dart @@ -0,0 +1,48 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/foundation.dart'; + +enum Category { + all, + accessories, + clothing, + home, +} + +class Product { + const Product({ + @required this.category, + @required this.id, + @required this.isFeatured, + @required this.name, + @required this.price, + }) : assert(category != null), + assert(id != null), + assert(isFeatured != null), + assert(name != null), + assert(price != null); + + final Category category; + final int id; + final bool isFeatured; + final String name; + final int price; + + String get assetName => '$id-0.jpg'; + String get assetPackage => 'shrine_images'; + + @override + String toString() => '$name (id=$id)'; +} diff --git a/shrine/lib/model/products_repository.dart b/shrine/lib/model/products_repository.dart new file mode 100644 index 000000000..01caa04b3 --- /dev/null +++ b/shrine/lib/model/products_repository.dart @@ -0,0 +1,288 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'product.dart'; + +class ProductsRepository { + static List loadProducts() { + return const [ + Product( + category: Category.accessories, + id: 0, + isFeatured: true, + name: 'Vagabond sack', + price: 120, + ), + Product( + category: Category.accessories, + id: 1, + isFeatured: true, + name: 'Stella sunglasses', + price: 58, + ), + Product( + category: Category.accessories, + id: 2, + isFeatured: false, + name: 'Whitney belt', + price: 35, + ), + Product( + category: Category.accessories, + id: 3, + isFeatured: true, + name: 'Garden strand', + price: 98, + ), + Product( + category: Category.accessories, + id: 4, + isFeatured: false, + name: 'Strut earrings', + price: 34, + ), + Product( + category: Category.accessories, + id: 5, + isFeatured: false, + name: 'Varsity socks', + price: 12, + ), + Product( + category: Category.accessories, + id: 6, + isFeatured: false, + name: 'Weave keyring', + price: 16, + ), + Product( + category: Category.accessories, + id: 7, + isFeatured: true, + name: 'Gatsby hat', + price: 40, + ), + Product( + category: Category.accessories, + id: 8, + isFeatured: true, + name: 'Shrug bag', + price: 198, + ), + Product( + category: Category.home, + id: 9, + isFeatured: true, + name: 'Gilt desk trio', + price: 58, + ), + Product( + category: Category.home, + id: 10, + isFeatured: false, + name: 'Copper wire rack', + price: 18, + ), + Product( + category: Category.home, + id: 11, + isFeatured: false, + name: 'Soothe ceramic set', + price: 28, + ), + Product( + category: Category.home, + id: 12, + isFeatured: false, + name: 'Hurrahs tea set', + price: 34, + ), + Product( + category: Category.home, + id: 13, + isFeatured: true, + name: 'Blue stone mug', + price: 18, + ), + Product( + category: Category.home, + id: 14, + isFeatured: true, + name: 'Rainwater tray', + price: 27, + ), + Product( + category: Category.home, + id: 15, + isFeatured: true, + name: 'Chambray napkins', + price: 16, + ), + Product( + category: Category.home, + id: 16, + isFeatured: true, + name: 'Succulent planters', + price: 16, + ), + Product( + category: Category.home, + id: 17, + isFeatured: false, + name: 'Quartet table', + price: 175, + ), + Product( + category: Category.home, + id: 18, + isFeatured: true, + name: 'Kitchen quattro', + price: 129, + ), + Product( + category: Category.clothing, + id: 19, + isFeatured: false, + name: 'Clay sweater', + price: 48, + ), + Product( + category: Category.clothing, + id: 20, + isFeatured: false, + name: 'Sea tunic', + price: 45, + ), + Product( + category: Category.clothing, + id: 21, + isFeatured: false, + name: 'Plaster tunic', + price: 38, + ), + Product( + category: Category.clothing, + id: 22, + isFeatured: false, + name: 'White pinstripe shirt', + price: 70, + ), + Product( + category: Category.clothing, + id: 23, + isFeatured: false, + name: 'Chambray shirt', + price: 70, + ), + Product( + category: Category.clothing, + id: 24, + isFeatured: true, + name: 'Seabreeze sweater', + price: 60, + ), + Product( + category: Category.clothing, + id: 25, + isFeatured: false, + name: 'Gentry jacket', + price: 178, + ), + Product( + category: Category.clothing, + id: 26, + isFeatured: false, + name: 'Navy trousers', + price: 74, + ), + Product( + category: Category.clothing, + id: 27, + isFeatured: true, + name: 'Walter henley (white)', + price: 38, + ), + Product( + category: Category.clothing, + id: 28, + isFeatured: true, + name: 'Surf and perf shirt', + price: 48, + ), + Product( + category: Category.clothing, + id: 29, + isFeatured: true, + name: 'Ginger scarf', + price: 98, + ), + Product( + category: Category.clothing, + id: 30, + isFeatured: true, + name: 'Ramona crossover', + price: 68, + ), + Product( + category: Category.clothing, + id: 31, + isFeatured: false, + name: 'Chambray shirt', + price: 38, + ), + Product( + category: Category.clothing, + id: 32, + isFeatured: false, + name: 'Classic white collar', + price: 58, + ), + Product( + category: Category.clothing, + id: 33, + isFeatured: true, + name: 'Cerise scallop tee', + price: 42, + ), + Product( + category: Category.clothing, + id: 34, + isFeatured: false, + name: 'Shoulder rolls tee', + price: 27, + ), + Product( + category: Category.clothing, + id: 35, + isFeatured: false, + name: 'Grey slouch tank', + price: 24, + ), + Product( + category: Category.clothing, + id: 36, + isFeatured: false, + name: 'Sunshirt dress', + price: 58, + ), + Product( + category: Category.clothing, + id: 37, + isFeatured: true, + name: 'Fine lines tee', + price: 58, + ), + ]; + } +} diff --git a/shrine/lib/shopping_cart.dart b/shrine/lib/shopping_cart.dart new file mode 100644 index 000000000..c1aa1e4c8 --- /dev/null +++ b/shrine/lib/shopping_cart.dart @@ -0,0 +1,271 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:scoped_model/scoped_model.dart'; + +import 'colors.dart'; +import 'model/app_state_model.dart'; +import 'model/product.dart'; + +const _leftColumnWidth = 60.0; + +class ShoppingCartPage extends StatefulWidget { + @override + _ShoppingCartPageState createState() => _ShoppingCartPageState(); +} + +class _ShoppingCartPageState extends State { + List _createShoppingCartRows(AppStateModel model) { + return model.productsInCart.keys + .map( + (id) => ShoppingCartRow( + product: model.getProductById(id), + quantity: model.productsInCart[id], + onPressed: () { + model.removeItemFromCart(id); + }, + ), + ) + .toList(); + } + + @override + Widget build(BuildContext context) { + final localTheme = Theme.of(context); + + return Scaffold( + backgroundColor: kShrinePink100, + body: SafeArea( + child: Container( + child: ScopedModelDescendant( + builder: (context, child, model) { + return Stack( + children: [ + ListView( + children: [ + Row( + children: [ + SizedBox( + width: _leftColumnWidth, + child: IconButton( + icon: const Icon(Icons.keyboard_arrow_down), + onPressed: () => Navigator.of(context).pop(), + ), + ), + Text( + 'CART', + style: localTheme.textTheme.subhead + .copyWith(fontWeight: FontWeight.w600), + ), + const SizedBox(width: 16.0), + Text('${model.totalCartQuantity} ITEMS'), + ], + ), + const SizedBox(height: 16.0), + Column( + children: _createShoppingCartRows(model), + ), + ShoppingCartSummary(model: model), + const SizedBox(height: 100.0), + ], + ), + Positioned( + bottom: 16.0, + left: 16.0, + right: 16.0, + child: RaisedButton( + shape: const BeveledRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(7.0)), + ), + color: kShrinePink300, + splashColor: kShrineBrown600, + child: const Padding( + padding: EdgeInsets.symmetric(vertical: 12.0), + child: Text('CLEAR CART'), + ), + onPressed: () { + model.clearCart(); + Navigator.of(context).pop(); + }, + ), + ), + ], + ); + }, + ), + ), + ), + ); + } +} + +class ShoppingCartSummary extends StatelessWidget { + ShoppingCartSummary({this.model}); + + final AppStateModel model; + + @override + Widget build(BuildContext context) { + final smallAmountStyle = + Theme.of(context).textTheme.body1.copyWith(color: kShrineBrown600); + final largeAmountStyle = Theme.of(context).textTheme.display1; + final formatter = NumberFormat.simpleCurrency( + decimalDigits: 2, locale: Localizations.localeOf(context).toString()); + + return Row( + children: [ + SizedBox(width: _leftColumnWidth), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Expanded( + child: Text('TOTAL'), + ), + Text( + formatter.format(model.totalCost), + style: largeAmountStyle, + ), + ], + ), + const SizedBox(height: 16.0), + Row( + children: [ + const Expanded( + child: Text('Subtotal:'), + ), + Text( + formatter.format(model.subtotalCost), + style: smallAmountStyle, + ), + ], + ), + const SizedBox(height: 4.0), + Row( + children: [ + const Expanded( + child: Text('Shipping:'), + ), + Text( + formatter.format(model.shippingCost), + style: smallAmountStyle, + ), + ], + ), + const SizedBox(height: 4.0), + Row( + children: [ + const Expanded( + child: Text('Tax:'), + ), + Text( + formatter.format(model.tax), + style: smallAmountStyle, + ), + ], + ), + ], + ), + ), + ), + ], + ); + } +} + +class ShoppingCartRow extends StatelessWidget { + ShoppingCartRow( + {@required this.product, @required this.quantity, this.onPressed}); + + final Product product; + final int quantity; + final VoidCallback onPressed; + + @override + Widget build(BuildContext context) { + final formatter = NumberFormat.simpleCurrency( + decimalDigits: 0, locale: Localizations.localeOf(context).toString()); + final localTheme = Theme.of(context); + + return Padding( + padding: const EdgeInsets.only(bottom: 16.0), + child: Row( + key: ValueKey(product.id), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: _leftColumnWidth, + child: IconButton( + icon: const Icon(Icons.remove_circle_outline), + onPressed: onPressed, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 16.0), + child: Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + product.assetName, + package: product.assetPackage, + fit: BoxFit.cover, + width: 75.0, + height: 75.0, + ), + const SizedBox(width: 16.0), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text('Quantity: $quantity'), + ), + Text('x ${formatter.format(product.price)}'), + ], + ), + Text( + product.name, + style: localTheme.textTheme.subhead + .copyWith(fontWeight: FontWeight.w600), + ), + ], + ), + ), + ], + ), + const SizedBox(height: 16.0), + const Divider( + color: kShrineBrown900, + height: 10.0, + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/shrine/lib/supplemental/asymmetric_view.dart b/shrine/lib/supplemental/asymmetric_view.dart new file mode 100644 index 000000000..2cbe16e80 --- /dev/null +++ b/shrine/lib/supplemental/asymmetric_view.dart @@ -0,0 +1,95 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; + +import '../model/product.dart'; +import 'product_columns.dart'; + +class AsymmetricView extends StatelessWidget { + final List products; + + const AsymmetricView({Key key, this.products}); + + List _buildColumns(BuildContext context) { + if (products == null || products.isEmpty) { + return const []; + } + + /// This will return a list of columns. It will oscillate between the two + /// kinds of columns. Even cases of the index (0, 2, 4, etc) will be + /// TwoProductCardColumn and the odd cases will be OneProductCardColumn. + /// + /// Each pair of columns will advance us 3 products forward (2 + 1). That's + /// some kinda awkward math so we use _evenCasesIndex and _oddCasesIndex as + /// helpers for creating the index of the product list that will correspond + /// to the index of the list of columns. + return List.generate(_listItemCount(products.length), (int index) { + double width = .59 * MediaQuery.of(context).size.width; + Widget column; + if (index % 2 == 0) { + /// Even cases + int bottom = _evenCasesIndex(index); + column = TwoProductCardColumn( + bottom: products[bottom], + top: products.length - 1 >= bottom + 1 + ? products[bottom + 1] + : null); + width += 32.0; + } else { + /// Odd cases + column = OneProductCardColumn( + product: products[_oddCasesIndex(index)], + ); + } + return Container( + width: width, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: column, + ), + ); + }).toList(); + } + + int _evenCasesIndex(int input) { + /// The operator ~/ is a cool one. It's the truncating division operator. It + /// divides the number and if there's a remainder / decimal, it cuts it off. + /// This is like dividing and then casting the result to int. Also, it's + /// functionally equivalent to floor() in this case. + return input ~/ 2 * 3; + } + + int _oddCasesIndex(int input) { + assert(input > 0); + return (input / 2).ceil() * 3 - 1; + } + + int _listItemCount(int totalItems) { + if (totalItems % 3 == 0) { + return totalItems ~/ 3 * 2; + } else { + return (totalItems / 3).ceil() * 2 - 1; + } + } + + @override + Widget build(BuildContext context) { + return ListView( + scrollDirection: Axis.horizontal, + padding: EdgeInsets.fromLTRB(0.0, 34.0, 16.0, 44.0), + children: _buildColumns(context), + ); + } +} diff --git a/shrine/lib/supplemental/cut_corners_border.dart b/shrine/lib/supplemental/cut_corners_border.dart new file mode 100644 index 000000000..7e29e5e6b --- /dev/null +++ b/shrine/lib/supplemental/cut_corners_border.dart @@ -0,0 +1,139 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'dart:ui' show lerpDouble; + +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; + +class CutCornersBorder extends OutlineInputBorder { + const CutCornersBorder({ + BorderSide borderSide: BorderSide.none, + BorderRadius borderRadius: const BorderRadius.all(Radius.circular(2.0)), + this.cut: 7.0, + double gapPadding: 2.0, + }) : super( + borderSide: borderSide, + borderRadius: borderRadius, + gapPadding: gapPadding); + + @override + CutCornersBorder copyWith({ + BorderSide borderSide, + BorderRadius borderRadius, + double gapPadding, + double cut, + }) { + return CutCornersBorder( + borderRadius: borderRadius ?? this.borderRadius, + borderSide: borderSide ?? this.borderSide, + cut: cut ?? this.cut, + gapPadding: gapPadding ?? this.gapPadding, + ); + } + + final double cut; + + @override + ShapeBorder lerpFrom(ShapeBorder a, double t) { + if (a is CutCornersBorder) { + final CutCornersBorder outline = a; + return CutCornersBorder( + borderRadius: BorderRadius.lerp(outline.borderRadius, borderRadius, t), + borderSide: BorderSide.lerp(outline.borderSide, borderSide, t), + cut: cut, + gapPadding: outline.gapPadding, + ); + } + return super.lerpFrom(a, t); + } + + @override + ShapeBorder lerpTo(ShapeBorder b, double t) { + if (b is CutCornersBorder) { + final CutCornersBorder outline = b; + return CutCornersBorder( + borderRadius: BorderRadius.lerp(borderRadius, outline.borderRadius, t), + borderSide: BorderSide.lerp(borderSide, outline.borderSide, t), + cut: cut, + gapPadding: outline.gapPadding, + ); + } + return super.lerpTo(b, t); + } + + Path _notchedCornerPath(Rect center, + [double start = 0.0, double extent = 0.0]) { + final Path path = Path(); + if (start > 0.0 || extent > 0.0) { + path.relativeMoveTo(extent + start, center.top); + _notchedSidesAndBottom(center, path); + path..lineTo(center.left + cut, center.top)..lineTo(start, center.top); + } else { + path.moveTo(center.left + cut, center.top); + _notchedSidesAndBottom(center, path); + path.lineTo(center.left + cut, center.top); + } + return path; + } + + Path _notchedSidesAndBottom(Rect center, Path path) { + return path + ..lineTo(center.right - cut, center.top) + ..lineTo(center.right, center.top + cut) + ..lineTo(center.right, center.top + center.height - cut) + ..lineTo(center.right - cut, center.top + center.height) + ..lineTo(center.left + cut, center.top + center.height) + ..lineTo(center.left, center.top + center.height - cut) + ..lineTo(center.left, center.top + cut); + } + + @override + void paint( + Canvas canvas, + Rect rect, { + double gapStart, + double gapExtent: 0.0, + double gapPercentage: 0.0, + TextDirection textDirection, + }) { + assert(gapExtent != null); + assert(gapPercentage >= 0.0 && gapPercentage <= 1.0); + + final Paint paint = borderSide.toPaint(); + final RRect outer = borderRadius.toRRect(rect); + if (gapStart == null || gapExtent <= 0.0 || gapPercentage == 0.0) { + canvas.drawPath(_notchedCornerPath(outer.middleRect), paint); + } else { + final double extent = + lerpDouble(0.0, gapExtent + gapPadding * 2.0, gapPercentage); + switch (textDirection) { + case TextDirection.rtl: + { + final Path path = _notchedCornerPath( + outer.middleRect, gapStart + gapPadding - extent, extent); + canvas.drawPath(path, paint); + break; + } + case TextDirection.ltr: + { + final Path path = _notchedCornerPath( + outer.middleRect, gapStart - gapPadding, extent); + canvas.drawPath(path, paint); + break; + } + } + } + } +} diff --git a/shrine/lib/supplemental/product_card.dart b/shrine/lib/supplemental/product_card.dart new file mode 100644 index 000000000..59381446c --- /dev/null +++ b/shrine/lib/supplemental/product_card.dart @@ -0,0 +1,88 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:scoped_model/scoped_model.dart'; + +import '../model/app_state_model.dart'; +import '../model/product.dart'; + +class ProductCard extends StatelessWidget { + ProductCard({this.imageAspectRatio: 33 / 49, this.product}) + : assert(imageAspectRatio == null || imageAspectRatio > 0); + + final double imageAspectRatio; + final Product product; + + static final kTextBoxHeight = 65.0; + + @override + Widget build(BuildContext context) { + final NumberFormat formatter = NumberFormat.simpleCurrency( + decimalDigits: 0, locale: Localizations.localeOf(context).toString()); + final ThemeData theme = Theme.of(context); + + final imageWidget = Image.asset( + product.assetName, + package: product.assetPackage, + fit: BoxFit.cover, + ); + + return ScopedModelDescendant( + builder: (context, child, model) => GestureDetector( + onTap: () { + model.addProductToCart(product.id); + Scaffold.of(context).showSnackBar(SnackBar( + content: + Text('${product.name} has been added to your cart.'), + )); + }, + child: child, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AspectRatio( + aspectRatio: imageAspectRatio, + child: imageWidget, + ), + SizedBox( + height: kTextBoxHeight * MediaQuery.of(context).textScaleFactor, + width: 121.0, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + product == null ? '' : product.name, + style: theme.textTheme.button, + softWrap: false, + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + SizedBox(height: 4.0), + Text( + product == null ? '' : formatter.format(product.price), + style: theme.textTheme.caption, + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/shrine/lib/supplemental/product_columns.dart b/shrine/lib/supplemental/product_columns.dart new file mode 100644 index 000000000..c12e9ebf6 --- /dev/null +++ b/shrine/lib/supplemental/product_columns.dart @@ -0,0 +1,87 @@ +// Copyright 2018-present the Flutter authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:flutter/material.dart'; + +import '../model/product.dart'; +import 'product_card.dart'; + +class TwoProductCardColumn extends StatelessWidget { + TwoProductCardColumn({ + this.bottom, + this.top, + }) : assert(bottom != null); + + final Product bottom, top; + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + const spacerHeight = 44.0; + + double heightOfCards = (constraints.biggest.height - spacerHeight) / 2.0; + double heightOfImages = heightOfCards - ProductCard.kTextBoxHeight; + double imageAspectRatio = + (heightOfImages >= 0.0 && constraints.biggest.width > heightOfImages) + ? constraints.biggest.width / heightOfImages + : 33 / 49; + + return ListView( + children: [ + Padding( + padding: EdgeInsetsDirectional.only(start: 28.0), + child: top != null + ? ProductCard( + imageAspectRatio: imageAspectRatio, + product: top, + ) + : SizedBox( + height: heightOfCards, + ), + ), + SizedBox(height: spacerHeight), + Padding( + padding: EdgeInsetsDirectional.only(end: 28.0), + child: ProductCard( + imageAspectRatio: imageAspectRatio, + product: bottom, + ), + ), + ], + ); + }); + } +} + +class OneProductCardColumn extends StatelessWidget { + OneProductCardColumn({this.product}); + + final Product product; + + @override + Widget build(BuildContext context) { + return ListView( + reverse: true, + children: [ + SizedBox( + height: 40.0, + ), + ProductCard( + product: product, + ), + ], + ); + } +} diff --git a/shrine/pubspec.yaml b/shrine/pubspec.yaml new file mode 100644 index 000000000..b5129de5f --- /dev/null +++ b/shrine/pubspec.yaml @@ -0,0 +1,65 @@ +name: Shrine +description: Take your design up a notch and learn to use our advanced component backdrop menu. + +dependencies: + flutter: + sdk: flutter + + cupertino_icons: ^0.1.2 + intl: 0.15.6 + scoped_model: 0.2.0 + shrine_images: 1.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + +flutter: + uses-material-design: true + assets: + - assets/diamond.png + - assets/slanted_menu.png + - packages/shrine_images/0-0.jpg + - packages/shrine_images/1-0.jpg + - packages/shrine_images/2-0.jpg + - packages/shrine_images/3-0.jpg + - packages/shrine_images/4-0.jpg + - packages/shrine_images/5-0.jpg + - packages/shrine_images/6-0.jpg + - packages/shrine_images/7-0.jpg + - packages/shrine_images/8-0.jpg + - packages/shrine_images/9-0.jpg + - packages/shrine_images/10-0.jpg + - packages/shrine_images/11-0.jpg + - packages/shrine_images/12-0.jpg + - packages/shrine_images/13-0.jpg + - packages/shrine_images/14-0.jpg + - packages/shrine_images/15-0.jpg + - packages/shrine_images/16-0.jpg + - packages/shrine_images/17-0.jpg + - packages/shrine_images/18-0.jpg + - packages/shrine_images/19-0.jpg + - packages/shrine_images/20-0.jpg + - packages/shrine_images/21-0.jpg + - packages/shrine_images/22-0.jpg + - packages/shrine_images/23-0.jpg + - packages/shrine_images/24-0.jpg + - packages/shrine_images/25-0.jpg + - packages/shrine_images/26-0.jpg + - packages/shrine_images/27-0.jpg + - packages/shrine_images/28-0.jpg + - packages/shrine_images/29-0.jpg + - packages/shrine_images/30-0.jpg + - packages/shrine_images/31-0.jpg + - packages/shrine_images/32-0.jpg + - packages/shrine_images/33-0.jpg + - packages/shrine_images/34-0.jpg + - packages/shrine_images/35-0.jpg + - packages/shrine_images/36-0.jpg + - packages/shrine_images/37-0.jpg + fonts: + - family: Rubik + fonts: + - asset: fonts/Rubik-Regular.ttf + - asset: fonts/Rubik-Medium.ttf + weight: 500 diff --git a/shrine/test/main_test.dart b/shrine/test/main_test.dart new file mode 100644 index 000000000..ab73b3a23 --- /dev/null +++ b/shrine/test/main_test.dart @@ -0,0 +1 @@ +void main() {}