diff --git a/LabelStoreMax/.env b/LabelStoreMax/.env new file mode 100644 index 0000000..7e67e4b --- /dev/null +++ b/LabelStoreMax/.env @@ -0,0 +1,34 @@ +# ** + +APP_NAME="MyApp" +APP_ENV="local" +APP_DEBUG="true" +APP_URL="https://mywoocommercestore.com" + +ASSET_PATH_PUBLIC="public/assets/" +ASSET_PATH_IMAGES="public/assets/images" +TIMEZONE="UTC" +DEFAULT_LOCALE="en" + +# ** + +APP_KEY="your app key" +# App key from WooSignal link: https://woosignal.com/dashboard/apps + +# ** + +STRIPE_ACCOUNT="Stripe account key from WooSignal" +# Stripe account key from WooSignal https://woosignal.com/dashboard + +STRIPE_LIVE_MODE="false" +# Change to 'true' for live payments and update the "Environment for Stripe" here https://woosignal.com/dashboard + +# ** + +RAZORPAY_ID="" +# Razorpay ID from https://razorpay.com + +# ** + +PRODUCT_PLACEHOLDER_IMAGE="https://woosignal.com/images/woocommerce-placeholder.png" +# Sets the default placeholder image for products with no image \ No newline at end of file diff --git a/LabelStoreMax/CHANGELOG.md b/LabelStoreMax/CHANGELOG.md index 04f45b1..56fe171 100644 --- a/LabelStoreMax/CHANGELOG.md +++ b/LabelStoreMax/CHANGELOG.md @@ -1,3 +1,15 @@ +## [4.0.0] - 2020-03-28 + +* Major release +* New config structure +* Dark mode added +* Menu drawer added +* Project refactor to use Nylo Framework +* Performance boost +* Bug fixes +* Dart code formatted +* Pubspec.yaml dependency updates + ## [3.0.0] - 2020-03-08 * Major release diff --git a/LabelStoreMax/LICENSE b/LabelStoreMax/LICENSE new file mode 100644 index 0000000..541ae49 --- /dev/null +++ b/LabelStoreMax/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2021, WooSignal Ltd +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LabelStoreMax/README.md b/LabelStoreMax/README.md index 2070cd9..d68588d 100644 --- a/LabelStoreMax/README.md +++ b/LabelStoreMax/README.md @@ -1,30 +1,60 @@ -# label_storemax +

+ WooSignal logo +

-LabelStoreMAX -Created by Anthony Gordon. +# WooCommerce App: Label StoreMax -[Official WooSignal App Template](https://woosignal.com) +### Label StoreMax - v4.0.0 -## Getting Started -1. Connect your WooCommerce store -Click connect above to link your WooCommerce store to our site, all you'll need to do is add your url to provide WooSignal access. +[Official WooSignal WooCommerce App](https://woosignal.com) -2. Generate an AppKey for the app -Next go to [manage apps page](https://woosignal.com/dashboard/apps) and click "Generate new key" for your app and copy it to somewhere safe, it's important that you don't share is with anyone. +![alt text](https://woosignal.com/images/woocommerce_app_preview_2.png "WooCommerce app checkout experience") -3. Add the AppKey to the project -Look for the labelconfig.dart file and change the AppKey to the one your generated. +![alt text](https://woosignal.com/images/woocommerce_app_preview_3.png "WooCommerce app Login/Register for customers via WordPress") -4. Build and run the app -If you have done all of the above you should have a basic setup to get started, you'll see products from your WooCommerce store appearing in the app. +![alt text](https://woosignal.com/images/woocommerce_app_preview_1.png "Full integration with WooCommerce") -5. Uploading to the App Store/Google Play Store? -Uploading your app release to IOS [IOS guide](https://flutter.dev/docs/deployment/ios) +![alt text](https://woosignal.com/images/mock_dark_light_mode.png "Dark and light mode shopping") -Uploading your app release to Android [Android guide](https://flutter.dev/docs/deployment/android) +### About Label StoreMax -## Need help uploading the app? -Check out our YouTube series to help you with uploading the app and other tips +Label StoreMax is an App Template for WooCommerce stores. Your customers will be able to browse products, make orders and login via WordPress. You can also customise the look and feel of the app in the WooSignal dashboard. -[Support](https://woosignal.com/support) \ No newline at end of file +You can also upload the app to the IOS app store and Google play store using Flutter. + +### Requirements + +- WooCommerce Store 3.5+ +- Android Studio/VSCode (for running the app) +- Flutter installed + +### Getting Started + +1. Download/Clone this repository +2. Sign up for free on [WooSignal](https://woosignal.com) and link your WooCommerce store +3. Add your app key into the **.env** file and hit play (with Android Studio) to build the app 🥳 + +Full documentation this available [here](https://woosignal.com/docs/app/ios/label-storemax) + +## Some features integrated + +- App Store Ready +- Simple configuration +- Browse products, make orders, customer login (via WordPress) +- Change app name, logo, customize default language, currency + more +- Light and dark mode +- Stripe, Cash On Delivery, RazorPay +- Localized for en, es, pt, it, hi, fr +- Orders show as normal in WooCommerce + +## Security Vulnerabilities +If you discover a security vulnerability within WooSignal, please send an e-mail support@woosignal.com + +## Uploading to the app stores + +- [IOS - Deployment](https://flutter.dev/docs/deployment/ios) +- [Android - Deployment](https://flutter.dev/docs/deployment/android) + +## Licence +The Label StoreMax framework is open-sourced software licensed under the MIT license. diff --git a/LabelStoreMax/android/app/build.gradle b/LabelStoreMax/android/app/build.gradle index ba6f08e..3ff0139 100644 --- a/LabelStoreMax/android/app/build.gradle +++ b/LabelStoreMax/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 28 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -50,13 +50,6 @@ android { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - - // Uncomment "signingConfig signingConfigs.release" - // Remove "signingConfig signingConfigs.debug" - // When you're ready to build for release - // Also check out https://flutter.dev/docs/deployment/android - // Set the key.properties when building apk or appbundle - signingConfig signingConfigs.debug } } @@ -68,5 +61,5 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.android.support:multidex:1.0.3' -} + implementation "androidx.multidex:multidex:2.0.1" +} \ No newline at end of file diff --git a/LabelStoreMax/android/app/src/main/AndroidManifest.xml b/LabelStoreMax/android/app/src/main/AndroidManifest.xml index 149e539..b7d70b8 100644 --- a/LabelStoreMax/android/app/src/main/AndroidManifest.xml +++ b/LabelStoreMax/android/app/src/main/AndroidManifest.xml @@ -58,4 +58,4 @@ android:name="flutterEmbedding" android:value="2" /> - + \ No newline at end of file diff --git a/LabelStoreMax/android/gradle.properties b/LabelStoreMax/android/gradle.properties index a673820..38c8d45 100644 --- a/LabelStoreMax/android/gradle.properties +++ b/LabelStoreMax/android/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true android.useAndroidX=true android.enableJetifier=true -android.enableR8=true diff --git a/LabelStoreMax/apispec.json b/LabelStoreMax/apispec.json new file mode 100644 index 0000000..c44dc44 --- /dev/null +++ b/LabelStoreMax/apispec.json @@ -0,0 +1,3 @@ +[ + +] \ No newline at end of file diff --git a/LabelStoreMax/assets/fonts/Overpass/OFL.txt b/LabelStoreMax/assets/fonts/Overpass/OFL.txt deleted file mode 100755 index fdaf13c..0000000 --- a/LabelStoreMax/assets/fonts/Overpass/OFL.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2016 by Red Hat, Inc. All rights reserved. - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-Black.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-Black.ttf deleted file mode 100755 index aa9e740..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-Black.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-BlackItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-BlackItalic.ttf deleted file mode 100755 index c0a82ca..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-BlackItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-Bold.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-Bold.ttf deleted file mode 100755 index c5ed6f8..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-Bold.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-BoldItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-BoldItalic.ttf deleted file mode 100755 index c648ae9..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-BoldItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBold.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBold.ttf deleted file mode 100755 index 40daed2..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBold.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBoldItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBoldItalic.ttf deleted file mode 100755 index 0ba125b..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraBoldItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLight.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLight.ttf deleted file mode 100755 index c57a7f2..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLight.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLightItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLightItalic.ttf deleted file mode 100755 index 504cc76..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-ExtraLightItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-Light.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-Light.ttf deleted file mode 100755 index be884dd..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-Light.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-LightItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-LightItalic.ttf deleted file mode 100755 index 2b1352d..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-LightItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-Regular.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-Regular.ttf deleted file mode 100755 index 0deeda5..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-Regular.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-RegularItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-RegularItalic.ttf deleted file mode 100755 index 78032b1..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-RegularItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBold.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBold.ttf deleted file mode 100755 index f690d8e..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBold.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBoldItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBoldItalic.ttf deleted file mode 100755 index 4a1c4a4..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-SemiBoldItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-Thin.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-Thin.ttf deleted file mode 100755 index f01017a..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-Thin.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Overpass/Overpass-ThinItalic.ttf b/LabelStoreMax/assets/fonts/Overpass/Overpass-ThinItalic.ttf deleted file mode 100755 index 2a5d951..0000000 Binary files a/LabelStoreMax/assets/fonts/Overpass/Overpass-ThinItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/OFL.txt b/LabelStoreMax/assets/fonts/Source_Sans_Pro/OFL.txt deleted file mode 100755 index 72d81ab..0000000 --- a/LabelStoreMax/assets/fonts/Source_Sans_Pro/OFL.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name ‘Source’. - -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf deleted file mode 100755 index 4569f24..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Black.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BlackItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BlackItalic.ttf deleted file mode 100755 index 3477e16..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BlackItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf deleted file mode 100755 index 1f430e2..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Bold.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BoldItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BoldItalic.ttf deleted file mode 100755 index 98089fd..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-BoldItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLight.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLight.ttf deleted file mode 100755 index caf2673..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLight.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLightItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLightItalic.ttf deleted file mode 100755 index b0362f3..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-ExtraLightItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf deleted file mode 100755 index 348871a..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Light.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-LightItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-LightItalic.ttf deleted file mode 100755 index 989dc8e..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-LightItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf deleted file mode 100755 index b422bf4..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-Regular.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-RegularItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-RegularItalic.ttf deleted file mode 100755 index e7b9182..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-RegularItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf deleted file mode 100755 index 2908e0d..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBold.ttf and /dev/null differ diff --git a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBoldItalic.ttf b/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBoldItalic.ttf deleted file mode 100755 index 990cf91..0000000 Binary files a/LabelStoreMax/assets/fonts/Source_Sans_Pro/SourceSansPro-SemiBoldItalic.ttf and /dev/null differ diff --git a/LabelStoreMax/ios/.gitignore b/LabelStoreMax/ios/.gitignore new file mode 100644 index 0000000..e96ef60 --- /dev/null +++ b/LabelStoreMax/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/LabelStoreMax/ios/Flutter/.last_build_id b/LabelStoreMax/ios/Flutter/.last_build_id index 6c5bcf2..7c5a8fa 100644 --- a/LabelStoreMax/ios/Flutter/.last_build_id +++ b/LabelStoreMax/ios/Flutter/.last_build_id @@ -1 +1 @@ -5b271ab1c6a17b054237577340baf791 \ No newline at end of file +ed7b4bd8f32e5ea11f5ee09951e3fca9 \ No newline at end of file diff --git a/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist b/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist index 5415f75..6b4c0f7 100644 --- a/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist +++ b/LabelStoreMax/ios/Flutter/AppFrameworkInfo.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 13.00 + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + 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/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj b/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj index 5ec8a81..66a031e 100644 --- a/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj +++ b/LabelStoreMax/ios/Runner.xcodeproj/project.pbxproj @@ -3,18 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 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 */; }; - D86A9FCC0FDE40E749D2F6CC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41358261A3745FB464B72CE9 /* Pods_Runner.framework */; }; + BC760DE05EE229D80D672CAC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 320EF84A9034996DB0DD16A0 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -31,15 +30,15 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0CCBA7AF2BAD9552DF0067C7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 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 = ""; }; - 1BA921103C32B79944361E71 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 320EF84A9034996DB0DD16A0 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 41358261A3745FB464B72CE9 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 87F77F819B61E54C61672D11 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 857C6B0641385D9A8CF0C7D1 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 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 = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -47,7 +46,7 @@ 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 = ""; }; - E107F71D46A779B424A08899 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + DF4BE73D09DD6B58A2617025 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,21 +54,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D86A9FCC0FDE40E749D2F6CC /* Pods_Runner.framework in Frameworks */, + BC760DE05EE229D80D672CAC /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3E3E1C811B47477CF4A9A315 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 41358261A3745FB464B72CE9 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -87,8 +78,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - A759088B62C60268D25F841F /* Pods */, - 3E3E1C811B47477CF4A9A315 /* Frameworks */, + B6D068D2059A697428792520 /* Pods */, + C6C43B1429552E4F1EDF143D /* Frameworks */, ); sourceTree = ""; }; @@ -107,7 +98,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, @@ -116,23 +106,24 @@ path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { + B6D068D2059A697428792520 /* Pods */ = { isa = PBXGroup; children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A759088B62C60268D25F841F /* Pods */ = { - isa = PBXGroup; - children = ( - E107F71D46A779B424A08899 /* Pods-Runner.debug.xcconfig */, - 87F77F819B61E54C61672D11 /* Pods-Runner.release.xcconfig */, - 1BA921103C32B79944361E71 /* Pods-Runner.profile.xcconfig */, + 0CCBA7AF2BAD9552DF0067C7 /* Pods-Runner.debug.xcconfig */, + 857C6B0641385D9A8CF0C7D1 /* Pods-Runner.release.xcconfig */, + DF4BE73D09DD6B58A2617025 /* Pods-Runner.profile.xcconfig */, ); path = Pods; sourceTree = ""; }; + C6C43B1429552E4F1EDF143D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 320EF84A9034996DB0DD16A0 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -140,14 +131,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 7A4371A0EF7EDBC9E03FB2D7 /* [CP] Check Pods Manifest.lock */, + C132651D93B0648B694CECED /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - C10A9485E174060F4694B3D0 /* [CP] Embed Pods Frameworks */, + BEC85B489BA218F6E1950BBC /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -165,16 +156,16 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0910; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -198,7 +189,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -219,9 +209,40 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 7A4371A0EF7EDBC9E03FB2D7 /* [CP] Check Pods Manifest.lock */ = { + 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"; + }; + BEC85B489BA218F6E1950BBC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + C132651D93B0648B694CECED /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -243,64 +264,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 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\n"; - }; - C10A9485E174060F4694B3D0 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", - "${BUILT_PRODUCTS_DIR}/Stripe/Stripe.framework", - "${BUILT_PRODUCTS_DIR}/device_info/device_info.framework", - "${BUILT_PRODUCTS_DIR}/flutter_money_formatter/flutter_money_formatter.framework", - "${BUILT_PRODUCTS_DIR}/flutter_web_browser/flutter_web_browser.framework", - "${BUILT_PRODUCTS_DIR}/hexcolor/hexcolor.framework", - "${BUILT_PRODUCTS_DIR}/package_info/package_info.framework", - "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", - "${PODS_ROOT}/razorpay-pod/Pod/Razorpay.framework", - "${BUILT_PRODUCTS_DIR}/razorpay_flutter/razorpay_flutter.framework", - "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", - "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", - "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", - "${BUILT_PRODUCTS_DIR}/woosignal_stripe/woosignal_stripe.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_money_formatter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_web_browser.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hexcolor.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Razorpay.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/razorpay_flutter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/woosignal_stripe.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -379,6 +342,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -398,16 +362,18 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.woosignal.label-StoreMax"; - PRODUCT_NAME = Runner; + PRODUCT_BUNDLE_IDENTIFIER = com.flutter.app; + PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; @@ -512,7 +478,9 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -532,17 +500,19 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.woosignal.label-StoreMax"; - PRODUCT_NAME = Runner; + PRODUCT_BUNDLE_IDENTIFIER = com.flutter.app; + PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; @@ -562,16 +532,18 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.woosignal.label-StoreMax"; - PRODUCT_NAME = Runner; + PRODUCT_BUNDLE_IDENTIFIER = com.flutter.app; + PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; diff --git a/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/LabelStoreMax/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc..a28140c 100644 --- a/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/LabelStoreMax/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,6 +27,8 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + - - + + + + + + + + PreviewsEnabled + + + diff --git a/LabelStoreMax/ios/Runner/AppDelegate.swift b/LabelStoreMax/ios/Runner/AppDelegate.swift index 643f0ca..70693e4 100644 --- a/LabelStoreMax/ios/Runner/AppDelegate.swift +++ b/LabelStoreMax/ios/Runner/AppDelegate.swift @@ -3,7 +3,6 @@ import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { - override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? @@ -11,5 +10,4 @@ import Flutter GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } - } diff --git a/LabelStoreMax/lang/de.json b/LabelStoreMax/lang/de.json index 48e97ed..c0d17b5 100644 --- a/LabelStoreMax/lang/de.json +++ b/LabelStoreMax/lang/de.json @@ -174,5 +174,7 @@ "for": "zum", "Buy Product": "Produkt kaufen", "Retry": "Wiederholen", - "Retry later": "Versuchen Sie es später erneut" + "Retry later": "Versuchen Sie es später erneut", + "Light Mode": "Lichtmodus", + "Dark Mode": "Dunkler Modus" } \ No newline at end of file diff --git a/LabelStoreMax/lang/en.json b/LabelStoreMax/lang/en.json index cb8177a..15c2321 100644 --- a/LabelStoreMax/lang/en.json +++ b/LabelStoreMax/lang/en.json @@ -174,5 +174,7 @@ "for": "for", "Buy Product": "Buy Product", "Retry": "Retry", - "Retry later": "Retry later" + "Retry later": "Retry later", + "Light Mode": "Light Mode", + "Dark Mode": "Dark Mode" } \ No newline at end of file diff --git a/LabelStoreMax/lang/es.json b/LabelStoreMax/lang/es.json index a98ce7d..173fee9 100644 --- a/LabelStoreMax/lang/es.json +++ b/LabelStoreMax/lang/es.json @@ -174,5 +174,7 @@ "for": "para", "Buy Product": "Comprar producto", "Retry": "Rever", - "Retry later": "Reintentar más tarde" + "Retry later": "Reintentar más tarde", + "Light Mode": "Modo de luz", + "Dark Mode": "Modo oscuro" } \ No newline at end of file diff --git a/LabelStoreMax/lang/fr.json b/LabelStoreMax/lang/fr.json index 9128c1d..6c0b164 100644 --- a/LabelStoreMax/lang/fr.json +++ b/LabelStoreMax/lang/fr.json @@ -174,5 +174,7 @@ "for": "pour", "Buy Product": "Acheter un produit", "Retry": "Recommencez", - "Retry later": "Réessayer plus tard" + "Retry later": "Réessayer plus tard", + "Light Mode": "Mode lumière", + "Dark Mode": "Mode sombre" } \ No newline at end of file diff --git a/LabelStoreMax/lang/hi.json b/LabelStoreMax/lang/hi.json index 60744d5..650edd5 100644 --- a/LabelStoreMax/lang/hi.json +++ b/LabelStoreMax/lang/hi.json @@ -174,5 +174,7 @@ "for": "ke liye", "Buy Product": "utpaad khareeden", "Retry": "pun: prayaas karen", - "Retry later": "baad mein pun: prayaas karen" + "Retry later": "baad mein pun: prayaas karen", + "Light Mode": "lait mod", + "Dark Mode": "daark mod" } \ No newline at end of file diff --git a/LabelStoreMax/lang/it.json b/LabelStoreMax/lang/it.json index 2c228cd..b09ce4a 100644 --- a/LabelStoreMax/lang/it.json +++ b/LabelStoreMax/lang/it.json @@ -174,5 +174,7 @@ "for": "per", "Buy Product": "Acquista prodotto", "Retry": "Riprova", - "Retry later": "Riprova più tardi" + "Retry later": "Riprova più tardi", + "Light Mode": "Modalità luce", + "Dark Mode": "Modalità scura" } \ No newline at end of file diff --git a/LabelStoreMax/lang/pt.json b/LabelStoreMax/lang/pt.json index 3b89b13..097fdc5 100644 --- a/LabelStoreMax/lang/pt.json +++ b/LabelStoreMax/lang/pt.json @@ -174,5 +174,7 @@ "for": "para", "Buy Product": "Comprar Produto", "Retry": "Tentar novamente", - "Retry later": "Tentar mais tarde" + "Retry later": "Tentar mais tarde", + "Light Mode": "Modo de luz", + "Dark Mode": "Modo escuro" } \ No newline at end of file diff --git a/LabelStoreMax/lib/widgets/app_loader.dart b/LabelStoreMax/lib/app/controllers/account_order_detail_controller.dart similarity index 63% rename from LabelStoreMax/lib/widgets/app_loader.dart rename to LabelStoreMax/lib/app/controllers/account_order_detail_controller.dart index d9ccc2d..807c60b 100644 --- a/LabelStoreMax/lib/widgets/app_loader.dart +++ b/LabelStoreMax/lib/app/controllers/account_order_detail_controller.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,10 +8,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'controller.dart'; import 'package:flutter/widgets.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:hexcolor/hexcolor.dart'; -Widget showAppLoader() { - return SpinKitDoubleBounce(color: HexColor("#393318")); +class AccountOrderDetailController extends Controller { + @override + construct(BuildContext context) {} } diff --git a/LabelStoreMax/lib/app/controllers/browse_category_controller.dart b/LabelStoreMax/lib/app/controllers/browse_category_controller.dart new file mode 100644 index 0000000..4ef91d9 --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/browse_category_controller.dart @@ -0,0 +1,17 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'controller.dart'; +import 'package:flutter/widgets.dart'; + +class BrowseCategoryController extends Controller { + @override + construct(BuildContext context) {} +} diff --git a/LabelStoreMax/lib/app/controllers/browse_search_controller.dart b/LabelStoreMax/lib/app/controllers/browse_search_controller.dart new file mode 100644 index 0000000..445338a --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/browse_search_controller.dart @@ -0,0 +1,17 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'controller.dart'; +import 'package:flutter/widgets.dart'; + +class BrowseSearchController extends Controller { + @override + construct(BuildContext context) {} +} diff --git a/LabelStoreMax/lib/app/controllers/checkout_status_controller.dart b/LabelStoreMax/lib/app/controllers/checkout_status_controller.dart new file mode 100644 index 0000000..16e5058 --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/checkout_status_controller.dart @@ -0,0 +1,17 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'controller.dart'; +import 'package:flutter/widgets.dart'; + +class CheckoutStatusController extends Controller { + @override + construct(BuildContext context) {} +} diff --git a/LabelStoreMax/lib/app/controllers/controller.dart b/LabelStoreMax/lib/app/controllers/controller.dart new file mode 100644 index 0000000..7e119a6 --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/controller.dart @@ -0,0 +1,17 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:nylo_framework/controllers/controller.dart'; + +/// Base Controller for the Nylo +/// See more on controllers here - https://nylo.dev/docs/1.x/controllers +class Controller extends BaseController { + Controller(); +} diff --git a/LabelStoreMax/lib/app/controllers/product_detail_controller.dart b/LabelStoreMax/lib/app/controllers/product_detail_controller.dart new file mode 100644 index 0000000..8e2c73c --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/product_detail_controller.dart @@ -0,0 +1,32 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:woosignal/models/response/products.dart'; + +import 'controller.dart'; +import 'package:flutter/widgets.dart'; + +class ProductDetailController extends Controller { + @override + construct(BuildContext context) {} + + viewExternalProduct(Product product) { + if (product.externalUrl != null && product.externalUrl.isNotEmpty) { + openBrowserTab(url: product.externalUrl); + } + } + + viewProductImages(int i, Product product) => + Navigator.pushNamed(context, "/product-images", arguments: { + "index": i, + "images": product.images.map((f) => f.src).toList() + }); +} diff --git a/LabelStoreMax/lib/app/controllers/product_image_viewer_controller.dart b/LabelStoreMax/lib/app/controllers/product_image_viewer_controller.dart new file mode 100644 index 0000000..8837864 --- /dev/null +++ b/LabelStoreMax/lib/app/controllers/product_image_viewer_controller.dart @@ -0,0 +1,17 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'controller.dart'; +import 'package:flutter/widgets.dart'; + +class ProductImageViewerController extends Controller { + @override + construct(BuildContext context) {} +} diff --git a/LabelStoreMax/lib/models/billing_details.dart b/LabelStoreMax/lib/app/models/billing_details.dart similarity index 86% rename from LabelStoreMax/lib/models/billing_details.dart rename to LabelStoreMax/lib/app/models/billing_details.dart index f1d194f..9343593 100644 --- a/LabelStoreMax/lib/models/billing_details.dart +++ b/LabelStoreMax/lib/app/models/billing_details.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,7 +8,7 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:label_storemax/models/customer_address.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; class BillingDetails { CustomerAddress billingAddress; diff --git a/LabelStoreMax/lib/models/cart.dart b/LabelStoreMax/lib/app/models/cart.dart similarity index 70% rename from LabelStoreMax/lib/models/cart.dart rename to LabelStoreMax/lib/app/models/cart.dart index 64094b9..4a8bc86 100644 --- a/LabelStoreMax/lib/models/cart.dart +++ b/LabelStoreMax/lib/app/models/cart.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -11,58 +11,60 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/shipping_type.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/shipping_type.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/response/shipping_method.dart'; import 'package:woosignal/models/response/tax_rate.dart'; -import '../helpers/tools.dart'; - class Cart { - String _keyCart = "CART_SESSION"; - Cart._privateConstructor(); static final Cart getInstance = Cart._privateConstructor(); Future> getCart() async { List cartLineItems = []; - SharedPref sharedPref = SharedPref(); - String currentCartArrJSON = (await sharedPref.read(_keyCart) as String); - if (currentCartArrJSON == null) { - cartLineItems = []; - } else { + String currentCartArrJSON = await NyStorage.read(SharedKey.cart); + + if (currentCartArrJSON != null) { cartLineItems = (jsonDecode(currentCartArrJSON) as List) .map((i) => CartLineItem.fromJson(i)) .toList(); } + return cartLineItems; } - void addToCart({@required CartLineItem cartLineItem}) async { + Future addToCart({@required CartLineItem cartLineItem}) async { List cartLineItems = await getCart(); - if (cartLineItem.variationId != null) { - if (cartLineItems.firstWhere( - (i) => (i.productId == cartLineItem.productId && - i.variationId == cartLineItem.variationId), - orElse: () => null) != - null) { - return; - } - } else { - CartLineItem firstCartItem = cartLineItems.firstWhere( - (i) => i.productId == cartLineItem.productId, - orElse: () => null); - if (firstCartItem != null) { - return; - } + if (cartLineItem.variationId != null && + cartLineItems.firstWhere( + (i) => (i.productId == cartLineItem.productId && + i.variationId == cartLineItem.variationId && + i.variationOptions == cartLineItem.variationOptions), + orElse: () => null) != + null) { + cartLineItems.removeWhere((item) => + item.productId == cartLineItem.productId && + item.variationId == cartLineItem.variationId && + item.variationOptions == cartLineItem.variationOptions); } + + if (cartLineItem.variationId == null && + cartLineItems.firstWhere((i) => i.productId == cartLineItem.productId, + orElse: () => null) != + null) { + cartLineItems + .removeWhere((item) => item.productId == cartLineItem.productId); + } + cartLineItems.add(cartLineItem); - saveCartToPref(cartLineItems: cartLineItems); + await saveCartToPref(cartLineItems: cartLineItems); } Future getTotal({bool withFormat = false}) async { @@ -90,7 +92,7 @@ class Cart { return subtotal.toStringAsFixed(2); } - void updateQuantity( + updateQuantity( {@required CartLineItem cartLineItem, @required int incrementQuantity}) async { List cartLineItems = await getCart(); @@ -104,7 +106,7 @@ class Cart { } tmpCartItem.add(cartItem); }); - saveCartToPref(cartLineItems: tmpCartItem); + await saveCartToPref(cartLineItems: tmpCartItem); } Future cartShortDesc() async { @@ -116,25 +118,17 @@ class Cart { .join(","); } - void removeCartItemForIndex({@required int index}) async { + removeCartItemForIndex({@required int index}) async { List cartLineItems = await getCart(); cartLineItems.removeAt(index); - saveCartToPref(cartLineItems: cartLineItems); + await saveCartToPref(cartLineItems: cartLineItems); } - void clear() { - SharedPref sharedPref = SharedPref(); - List cartLineItems = []; - String jsonArrCartItems = - jsonEncode(cartLineItems.map((i) => i.toJson()).toList()); - sharedPref.save(_keyCart, jsonArrCartItems); - } + clear() async => NyStorage.delete(SharedKey.cart); - void saveCartToPref({@required List cartLineItems}) { - SharedPref sharedPref = SharedPref(); - String jsonArrCartItems = - jsonEncode(cartLineItems.map((i) => i.toJson()).toList()); - sharedPref.save(_keyCart, jsonArrCartItems); + saveCartToPref({@required List cartLineItems}) async { + String json = jsonEncode(cartLineItems.map((i) => i.toJson()).toList()); + await NyStorage.store(SharedKey.cart, json); } Future taxAmount(TaxRate taxRate) async { diff --git a/LabelStoreMax/lib/models/cart_line_item.dart b/LabelStoreMax/lib/app/models/cart_line_item.dart similarity index 97% rename from LabelStoreMax/lib/models/cart_line_item.dart rename to LabelStoreMax/lib/app/models/cart_line_item.dart index e99d8b7..8dae380 100644 --- a/LabelStoreMax/lib/models/cart_line_item.dart +++ b/LabelStoreMax/lib/app/models/cart_line_item.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,7 +8,7 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:label_storemax/helpers/tools.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; class CartLineItem { String name; diff --git a/LabelStoreMax/lib/models/checkout_session.dart b/LabelStoreMax/lib/app/models/checkout_session.dart similarity index 68% rename from LabelStoreMax/lib/models/checkout_session.dart rename to LabelStoreMax/lib/app/models/checkout_session.dart index 5c7ef2f..fa405a6 100644 --- a/LabelStoreMax/lib/models/checkout_session.dart +++ b/LabelStoreMax/lib/app/models/checkout_session.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,20 +9,17 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'dart:convert'; - -import 'package:label_storemax/helpers/shared_pref.dart'; -import 'package:label_storemax/models/billing_details.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/customer_address.dart'; -import 'package:label_storemax/models/payment_type.dart'; -import 'package:label_storemax/models/shipping_type.dart'; +import 'package:flutter_app/app/models/billing_details.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; +import 'package:flutter_app/app/models/payment_type.dart'; +import 'package:flutter_app/app/models/shipping_type.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/response/tax_rate.dart'; -import '../helpers/tools.dart'; - class CheckoutSession { - String sfKeyBillingCheckout = "CS_BILLING_DETAILS"; - String sfKeyShippingCheckout = "CS_SHIPPING_DETAILS"; bool shipToDifferentAddress = false; CheckoutSession._privateConstructor(); @@ -44,8 +41,7 @@ class CheckoutSession { paymentType = null; } - void saveBillingAddress() { - SharedPref sharedPref = SharedPref(); + void saveBillingAddress() async { CustomerAddress customerAddress = CheckoutSession.getInstance.billingDetails.billingAddress; @@ -54,13 +50,12 @@ class CheckoutSession { } String billingAddress = jsonEncode(customerAddress.toJson()); - sharedPref.save(sfKeyBillingCheckout, billingAddress); + await NyStorage.store(SharedKey.customerBillingDetails, billingAddress); } Future getBillingAddress() async { - SharedPref sharedPref = SharedPref(); - - String strCheckoutDetails = await sharedPref.read(sfKeyBillingCheckout); + String strCheckoutDetails = + await NyStorage.read(SharedKey.customerBillingDetails); if (strCheckoutDetails != null && strCheckoutDetails != "") { return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails)); @@ -68,37 +63,30 @@ class CheckoutSession { return null; } - void clearBillingAddress() { - SharedPref sharedPref = SharedPref(); - sharedPref.remove(sfKeyBillingCheckout); - } + void clearBillingAddress() async => + await NyStorage.delete(SharedKey.customerBillingDetails); - void saveShippingAddress() { - SharedPref sharedPref = SharedPref(); + saveShippingAddress() async { CustomerAddress customerAddress = CheckoutSession.getInstance.billingDetails.shippingAddress; - if (customerAddress == null) { return; } - String shippingAddress = jsonEncode(customerAddress.toJson()); - sharedPref.save(sfKeyShippingCheckout, shippingAddress); + await NyStorage.store(SharedKey.customerShippingDetails, shippingAddress); } Future getShippingAddress() async { - SharedPref sharedPref = SharedPref(); - String strCheckoutDetails = await sharedPref.read(sfKeyShippingCheckout); + String strCheckoutDetails = + await NyStorage.read(SharedKey.customerShippingDetails); if (strCheckoutDetails != null && strCheckoutDetails != "") { return CustomerAddress.fromJson(jsonDecode(strCheckoutDetails)); } return null; } - void clearShippingAddress() { - SharedPref sharedPref = SharedPref(); - sharedPref.remove(sfKeyShippingCheckout); - } + void clearShippingAddress() async => + NyStorage.delete(SharedKey.customerShippingDetails); Future total({bool withFormat = false, TaxRate taxRate}) async { double totalCart = parseWcPrice(await Cart.getInstance.getTotal()); diff --git a/LabelStoreMax/lib/models/customer_address.dart b/LabelStoreMax/lib/app/models/customer_address.dart similarity index 97% rename from LabelStoreMax/lib/models/customer_address.dart rename to LabelStoreMax/lib/app/models/customer_address.dart index b5b11d0..19f5c9f 100644 --- a/LabelStoreMax/lib/models/customer_address.dart +++ b/LabelStoreMax/lib/app/models/customer_address.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,7 +8,7 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:label_storemax/models/customer_country.dart'; +import 'package:flutter_app/app/models/customer_country.dart'; class CustomerAddress { String firstName; diff --git a/LabelStoreMax/lib/models/customer_country.dart b/LabelStoreMax/lib/app/models/customer_country.dart similarity index 94% rename from LabelStoreMax/lib/models/customer_country.dart rename to LabelStoreMax/lib/app/models/customer_country.dart index 8e8a786..2bf5c64 100644 --- a/LabelStoreMax/lib/models/customer_country.dart +++ b/LabelStoreMax/lib/app/models/customer_country.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,7 +8,7 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -import 'package:label_storemax/models/default_shipping.dart'; +import 'package:flutter_app/app/models/default_shipping.dart'; class CustomerCountry { String countryCode; diff --git a/LabelStoreMax/lib/models/default_shipping.dart b/LabelStoreMax/lib/app/models/default_shipping.dart similarity index 98% rename from LabelStoreMax/lib/models/default_shipping.dart rename to LabelStoreMax/lib/app/models/default_shipping.dart index 2bb965e..6f3c9af 100644 --- a/LabelStoreMax/lib/models/default_shipping.dart +++ b/LabelStoreMax/lib/app/models/default_shipping.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. diff --git a/LabelStoreMax/lib/models/payment_type.dart b/LabelStoreMax/lib/app/models/payment_type.dart similarity index 96% rename from LabelStoreMax/lib/models/payment_type.dart rename to LabelStoreMax/lib/app/models/payment_type.dart index 2ad9113..d78654e 100644 --- a/LabelStoreMax/lib/models/payment_type.dart +++ b/LabelStoreMax/lib/app/models/payment_type.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. diff --git a/LabelStoreMax/lib/models/shipping_type.dart b/LabelStoreMax/lib/app/models/shipping_type.dart similarity index 97% rename from LabelStoreMax/lib/models/shipping_type.dart rename to LabelStoreMax/lib/app/models/shipping_type.dart index b23b7dd..6aa3b21 100644 --- a/LabelStoreMax/lib/models/shipping_type.dart +++ b/LabelStoreMax/lib/app/models/shipping_type.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,10 +9,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/cupertino.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; import 'package:woosignal/models/response/shipping_method.dart'; -import '../helpers/tools.dart'; - class ShippingType { String methodId; String cost; diff --git a/LabelStoreMax/lib/app/models/user.dart b/LabelStoreMax/lib/app/models/user.dart new file mode 100644 index 0000000..7e57ed1 --- /dev/null +++ b/LabelStoreMax/lib/app/models/user.dart @@ -0,0 +1,28 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:nylo_framework/helpers/helper.dart'; + +class User extends Storable { + String userId; + String token; + + User(); + User.fromUserAuthResponse({this.userId, this.token}); + + @override + toStorage() => {"token": this.token, "user_id": this.userId}; + + @override + fromStorage(dynamic data) { + this.token = data['token']; + this.userId = data['user_id']; + } +} diff --git a/LabelStoreMax/lib/app/networking/api_service.dart b/LabelStoreMax/lib/app/networking/api_service.dart new file mode 100644 index 0000000..fceeabf --- /dev/null +++ b/LabelStoreMax/lib/app/networking/api_service.dart @@ -0,0 +1,13 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:nylo_framework/networking/base_networking.dart'; + +class ApiService extends BaseApi {} diff --git a/LabelStoreMax/lib/providers/cash_on_delivery.dart b/LabelStoreMax/lib/app/providers/cash_on_delivery.dart similarity index 83% rename from LabelStoreMax/lib/providers/cash_on_delivery.dart rename to LabelStoreMax/lib/app/providers/cash_on_delivery.dart index 26c0d95..2e68c98 100644 --- a/LabelStoreMax/lib/providers/cash_on_delivery.dart +++ b/LabelStoreMax/lib/app/providers/cash_on_delivery.dart @@ -1,6 +1,6 @@ // // LabelCore -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -12,9 +12,10 @@ // import 'package:flutter/widgets.dart'; -import 'package:label_storemax/helpers/data/order_wc.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/pages/checkout_confirmation.dart'; +import 'package:flutter_app/bootstrap/data/order_wc.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/pages/checkout_confirmation.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/payload/order_wc.dart'; import 'package:woosignal/models/response/order.dart'; import 'package:woosignal/models/response/tax_rate.dart'; @@ -37,7 +38,7 @@ cashOnDeliveryPay(context, ); state.reloadState(showLoader: false); } - } catch (ex) { + } catch (_) { showEdgeAlertWith( context, title: trans(context, "Error"), diff --git a/LabelStoreMax/lib/providers/example_pay.dart b/LabelStoreMax/lib/app/providers/example_pay.dart similarity index 86% rename from LabelStoreMax/lib/providers/example_pay.dart rename to LabelStoreMax/lib/app/providers/example_pay.dart index 5914651..f798442 100644 --- a/LabelStoreMax/lib/providers/example_pay.dart +++ b/LabelStoreMax/lib/app/providers/example_pay.dart @@ -1,6 +1,6 @@ // // LabelCore -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -12,10 +12,10 @@ // import 'package:flutter/widgets.dart'; -import 'package:label_storemax/helpers/data/order_wc.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/pages/checkout_confirmation.dart'; +import 'package:flutter_app/bootstrap/data/order_wc.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/pages/checkout_confirmation.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/payload/order_wc.dart'; import 'package:woosignal/models/response/order.dart'; import 'package:woosignal/models/response/tax_rate.dart'; diff --git a/LabelStoreMax/lib/providers/razor_pay.dart b/LabelStoreMax/lib/app/providers/razor_pay.dart similarity index 88% rename from LabelStoreMax/lib/providers/razor_pay.dart rename to LabelStoreMax/lib/app/providers/razor_pay.dart index 5c4bf36..b81fc33 100644 --- a/LabelStoreMax/lib/providers/razor_pay.dart +++ b/LabelStoreMax/lib/app/providers/razor_pay.dart @@ -1,6 +1,6 @@ // // LabelCore -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -12,11 +12,11 @@ // import 'package:flutter/widgets.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/data/order_wc.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/labelconfig.dart'; -import 'package:label_storemax/pages/checkout_confirmation.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/data/order_wc.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/pages/checkout_confirmation.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:razorpay_flutter/razorpay_flutter.dart'; import 'package:woosignal/models/response/tax_rate.dart'; import 'package:woosignal/models/payload/order_wc.dart'; @@ -70,7 +70,7 @@ razorPay(context, // CHECKOUT HELPER await checkout(taxRate, (total, billingDetails, cart) async { var options = { - 'key': app_razor_id, + 'key': getEnv('RAZORPAY_ID'), 'amount': (parseWcPrice(total) * 100).toInt(), 'name': AppHelper.instance.appConfig.appName, 'description': await cart.cartShortDesc(), diff --git a/LabelStoreMax/lib/providers/stripe_pay.dart b/LabelStoreMax/lib/app/providers/stripe_pay.dart similarity index 81% rename from LabelStoreMax/lib/providers/stripe_pay.dart rename to LabelStoreMax/lib/app/providers/stripe_pay.dart index 87b3bc8..afba431 100644 --- a/LabelStoreMax/lib/providers/stripe_pay.dart +++ b/LabelStoreMax/lib/app/providers/stripe_pay.dart @@ -1,6 +1,6 @@ // // LabelCore -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -13,23 +13,31 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/data/order_wc.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/labelconfig.dart'; -import 'package:label_storemax/pages/checkout_confirmation.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/data/order_wc.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/pages/checkout_confirmation.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/payload/order_wc.dart'; import 'package:woosignal/models/response/order.dart'; import 'package:woosignal/models/response/tax_rate.dart'; +import 'package:woosignal/models/response/woosignal_app.dart'; import 'package:woosignal_stripe/woosignal_stripe.dart'; stripePay(context, {@required CheckoutConfirmationPageState state, TaxRate taxRate}) async { try { + WooSignalApp wooSignalApp = AppHelper.instance.appConfig; + bool liveMode = getEnv('STRIPE_LIVE_MODE') == null + ? wooSignalApp.stripeLiveMode + : getEnv('STRIPE_LIVE_MODE', defaultValue: false); + // CONFIGURE STRIPE FlutterStripePayment.setStripeSettings( - stripeAccount: app_stripe_account, liveMode: app_stripe_live_mode); + stripeAccount: getEnv('STRIPE_ACCOUNT'), liveMode: liveMode); - var paymentResponse = await FlutterStripePayment.addPaymentMethod(); + PaymentResponse paymentResponse = + await FlutterStripePayment.addPaymentMethod(); // CHECK STATUS FROM STRIPE if (paymentResponse.status == PaymentResponseStatus.succeeded) { @@ -90,8 +98,8 @@ stripePay(context, state.reloadState(showLoader: false); } } else if (intentResponse.status == PaymentResponseStatus.failed) { - if (app_debug) { - print(intentResponse.errorMessage); + if (getEnv('APP_DEBUG', defaultValue: true)) { + NyLogger.error(intentResponse.errorMessage); } showEdgeAlertWith( context, diff --git a/LabelStoreMax/lib/app_payment_methods.dart b/LabelStoreMax/lib/app_payment_methods.dart deleted file mode 100644 index 44b584d..0000000 --- a/LabelStoreMax/lib/app_payment_methods.dart +++ /dev/null @@ -1,61 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/payment_type.dart'; -import 'package:label_storemax/providers/cash_on_delivery.dart'; -import 'package:label_storemax/providers/razor_pay.dart'; -import 'package:label_storemax/providers/stripe_pay.dart'; - -// Payment methods available for uses in the app - -List arrPaymentMethods = [ - addPayment( - PaymentType( - id: 1, - name: "Stripe", - desc: "Debit or Credit Card", - assetImage: "dark_powered_by_stripe.png", - pay: stripePay, - ), - ), - - addPayment( - PaymentType( - id: 2, - name: "CashOnDelivery", - desc: "Cash on delivery", - assetImage: "cash_on_delivery.jpeg", - pay: cashOnDeliveryPay, - ), - ), - - addPayment( - PaymentType( - id: 3, - name: "RazorPay", - desc: "Debit or Credit Card", - assetImage: "razorpay.png", - pay: razorPay, - ), - ), - - // e.g. add more here - -// addPayment( -// PaymentType( -// id: 4, -// name: "MyNewPaymentMethod", -// desc: "Debit or Credit Card", -// assetImage: "add icon image to assets/images/myimage.png", -// pay: myCustomPaymentFunction -// ), -// ), -].where((e) => e != null).toList(); diff --git a/LabelStoreMax/lib/bootstrap/app.dart b/LabelStoreMax/lib/bootstrap/app.dart new file mode 100644 index 0000000..b434f60 --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/app.dart @@ -0,0 +1,118 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:adaptive_theme/adaptive_theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:nylo_framework/localization/app_localization.dart'; + +// ignore: must_be_immutable +class AppBuild extends StatelessWidget { + final String initialRoute; + Brightness defaultBrightness; + ThemeData themeData; + ThemeData darkTheme; + Locale locale; + String title; + bool debugShowCheckedModeBanner; + bool debugShowMaterialGrid; + bool showPerformanceOverlay; + bool checkerboardRasterCacheImages; + bool checkerboardOffscreenLayers; + bool showSemanticsDebugger; + Map shortcuts; + Map> actions; + List supportedLocales; + ThemeMode themeMode; + Color color; + GenerateAppTitle onGenerateTitle; + TransitionBuilder builder; + List navigatorObservers; + RouteFactory onUnknownRoute; + InitialRouteListFactory onGenerateInitialRoutes; + GlobalKey navigatorKey; + + final Route Function(RouteSettings settings) onGenerateRoute; + + AppBuild({ + Key key, + this.initialRoute, + this.title, + this.defaultBrightness, + this.locale, + this.themeData, + this.onGenerateRoute, + this.navigatorKey, + this.onGenerateInitialRoutes, + this.onUnknownRoute, + this.navigatorObservers = const [], + this.builder, + this.onGenerateTitle, + this.color, + this.darkTheme, + this.themeMode = ThemeMode.system, + this.supportedLocales = const [Locale('en', 'US')], + this.debugShowMaterialGrid = false, + this.showPerformanceOverlay = false, + this.checkerboardRasterCacheImages = false, + this.checkerboardOffscreenLayers = false, + this.showSemanticsDebugger = false, + this.debugShowCheckedModeBanner = true, + this.shortcuts, + this.actions, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return AdaptiveTheme( + light: themeData, + dark: darkTheme, + initial: AdaptiveThemeMode.light, + builder: (theme, darkTheme) => ValueListenableBuilder( + valueListenable: ValueNotifier(locale), + builder: (context, Locale locale, _) => MaterialApp( + navigatorKey: navigatorKey, + themeMode: themeMode, + onGenerateTitle: onGenerateTitle, + onGenerateInitialRoutes: onGenerateInitialRoutes, + onUnknownRoute: onUnknownRoute, + builder: builder, + navigatorObservers: navigatorObservers, + color: color, + supportedLocales: supportedLocales, + debugShowMaterialGrid: debugShowMaterialGrid, + showPerformanceOverlay: showPerformanceOverlay, + checkerboardRasterCacheImages: checkerboardRasterCacheImages, + checkerboardOffscreenLayers: checkerboardOffscreenLayers, + showSemanticsDebugger: showSemanticsDebugger, + debugShowCheckedModeBanner: debugShowCheckedModeBanner, + shortcuts: shortcuts, + actions: actions, + title: title ?? "", + darkTheme: darkTheme, + initialRoute: initialRoute, + onGenerateRoute: this.onGenerateRoute, + locale: locale, + theme: theme, + localizationsDelegates: [ + AppLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalMaterialLocalizations.delegate + ], + localeResolutionCallback: + (Locale locale, Iterable supportedLocales) { + return locale; + }, + ), + ), + ); + } +} diff --git a/LabelStoreMax/lib/bootstrap/app_helper.dart b/LabelStoreMax/lib/bootstrap/app_helper.dart new file mode 100644 index 0000000..1486c10 --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/app_helper.dart @@ -0,0 +1,19 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:woosignal/models/response/woosignal_app.dart'; + +class AppHelper { + AppHelper._privateConstructor(); + + static final AppHelper instance = AppHelper._privateConstructor(); + + WooSignalApp appConfig; +} diff --git a/LabelStoreMax/lib/helpers/data/order_wc.dart b/LabelStoreMax/lib/bootstrap/data/order_wc.dart similarity index 90% rename from LabelStoreMax/lib/helpers/data/order_wc.dart rename to LabelStoreMax/lib/bootstrap/data/order_wc.dart index c4e328d..eefca73 100644 --- a/LabelStoreMax/lib/helpers/data/order_wc.dart +++ b/LabelStoreMax/lib/bootstrap/data/order_wc.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -10,13 +10,13 @@ import 'dart:io'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/billing_details.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; +import 'package:flutter_app/app/models/billing_details.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; import 'package:woosignal/models/payload/order_wc.dart'; import 'package:woosignal/models/response/tax_rate.dart'; import 'package:woosignal/models/response/woosignal_app.dart'; diff --git a/LabelStoreMax/lib/helpers/enums/sort_enums.dart b/LabelStoreMax/lib/bootstrap/enums/sort_enums.dart similarity index 95% rename from LabelStoreMax/lib/helpers/enums/sort_enums.dart rename to LabelStoreMax/lib/bootstrap/enums/sort_enums.dart index 26a9a00..49f63ef 100644 --- a/LabelStoreMax/lib/helpers/enums/sort_enums.dart +++ b/LabelStoreMax/lib/bootstrap/enums/sort_enums.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. diff --git a/LabelStoreMax/lib/helpers/tools.dart b/LabelStoreMax/lib/bootstrap/helpers.dart similarity index 88% rename from LabelStoreMax/lib/helpers/tools.dart rename to LabelStoreMax/lib/bootstrap/helpers.dart index 152a624..3723ab2 100644 --- a/LabelStoreMax/lib/helpers/tools.dart +++ b/LabelStoreMax/lib/bootstrap/helpers.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,28 +9,28 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'dart:convert'; -import 'dart:developer'; - import 'package:flutter/cupertino.dart'; +import 'package:flutter_app/app/models/billing_details.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/default_shipping.dart'; +import 'package:flutter_app/app/models/payment_type.dart'; +import 'package:flutter_app/app/models/user.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:flutter_app/config/app_payment_gateways.dart'; +import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:intl/intl.dart'; -import 'package:label_storemax/app_payment_methods.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/app_localizations.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/labelconfig.dart'; import 'package:edge_alert/edge_alert.dart'; -import 'package:label_storemax/models/billing_details.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/default_shipping.dart'; -import 'package:label_storemax/models/payment_type.dart'; import 'package:html/parser.dart'; import 'package:flutter_web_browser/flutter_web_browser.dart'; import 'package:flutter_money_formatter/flutter_money_formatter.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; import 'package:math_expressions/math_expressions.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:platform_alert_dialog/platform_alert_dialog.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:status_alert/status_alert.dart'; @@ -38,18 +38,35 @@ import 'package:woosignal/models/response/products.dart'; import 'package:woosignal/models/response/tax_rate.dart'; import 'package:woosignal/woosignal.dart'; +Future getUser() async => + (await NyStorage.read(SharedKey.authUser, model: User())); + appWooSignal(Function(WooSignal) api) async { - WooSignal wooSignal = await WooSignal.getInstance( - config: {"appKey": app_key, "debugMode": app_debug}); + WooSignal wooSignal = await WooSignal.getInstance(config: { + "appKey": getEnv('APP_KEY'), + "debugMode": getEnv('APP_DEBUG', defaultValue: true) + }); return await api(wooSignal); } List getPaymentTypes() => - arrPaymentMethods.where((v) => v != null).toList(); + paymentTypeList.where((v) => v != null).toList(); -PaymentType addPayment(PaymentType paymentType) { - return app_payment_methods.contains(paymentType.name) ? paymentType : null; -} +PaymentType addPayment( + {@required int id, + @required String name, + @required String desc, + @required String assetImage, + @required Function pay}) => + app_payment_gateways.contains(name) + ? PaymentType( + id: id, + name: name, + desc: desc, + assetImage: assetImage, + pay: pay, + ) + : null; showStatusAlert(context, {@required String title, String subtitle, IconData icon, int duration}) { @@ -63,10 +80,10 @@ showStatusAlert(context, } class EdgeAlertStyle { - static final int SUCCESS = 1; - static final int WARNING = 2; - static final int INFO = 3; - static final int DANGER = 4; + static const int SUCCESS = 1; + static const int WARNING = 2; + static const int INFO = 3; + static const int DANGER = 4; } void showEdgeAlertWith(context, @@ -164,13 +181,7 @@ openBrowserTab({@required String url}) async { customTabsOptions: CustomTabsOptions(toolbarColor: Colors.white70)); } -EdgeInsets safeAreaDefault() { - return EdgeInsets.only(left: 16, right: 16, bottom: 8); -} - -String trans(BuildContext context, String key) { - return AppLocalizations.of(context).trans(key); -} +EdgeInsets safeAreaDefault() => EdgeInsets.only(left: 16, right: 16, bottom: 8); bool isNumeric(String str) { if (str == null) { @@ -465,11 +476,10 @@ String formatForDateTime(FormatType formatType) { } } -String capitalize(String s) => s[0].toUpperCase() + s.substring(1); - double parseWcPrice(String price) => (double.tryParse(price) ?? 0); -void appLogOutput(dynamic message) => (app_debug == true ? log(message) : null); +void appLogOutput(dynamic message) => + (getEnv('APP_DEBUG', defaultValue: true) ? NyLogger.debug(message) : null); Widget refreshableScroll(context, {@required refreshController, @@ -522,23 +532,10 @@ Widget refreshableScroll(context, mainAxisSpacing: 4.0, crossAxisSpacing: 4.0, ) - : NoProductResults()), + : NoResultsForProductsWidget()), ); } -double calAspectRatio(BuildContext context) { - if (MediaQuery.of(context).size.height > 800) { - return MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 1.65); - } - if (MediaQuery.of(context).size.height > 700) { - return MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 1.35); - } - return MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 1.3); -} - class UserAuth { UserAuth._privateConstructor(); static final UserAuth instance = UserAuth._privateConstructor(); @@ -548,7 +545,7 @@ class UserAuth { Future> getDefaultShipping(BuildContext context) async { String data = await DefaultAssetBundle.of(context) - .loadString("assets/default_shipping.json"); + .loadString("public/assets/json/default_shipping.json"); dynamic dataJson = json.decode(data); List shipping = []; diff --git a/LabelStoreMax/lib/bootstrap/shared_pref/shared_key.dart b/LabelStoreMax/lib/bootstrap/shared_pref/shared_key.dart new file mode 100644 index 0000000..f4d923e --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/shared_pref/shared_key.dart @@ -0,0 +1,16 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +class SharedKey { + static const String authUser = "DEFAULT_SP_USER"; + static const String cart = "CART_SESSION"; + static const String customerBillingDetails = "CS_BILLING_DETAILS"; + static const String customerShippingDetails = "CS_SHIPPING_DETAILS"; +} diff --git a/LabelStoreMax/lib/bootstrap/shared_pref/sp_auth.dart b/LabelStoreMax/lib/bootstrap/shared_pref/sp_auth.dart new file mode 100644 index 0000000..ac48146 --- /dev/null +++ b/LabelStoreMax/lib/bootstrap/shared_pref/sp_auth.dart @@ -0,0 +1,27 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/cupertino.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:nylo_framework/helpers/helper.dart'; + +Future authCheck() async => ((await getUser()) != null); + +Future readAuthToken() async => (await getUser()).token; + +Future readUserId() async => (await getUser()).userId; + +authLogout(BuildContext context) async { + await NyStorage.delete(SharedKey.authUser); + Cart.getInstance.clear(); + navigatorPush(context, routeName: "/home", forgetAll: true); +} diff --git a/LabelStoreMax/lib/config/app_locale.dart b/LabelStoreMax/lib/config/app_locale.dart new file mode 100644 index 0000000..df8fed6 --- /dev/null +++ b/LabelStoreMax/lib/config/app_locale.dart @@ -0,0 +1,23 @@ +import 'package:flutter/cupertino.dart'; + +/* +|-------------------------------------------------------------------------- +| APP LOCALE +| +| Configure the language by setting the locale. +| +| e.g. Change app_locale = Locale('es'); for Spanish. +| You can only use one of the supported locales below in app_locales_supported. +|-------------------------------------------------------------------------- +*/ + +const Locale app_locale = Locale('en'); + +const List app_locales_supported = [ + Locale('en'), + Locale('es'), + Locale('fr'), + Locale('hi'), + Locale('it'), + Locale('pt'), +]; diff --git a/LabelStoreMax/lib/config/app_payment_gateways.dart b/LabelStoreMax/lib/config/app_payment_gateways.dart new file mode 100644 index 0000000..dcfb5d6 --- /dev/null +++ b/LabelStoreMax/lib/config/app_payment_gateways.dart @@ -0,0 +1,54 @@ +import 'package:flutter_app/app/models/payment_type.dart'; +import 'package:flutter_app/app/providers/cash_on_delivery.dart'; +import 'package:flutter_app/app/providers/razor_pay.dart'; +import 'package:flutter_app/app/providers/stripe_pay.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; + +/* +|-------------------------------------------------------------------------- +| PAYMENT GATEWAYS +| +| Configure which payment gateways you want to use. +| Docs here: https://woosignal.com/docs/app/ios/label-storemax +|-------------------------------------------------------------------------- +*/ + +const app_payment_gateways = ["Stripe"]; +// Available: "Stripe", "CashOnDelivery", "RazorPay" +// e.g. app_payment_gateways = ["Stripe", "CashOnDelivery"]; will only use Stripe and Cash on Delivery. + +List paymentTypeList = [ + addPayment( + id: 1, + name: "Stripe", + desc: "Debit or Credit Card", + assetImage: "dark_powered_by_stripe.png", + pay: stripePay, + ), + + addPayment( + id: 2, + name: "CashOnDelivery", + desc: "Cash on delivery", + assetImage: "cash_on_delivery.jpeg", + pay: cashOnDeliveryPay, + ), + + addPayment( + id: 3, + name: "RazorPay", + desc: "Debit or Credit Card", + assetImage: "razorpay.png", + pay: razorPay, + ), + + // e.g. add more here + + // addPayment( + // id: 4, + // name: "MyNewPaymentMethod", + // desc: "Debit or Credit Card", + // assetImage: "add icon image to public/assets/images/myimage.png", + // pay: "myCustomPaymentFunction", + // ), +]; diff --git a/LabelStoreMax/lib/config/app_theme.dart b/LabelStoreMax/lib/config/app_theme.dart new file mode 100644 index 0000000..7341c78 --- /dev/null +++ b/LabelStoreMax/lib/config/app_theme.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +/* +|-------------------------------------------------------------------------- +| APP THEME +| +| Change the font and colors for your themes. +|-------------------------------------------------------------------------- +*/ + +// Theme main font +final TextStyle appThemeFont = GoogleFonts.overpass(); + +// Theme colors +class AppColors { + // MAIN + Color _mainLightColor = Color(0xFF232c33); + Color _mainDarkColor = Color(0xFFFAFAFA); + + // SECONDARY + Color _secondLightColor = Color(0xFF232c33); + Color _secondDarkColor = Color(0xFFF1F1F1); + + // ACCENT + Color _accentLightColor = Color(0xFF465f81); + Color _accentDarkColor = Color(0xFF4a4a4a); + + // SCAFFOLD + Color _scaffoldDarkColor = Color(0xFF2C2C2C); + Color _scaffoldLightColor = Color(0xFFFAFAFA); +} + +class AppTheme extends AppColors { + Color mainColor( + {double opacity = 1, Brightness brightness = Brightness.light}) { + return (brightness == Brightness.light + ? _mainLightColor.withOpacity(opacity) + : _mainDarkColor.withOpacity(opacity)); + } + + Color secondColor( + {double opacity = 1, Brightness brightness = Brightness.light}) { + return (brightness == Brightness.light + ? _secondLightColor.withOpacity(opacity) + : _secondDarkColor.withOpacity(opacity)); + } + + Color accentColor( + {double opacity = 1, Brightness brightness = Brightness.light}) { + return (brightness == Brightness.light + ? _accentLightColor.withOpacity(opacity) + : _accentDarkColor.withOpacity(opacity)); + } + + Color scaffoldColor( + {double opacity = 1, Brightness brightness = Brightness.light}) { + return (brightness == Brightness.light + ? _scaffoldLightColor.withOpacity(opacity) + : _scaffoldDarkColor.withOpacity(opacity)); + } +} diff --git a/LabelStoreMax/lib/generated_plugin_registrant.dart b/LabelStoreMax/lib/generated_plugin_registrant.dart deleted file mode 100644 index fb854d7..0000000 --- a/LabelStoreMax/lib/generated_plugin_registrant.dart +++ /dev/null @@ -1,17 +0,0 @@ -// -// Generated file. Do not edit. -// - -// ignore_for_file: lines_longer_than_80_chars - -import 'package:shared_preferences_web/shared_preferences_web.dart'; -import 'package:url_launcher_web/url_launcher_web.dart'; - -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -// ignore: public_member_api_docs -void registerPlugins(Registrar registrar) { - SharedPreferencesPlugin.registerWith(registrar); - UrlLauncherPlugin.registerWith(registrar); - registrar.registerMessageHandler(); -} diff --git a/LabelStoreMax/lib/helpers/app_helper.dart b/LabelStoreMax/lib/helpers/app_helper.dart deleted file mode 100644 index 9547844..0000000 --- a/LabelStoreMax/lib/helpers/app_helper.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:woosignal/models/response/woosignal_app.dart'; - -class AppHelper { - AppHelper._privateConstructor(); - - static final AppHelper instance = AppHelper._privateConstructor(); - - WooSignalApp appConfig; -} diff --git a/LabelStoreMax/lib/helpers/app_localizations.dart b/LabelStoreMax/lib/helpers/app_localizations.dart deleted file mode 100644 index 05a865c..0000000 --- a/LabelStoreMax/lib/helpers/app_localizations.dart +++ /dev/null @@ -1,64 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'dart:async'; -import 'dart:convert'; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -import '../labelconfig.dart'; - -class AppLocalizations { - final Locale locale; - - AppLocalizations(this.locale); - - static AppLocalizations of(BuildContext context) { - return Localizations.of(context, AppLocalizations); - } - - static const LocalizationsDelegate delegate = - _AppLocalizationsDelegate(); - - Map _localizedStrings; - - Future load() async { - String jsonString = - await rootBundle.loadString('lang/${locale.languageCode}.json'); - Map jsonMap = json.decode(jsonString); - - _localizedStrings = jsonMap.map((k, v) { - return MapEntry(k, v.toString()); - }); - } - - String trans(String key) => _localizedStrings[key]; -} - -class _AppLocalizationsDelegate - extends LocalizationsDelegate { - const _AppLocalizationsDelegate(); - - @override - bool isSupported(Locale locale) => app_locales_supported - .map((e) => e.languageCode) - .toList() - .contains(locale.languageCode); - - @override - bool shouldReload(_AppLocalizationsDelegate old) => false; - - Future load(Locale locale) async { - AppLocalizations localizations = new AppLocalizations(locale); - await localizations.load(); - return localizations; - } -} diff --git a/LabelStoreMax/lib/helpers/app_themes.dart b/LabelStoreMax/lib/helpers/app_themes.dart deleted file mode 100644 index 8e5477f..0000000 --- a/LabelStoreMax/lib/helpers/app_themes.dart +++ /dev/null @@ -1,168 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; - -TextTheme textThemeAccent() { - return TextTheme( - headline4: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w800, - fontSize: 26), - headline3: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline2: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline1: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline5: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline6: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - ), - subtitle1: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w800), - bodyText1: new TextStyle( - color: HexColor("#606060"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700), - bodyText2: new TextStyle( - color: HexColor("#a8a8a8"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700, - fontSize: 18), - caption: new TextStyle( - color: HexColor("#2a5080"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700, - fontSize: 14), - button: new TextStyle( - color: Colors.white, - fontFamily: appFontFamily, - fontWeight: FontWeight.w700), - ); -} - -TextTheme textThemePrimary() { - return TextTheme( - headline4: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w800, - fontSize: 26), - headline3: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline2: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline1: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - headline5: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline6: new TextStyle( - color: Colors.black87, - fontFamily: appFontFamily, - fontWeight: FontWeight.w600), - subtitle1: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w800), - bodyText1: new TextStyle( - color: HexColor("#606060"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700), - bodyText2: new TextStyle( - color: HexColor("#a8a8a8"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700, - fontSize: 18), - caption: new TextStyle( - color: HexColor("#2a5080"), - fontFamily: appFontFamily, - fontWeight: FontWeight.w700, - fontSize: 14), - button: new TextStyle( - color: Colors.white, - fontFamily: appFontFamily, - fontWeight: FontWeight.w700), - ); -} - -TextTheme textThemeMain() { - return TextTheme( - headline4: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - ), - headline3: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline2: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline5: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline6: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - subtitle1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - bodyText1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - bodyText2: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - caption: new TextStyle( - color: Colors.redAccent, fontSize: 16, fontFamily: appFontFamily), - button: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - ); -} - -TextTheme textThemeAppBar() { - return TextTheme( - headline4: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline3: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline2: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline5: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - headline6: new TextStyle( - color: Colors.black, - fontFamily: appFontFamily, - fontWeight: FontWeight.w900), - subtitle1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - bodyText1: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - bodyText2: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - caption: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - button: new TextStyle(color: Colors.black, fontFamily: appFontFamily), - ); -} - -ColorScheme colorSchemeButton() { - return ColorScheme.light( - primary: const Color(0xff6200ee), - primaryVariant: const Color(0xff3700b3), - secondary: const Color(0xff03dac6), - secondaryVariant: const Color(0xff018786), - surface: Colors.white, - background: Colors.white, - error: const Color(0xffb00020), - onPrimary: Colors.white, - onSecondary: Colors.black, - onSurface: Colors.black, - onBackground: Colors.black, - onError: Colors.white, - brightness: Brightness.light, - ); -} diff --git a/LabelStoreMax/lib/helpers/shared_pref.dart b/LabelStoreMax/lib/helpers/shared_pref.dart deleted file mode 100644 index 0cbd652..0000000 --- a/LabelStoreMax/lib/helpers/shared_pref.dart +++ /dev/null @@ -1,28 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:shared_preferences/shared_preferences.dart'; - -class SharedPref { - read(String key) async { - final prefs = await SharedPreferences.getInstance(); - return prefs.getString(key); - } - - save(String key, value) async { - final prefs = await SharedPreferences.getInstance(); - prefs.setString(key, value); - } - - remove(String key) async { - final prefs = await SharedPreferences.getInstance(); - prefs.remove(key); - } -} diff --git a/LabelStoreMax/lib/helpers/shared_pref/sp_auth.dart b/LabelStoreMax/lib/helpers/shared_pref/sp_auth.dart deleted file mode 100644 index f655c75..0000000 --- a/LabelStoreMax/lib/helpers/shared_pref/sp_auth.dart +++ /dev/null @@ -1,42 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/cupertino.dart'; -import 'package:label_storemax/helpers/shared_pref.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; - -const keyAuthCheck = "DEFAULT_SP_AUTHCHECK"; - -Future authCheck() async { - SharedPref sharedPref = SharedPref(); - String val = await sharedPref.read(keyAuthCheck); - return val != null ? true : false; -} - -authUser(String v) async { - SharedPref sharedPref = SharedPref(); - await sharedPref.save(keyAuthCheck, v); -} - -Future readAuthToken() async { - SharedPref sharedPref = SharedPref(); - dynamic val = await sharedPref.read(keyAuthCheck); - return val.toString(); -} - -authLogout(BuildContext context) async { - SharedPref sharedPref = SharedPref(); - await sharedPref.save(keyAuthCheck, null); - destroyUserId(context); - Cart.getInstance.clear(); - navigatorPush(context, routeName: "/home", forgetAll: true); -} diff --git a/LabelStoreMax/lib/helpers/shared_pref/sp_user_id.dart b/LabelStoreMax/lib/helpers/shared_pref/sp_user_id.dart deleted file mode 100644 index 17ad4f3..0000000 --- a/LabelStoreMax/lib/helpers/shared_pref/sp_user_id.dart +++ /dev/null @@ -1,29 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/cupertino.dart'; -import 'package:label_storemax/helpers/shared_pref.dart'; - -const keyUserId = "DEFAULT_SP_USERID"; - -storeUserId(String v) async { - SharedPref sharedPref = SharedPref(); - await sharedPref.save(keyUserId, v); -} - -Future readUserId() async { - SharedPref sharedPref = SharedPref(); - return await sharedPref.read(keyUserId); -} - -destroyUserId(BuildContext context) async { - SharedPref sharedPref = SharedPref(); - await sharedPref.save(keyUserId, null); -} diff --git a/LabelStoreMax/lib/labelconfig.dart b/LabelStoreMax/lib/labelconfig.dart deleted file mode 100644 index ffabb23..0000000 --- a/LabelStoreMax/lib/labelconfig.dart +++ /dev/null @@ -1,78 +0,0 @@ -// -// LabelCore -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'dart:ui'; - -/* - Developer Notes - - SUPPORT EMAIL - support@woosignal.com - VERSION - 3.0.0 - https://woosignal.com - */ - -/**/ - -const app_name = "MyApp"; - -const app_key = "Your app key from WooSignal"; - -// Your App key from WooSignal -// link: https://woosignal.com/dashboard/apps - -/**/ - -const Locale app_locale = Locale('en'); - -const List app_locales_supported = [ - Locale('en'), - Locale('es'), - Locale('fr'), - Locale('hi'), - Locale('it'), - Locale('pt'), -]; -// If you want to localize the app, add the locale above -// then create a new lang json file using keys from en.json -// e.g. lang/es.json - -const app_product_placeholder_image = - "https://woosignal.com/images/woocommerce-placeholder.png"; - -/**/ - -// Available: "Stripe", "CashOnDelivery", "RazorPay" -// Add the method to the array below e.g. ["Stripe", "CashOnDelivery"] - -const app_payment_methods = ["Stripe"]; - -/**/ - -// Your StripeAccount key from WooSignal -// link: https://woosignal.com/dashboard - -const app_stripe_account = "Your Stripe Key from WooSignal"; - -const app_stripe_live_mode = false; // set to true for live Stripe payments -// For Live Payments follow the below steps -// #1 SET the above to true for live payments -// #2 Next visit https://woosignal.com/dashboard -// #3 Then change "Environment for Stripe" to Live mode - -/**/ -// https://razorpay.com/ - -const app_razor_id = "Your Razor ID from RazorPay"; - -/**/ - -const app_debug = true; diff --git a/LabelStoreMax/lib/main.dart b/LabelStoreMax/lib/main.dart index 92afa47..661c3d3 100644 --- a/LabelStoreMax/lib/main.dart +++ b/LabelStoreMax/lib/main.dart @@ -1,59 +1,30 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - import 'package:flutter/material.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/pages/account_billing_details.dart'; -import 'package:label_storemax/pages/account_detail.dart'; -import 'package:label_storemax/pages/account_landing.dart'; -import 'package:label_storemax/pages/account_order_detail.dart'; -import 'package:label_storemax/pages/account_profile_update.dart'; -import 'package:label_storemax/pages/account_register.dart'; -import 'package:label_storemax/pages/account_shipping_details.dart'; -import 'package:label_storemax/pages/customer_countries.dart'; -import 'package:label_storemax/pages/error_page.dart'; -import 'package:label_storemax/pages/no_connection_page.dart'; -import 'package:label_storemax/pages/product_image_viewer_page.dart'; -import 'package:woosignal/models/response/order.dart'; -import 'package:woosignal/models/response/product_category.dart'; -import 'package:woosignal/models/response/products.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_app/bootstrap/app.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/config/app_locale.dart'; +import 'package:flutter_app/resources/themes/dark_theme.dart'; +import 'package:flutter_app/resources/themes/default_theme.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/routes/router.dart'; +import 'package:nylo_framework/nylo.dart'; +import 'package:nylo_framework/nylo_framework.dart'; +import 'package:nylo_framework/theme/helper/theme_helper.dart'; import 'package:woosignal/models/response/woosignal_app.dart'; import 'package:wp_json_api/wp_json_api.dart'; -import 'labelconfig.dart'; -import 'package:label_storemax/pages/checkout_details.dart'; -import 'package:label_storemax/pages/home.dart'; -import 'package:label_storemax/pages/about.dart'; -import 'package:label_storemax/pages/checkout_confirmation.dart'; -import 'package:label_storemax/pages/cart.dart'; -import 'package:label_storemax/pages/checkout_status.dart'; -import 'package:label_storemax/pages/checkout_payment_type.dart'; -import 'package:label_storemax/pages/checkout_shipping_type.dart'; -import 'package:label_storemax/pages/product_detail.dart'; -import 'package:label_storemax/pages/browse_search.dart'; -import 'package:label_storemax/pages/home_menu.dart'; -import 'package:label_storemax/pages/home_search.dart'; -import 'package:label_storemax/pages/browse_category.dart'; -import 'package:flutter/services.dart'; -import 'package:page_transition/page_transition.dart'; -import 'package:label_storemax/helpers/app_themes.dart'; -import 'package:label_storemax/helpers/app_localizations.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + AppTheme appTheme = AppTheme(); + + Nylo nylo = + await initNylo(theme: defaultTheme(appTheme), router: buildRouter()); await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); + String initialRoute = '/no-connection'; WooSignalApp wooSignalApp = await appWooSignal((api) => api.getApp()); @@ -64,205 +35,22 @@ void main() async { if (wooSignalApp.wpLoginEnabled == 1) { WPJsonAPI.instance.initWith( baseUrl: wooSignalApp.wpLoginBaseUrl, - shouldDebug: wooSignalApp.appDebug == 1 ? true : false, + shouldDebug: (wooSignalApp.appDebug == 1), wpJsonPath: wooSignalApp.wpLoginWpApiPath, ); } } runApp( - new MaterialApp( - title: wooSignalApp?.appName ?? "Label StoreMax", - color: Colors.white, - debugShowCheckedModeBanner: false, - initialRoute: initialRoute, - routes: { - '/home': (BuildContext context) => new HomePage(), - '/cart': (BuildContext context) => new CartPage(), - '/error': (BuildContext context) => new ErrorPage(), - '/checkout': (BuildContext context) => new CheckoutConfirmationPage(), - '/account-register': (BuildContext context) => - new AccountRegistrationPage(), - '/account-detail': (BuildContext context) => new AccountDetailPage(), - '/account-update': (BuildContext context) => - new AccountProfileUpdatePage(), - '/account-billing-details': (BuildContext context) => - new AccountBillingDetailsPage(), - '/account-shipping-details': (BuildContext context) => - new AccountShippingDetailsPage(), - '/no-connection': (BuildContext context) => new NoConnectionPage(), - }, - onGenerateRoute: (settings) { - switch (settings.name) { - case '/account-landing': - return PageTransition( - child: AccountLandingPage(), - type: PageTransitionType.bottomToTop, - ); - - case '/browse-category': - if (settings.arguments != null) { - final ProductCategory category = - settings.arguments as ProductCategory; - return PageTransition( - child: BrowseCategoryPage(productCategory: category), - type: PageTransitionType.fade, - ); - } - return PageTransition( - child: ErrorPage(), - type: PageTransitionType.fade, - ); - - case '/product-search': - if (settings.arguments != null) { - final String search = settings.arguments as String; - return PageTransition( - child: BrowseSearchPage(search: search), - type: PageTransitionType.fade, - ); - } - return PageTransition( - child: ErrorPage(), - type: PageTransitionType.fade, - ); - - case '/product-detail': - if (settings.arguments != null) { - final Product product = settings.arguments as Product; - return PageTransition( - child: ProductDetailPage(product: product), - type: PageTransitionType.rightToLeftWithFade, - ); - } - return PageTransition( - child: ErrorPage(), - type: PageTransitionType.fade, - ); - - case '/product-images': - if (settings.arguments != null) { - final Map args = settings.arguments; - return PageTransition( - child: ProductImageViewerPage( - initialIndex: args["index"], - arrImageSrc: args["images"], - ), - type: PageTransitionType.fade); - } - return PageTransition( - child: ErrorPage(), type: PageTransitionType.rightToLeft); - - case '/account-order-detail': - if (settings.arguments != null) { - final int orderId = settings.arguments as int; - return PageTransition( - child: AccountOrderDetailPage(orderId: orderId), - type: PageTransitionType.rightToLeftWithFade, - ); - } - return PageTransition( - child: ErrorPage(), - type: PageTransitionType.fade, - ); - - case '/checkout-status': - if (settings.arguments != null) { - final Order order = settings.arguments as Order; - return PageTransition( - child: CheckoutStatusPage(order: order), - type: PageTransitionType.rightToLeftWithFade, - ); - } - return PageTransition( - child: ErrorPage(), - type: PageTransitionType.fade, - ); - - case '/home-menu': - return PageTransition( - child: HomeMenuPage(), - type: PageTransitionType.leftToRightWithFade, - ); - - case '/checkout-details': - return PageTransition( - child: CheckoutDetailsPage(), - type: PageTransitionType.bottomToTop, - ); - - case '/about': - return PageTransition( - child: AboutPage(), - type: PageTransitionType.leftToRightWithFade, - ); - - case '/checkout-payment-type': - return PageTransition( - child: CheckoutPaymentTypePage(), - type: PageTransitionType.bottomToTop, - ); - - case '/checkout-shipping-type': - return PageTransition( - child: CheckoutShippingTypePage(), - type: PageTransitionType.bottomToTop, - ); - - case '/home-search': - return PageTransition( - child: HomeSearchPage(), - type: PageTransitionType.bottomToTop, - ); - - case '/customer-countries': - return PageTransition( - child: CustomerCountriesPage(), - type: PageTransitionType.bottomToTop, - ); - default: - return null; - } - }, - supportedLocales: app_locales_supported, - localizationsDelegates: [ - AppLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalMaterialLocalizations.delegate - ], + AppBuild( + navigatorKey: nylo.router.navigatorKey, + onGenerateRoute: nylo.router.generator(), + themeData: CurrentTheme.instance.theme, + darkTheme: darkTheme(appTheme), locale: app_locale, - localeResolutionCallback: - (Locale locale, Iterable supportedLocales) { - return locale; - }, - theme: ThemeData( - primaryColor: HexColor("#2f4ffe"), - backgroundColor: Colors.white, - buttonTheme: ButtonThemeData( - hoverColor: Colors.transparent, - buttonColor: HexColor("#529cda"), - colorScheme: colorSchemeButton(), - minWidth: double.infinity, - height: 70, - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(5.0), - ), - ), - appBarTheme: AppBarTheme( - color: Colors.white, - textTheme: textThemeAppBar(), - elevation: 0.0, - brightness: Brightness.light, - iconTheme: IconThemeData(color: Colors.black), - actionsIconTheme: IconThemeData( - color: Colors.black, - ), - ), - accentColor: Colors.black, - accentTextTheme: textThemeAccent(), - textTheme: textThemeMain(), - primaryTextTheme: textThemePrimary(), - ), + initialRoute: initialRoute, + supportedLocales: app_locales_supported, + debugShowCheckedModeBanner: false, ), ); } diff --git a/LabelStoreMax/lib/pages/about.dart b/LabelStoreMax/lib/pages/about.dart deleted file mode 100644 index ab0a07c..0000000 --- a/LabelStoreMax/lib/pages/about.dart +++ /dev/null @@ -1,114 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/menu_item.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; -import 'package:package_info/package_info.dart'; -import 'package:woosignal/models/response/woosignal_app.dart'; - -class AboutPage extends StatefulWidget { - AboutPage(); - - @override - _AboutPageState createState() => _AboutPageState(); -} - -class _AboutPageState extends State { - _AboutPageState(); - - WooSignalApp _wooSignalApp; - - @override - void initState() { - super.initState(); - _wooSignalApp = AppHelper.instance.appConfig; - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.transparent, - leading: IconButton( - icon: Icon(Icons.close), - onPressed: () => Navigator.pop(context), - ), - title: Text( - trans(context, "About"), - style: Theme.of(context).primaryTextTheme.headline6, - ), - centerTitle: true, - ), - body: SafeArea( - minimum: safeAreaDefault(), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Center(child: StoreLogo()), - flex: 2, - ), - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - MenuItem( - title: trans(context, "Privacy policy"), - leading: Icon(Icons.people), - action: _actionPrivacy, - ), - MenuItem( - title: trans(context, "Terms and conditions"), - leading: Icon(Icons.description), - action: _actionTerms, - ), - FutureBuilder( - future: PackageInfo.fromPlatform(), - builder: (BuildContext context, - AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.none: - return Text(""); - case ConnectionState.active: - case ConnectionState.waiting: - return Text(""); - case ConnectionState.done: - if (snapshot.hasError) return Text(""); - return Padding( - child: Text( - "${trans(context, "Version")}: ${snapshot.data.version}", - style: Theme.of(context) - .primaryTextTheme - .bodyText1), - padding: EdgeInsets.only(top: 15, bottom: 15), - ); - } - return null; // unreachable - }, - ), - ], - ), - flex: 2, - ), - ], - ), - ), - ); - } - - void _actionTerms() => openBrowserTab(url: _wooSignalApp.appTermslink); - - void _actionPrivacy() => openBrowserTab(url: _wooSignalApp.appPrivacylink); -} diff --git a/LabelStoreMax/lib/pages/checkout_status.dart b/LabelStoreMax/lib/pages/checkout_status.dart deleted file mode 100644 index e3ab42c..0000000 --- a/LabelStoreMax/lib/pages/checkout_status.dart +++ /dev/null @@ -1,187 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:woosignal/models/response/products.dart' as WS; -import 'package:woosignal/models/response/order.dart' as WS; - -import '../widgets/woosignal_ui.dart'; - -class CheckoutStatusPage extends StatefulWidget { - final WS.Order order; - CheckoutStatusPage({Key key, @required this.order}) : super(key: key); - - @override - _CheckoutStatusState createState() => _CheckoutStatusState(this.order); -} - -class _CheckoutStatusState extends State { - _CheckoutStatusState(this._order); - - WS.Order _order; - - @override - void initState() { - super.initState(); - - Cart.getInstance.clear(); - CheckoutSession.getInstance.clear(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - elevation: 0.0, - title: StoreLogo(height: 60), - automaticallyImplyLeading: false, - centerTitle: true, - ), - body: SafeArea( - child: Center( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: Column( - children: [ - Padding( - child: Text( - trans(context, "Order Status"), - style: Theme.of(context).primaryTextTheme.subtitle1, - ), - padding: EdgeInsets.only(bottom: 15), - ), - Text( - trans(context, "Thank You!"), - style: Theme.of(context).primaryTextTheme.headline6, - textAlign: TextAlign.left, - ), - Text( - trans(context, "Your transaction details"), - style: Theme.of(context).primaryTextTheme.bodyText2, - textAlign: TextAlign.left, - ), - Text( - trans(context, "Order Ref") + - ". #" + - _order.id.toString(), - style: Theme.of(context).primaryTextTheme.bodyText1, - textAlign: TextAlign.left, - ), - ], - ), - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - border: Border( - bottom: BorderSide(color: Colors.black12, width: 1.0), - ), - ), - padding: EdgeInsets.only(bottom: 20), - ), - Container( - child: Image( - image: new AssetImage("assets/images/camion.gif"), - height: 170, - ), - decoration: BoxDecoration( - color: Colors.white, - ), - width: double.infinity, - ), - ], - ), - Align( - child: Padding( - child: Text( - trans(context, "Items"), - style: Theme.of(context).primaryTextTheme.subtitle1, - textAlign: TextAlign.left, - ), - padding: EdgeInsets.all(8), - ), - alignment: Alignment.center, - ), - Expanded( - child: new ListView.builder( - itemCount: _order.lineItems.length, - itemBuilder: (BuildContext context, int index) { - WS.LineItems lineItem = _order.lineItems[index]; - return Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Text( - lineItem.name, - style: Theme.of(context) - .primaryTextTheme - .bodyText1, - softWrap: false, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - Text( - "x" + lineItem.quantity.toString(), - style: Theme.of(context) - .primaryTextTheme - .bodyText2, - ), - ], - ), - ), - Text( - formatStringCurrency( - total: lineItem.total.toString(), - ), - style: - Theme.of(context).primaryTextTheme.bodyText1, - ) - ], - ), - decoration: BoxDecoration( - color: Colors.white, - ), - padding: EdgeInsets.all(16), - margin: EdgeInsets.all(8), - ); - }), - ), - Align( - child: MaterialButton( - child: Text(trans(context, "Back to Home")), - onPressed: () => Navigator.pushNamed(context, "/home"), - ), - alignment: Alignment.bottomCenter, - ), - ], - ), - ), - ), - ); - } -} diff --git a/LabelStoreMax/lib/pages/error_page.dart b/LabelStoreMax/lib/pages/error_page.dart deleted file mode 100644 index 02994a8..0000000 --- a/LabelStoreMax/lib/pages/error_page.dart +++ /dev/null @@ -1,62 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/buttons.dart'; - -class ErrorPage extends StatefulWidget { - ErrorPage(); - - @override - _ErrorPageState createState() => _ErrorPageState(); -} - -class _ErrorPageState extends State { - _ErrorPageState(); - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - minimum: safeAreaDefault(), - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.error_outline, - size: 100, - color: Colors.black54, - ), - Padding( - padding: const EdgeInsets.all(16.0), - child: Text( - trans(context, "Sorry, something went wrong"), - style: Theme.of(context).primaryTextTheme.bodyText2, - textAlign: TextAlign.center, - ), - ), - LinkButton( - title: trans(context, "Back"), - action: () => Navigator.pop(context)), - ], - ), - ), - ), - ); - } -} diff --git a/LabelStoreMax/lib/pages/home_menu.dart b/LabelStoreMax/lib/pages/home_menu.dart deleted file mode 100644 index 1f5f134..0000000 --- a/LabelStoreMax/lib/pages/home_menu.dart +++ /dev/null @@ -1,105 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/widgets/menu_item.dart'; -import 'package:label_storemax/helpers/tools.dart'; - -import '../widgets/woosignal_ui.dart'; - -class HomeMenuPage extends StatefulWidget { - HomeMenuPage(); - - @override - _HomeMenuPageState createState() => _HomeMenuPageState(); -} - -class _HomeMenuPageState extends State { - _HomeMenuPageState(); - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.transparent, - elevation: 0.0, - title: Text( - trans(context, "Menu"), - style: Theme.of(context).primaryTextTheme.headline6, - ), - leading: IconButton( - icon: Icon(Icons.close), - onPressed: () => Navigator.of(context).pop(), - ), - centerTitle: true, - ), - body: SafeArea( - minimum: safeAreaDefault(), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - StoreLogo(height: 100), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - (AppHelper.instance.appConfig.wpLoginEnabled == 1 - ? MenuItem( - title: trans(context, "Profile"), - leading: Icon(Icons.account_circle), - action: _actionProfile, - ) - : Container()), - MenuItem( - title: trans(context, "Cart"), - leading: Icon(Icons.shopping_cart), - action: _actionCart, - ), - MenuItem( - title: trans(context, "About Us"), - leading: Icon(Icons.account_balance), - action: _actionAboutUs, - ), - ], - ), - ), - ], - ), - ), - ); - } - - void _actionCart() { - Navigator.pushNamed(context, "/cart"); - } - - void _actionAboutUs() { - Navigator.pushNamed(context, "/about"); - } - - void _actionProfile() async { - if (AppHelper.instance.appConfig.wpLoginEnabled == 1 && - !(await authCheck())) { - UserAuth.instance.redirect = "/account-detail"; - Navigator.pushNamed(context, "/account-landing"); - return; - } - Navigator.pushNamed(context, "/account-detail"); - } -} diff --git a/LabelStoreMax/lib/pages/product_image_viewer_page.dart b/LabelStoreMax/lib/pages/product_image_viewer_page.dart deleted file mode 100644 index ad90461..0000000 --- a/LabelStoreMax/lib/pages/product_image_viewer_page.dart +++ /dev/null @@ -1,82 +0,0 @@ -// PRODUCT DETAIL NEW -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:label_storemax/labelconfig.dart'; - -class ProductImageViewerPage extends StatefulWidget { - final int initialIndex; - final List arrImageSrc; - - const ProductImageViewerPage({Key key, this.initialIndex, this.arrImageSrc}) - : super(key: key); - - @override - _ProductImageViewerPageState createState() => - _ProductImageViewerPageState(this.initialIndex, this.arrImageSrc); -} - -class _ProductImageViewerPageState extends State { - _ProductImageViewerPageState(this._initialIndex, this._arrImageSrc); - - int _initialIndex; - List _arrImageSrc; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - minimum: safeAreaDefault(), - child: Column( - children: [ - Expanded( - child: Swiper( - index: _initialIndex, - itemBuilder: (BuildContext context, int index) { - return CachedNetworkImage( - imageUrl: _arrImageSrc.length == 0 - ? app_product_placeholder_image - : _arrImageSrc[index], - placeholder: (context, url) => - new CircularProgressIndicator( - strokeWidth: 2, - backgroundColor: Colors.black12, - ), - errorWidget: (context, url, error) => new Icon(Icons.error), - fit: BoxFit.contain, - ); - }, - itemCount: _arrImageSrc.length == 0 ? 1 : _arrImageSrc.length, - viewportFraction: 0.9, - scale: 0.95, - ), - ), - Container( - child: IconButton( - icon: Icon(Icons.close), - onPressed: () => Navigator.pop(context), - ), - ) - ], - ), - ), - ); - } -} diff --git a/LabelStoreMax/lib/pages/account_billing_details.dart b/LabelStoreMax/lib/resources/pages/account_billing_details.dart similarity index 82% rename from LabelStoreMax/lib/pages/account_billing_details.dart rename to LabelStoreMax/lib/resources/pages/account_billing_details.dart index 70c65d2..8fe3d6a 100644 --- a/LabelStoreMax/lib/pages/account_billing_details.dart +++ b/LabelStoreMax/lib/resources/pages/account_billing_details.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,14 +8,16 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:wp_json_api/models/responses/wc_customer_info_response.dart'; import 'package:wp_json_api/models/responses/wc_customer_updated_response.dart'; import 'package:wp_json_api/wp_json_api.dart'; @@ -31,14 +33,16 @@ class AccountBillingDetailsPage extends StatefulWidget { class _AccountBillingDetailsPageState extends State { _AccountBillingDetailsPageState(); + AppTheme _appTheme = AppTheme(); + // BILLING TEXT CONTROLLERS - TextEditingController _txtShippingFirstName = TextEditingController(); - TextEditingController _txtShippingLastName = TextEditingController(); - TextEditingController _txtShippingAddressLine = TextEditingController(); - TextEditingController _txtShippingCity = TextEditingController(); - TextEditingController _txtShippingState = TextEditingController(); - TextEditingController _txtShippingPostalCode = TextEditingController(); - TextEditingController _txtShippingCountry = TextEditingController(); + TextEditingController _txtShippingFirstName = TextEditingController(), + _txtShippingLastName = TextEditingController(), + _txtShippingAddressLine = TextEditingController(), + _txtShippingCity = TextEditingController(), + _txtShippingState = TextEditingController(), + _txtShippingPostalCode = TextEditingController(), + _txtShippingCountry = TextEditingController(); bool _isLoading = true, _isUpdating = false; @@ -71,13 +75,14 @@ class _AccountBillingDetailsPageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, title: Text( trans(context, "Billing Details"), - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -86,7 +91,7 @@ class _AccountBillingDetailsPageState extends State { child: GestureDetector( onTap: () => FocusScope.of(context).requestFocus(new FocusNode()), child: _isLoading - ? showAppLoader() + ? AppLoaderWidget() : LayoutBuilder( builder: (context, constraints) => Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -94,6 +99,7 @@ class _AccountBillingDetailsPageState extends State { children: [ SizedBox( child: Container( + margin: EdgeInsets.only(top: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -146,10 +152,10 @@ class _AccountBillingDetailsPageState extends State { ), Flexible( child: TextEditingRow( - heading: trans(context, "Country"), - keyboardType: - TextInputType.emailAddress, - controller: _txtShippingCountry), + heading: trans(context, "Country"), + keyboardType: TextInputType.emailAddress, + controller: _txtShippingCountry, + ), ), ], crossAxisAlignment: CrossAxisAlignment.center, @@ -159,19 +165,13 @@ class _AccountBillingDetailsPageState extends State { ], ), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveTheme.isLight + ? Colors.white + : _appTheme.accentColor( + brightness: Brightness.dark), borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: HexColor("#e8e8e8"), - blurRadius: 15.0, - spreadRadius: 0, - offset: Offset( - 0, - 0, - ), - ) - ], + boxShadow: + adaptiveTheme.isLight ? wsBoxShadow() : null, ), padding: EdgeInsets.all(8), ), diff --git a/LabelStoreMax/lib/pages/account_detail.dart b/LabelStoreMax/lib/resources/pages/account_detail.dart similarity index 94% rename from LabelStoreMax/lib/pages/account_detail.dart rename to LabelStoreMax/lib/resources/pages/account_detail.dart index e0f8818..21eb789 100644 --- a/LabelStoreMax/lib/pages/account_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_detail.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,15 +8,16 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:bubble_tab_indicator/bubble_tab_indicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/order.dart'; import 'package:wp_json_api/models/responses/wc_customer_info_response.dart'; @@ -31,7 +32,6 @@ class _AccountDetailPageState extends State with SingleTickerProviderStateMixin { RefreshController _refreshController = RefreshController(initialRefresh: false); - bool _shouldStopRequests = false, waitForNextRequest = false, _isLoading = true, @@ -55,7 +55,7 @@ class _AccountDetailPageState extends State new Tab(text: ""), ]; _tabController = TabController(vsync: this, length: _tabs.length); - _activeBody = showAppLoader(); + _activeBody = AppLoaderWidget(); this.init(); } @@ -98,6 +98,7 @@ class _AccountDetailPageState extends State new Tab(text: trans(context, "Orders")), new Tab(text: trans(context, "Settings")), ]; + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, @@ -110,7 +111,7 @@ class _AccountDetailPageState extends State ), title: Text( trans(context, "Account"), - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -118,7 +119,7 @@ class _AccountDetailPageState extends State body: SafeArea( minimum: safeAreaDefault(), child: _isLoading - ? showAppLoader() + ? AppLoaderWidget() : Column( children: [ Container( @@ -203,8 +204,9 @@ class _AccountDetailPageState extends State ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - boxShadow: wsBoxShadow(), - color: Colors.white, + boxShadow: adaptiveTheme.isLight ? wsBoxShadow() : null, + color: + adaptiveTheme.isLight ? Colors.white : Colors.white70, ), ), Expanded(child: _activeBody), @@ -307,7 +309,7 @@ class _AccountDetailPageState extends State Widget _widgetOrders() { return _isLoadingOrders - ? showAppLoader() + ? AppLoaderWidget() : SmartRefresher( enablePullDown: true, enablePullUp: true, @@ -360,7 +362,7 @@ class _AccountDetailPageState extends State overflow: TextOverflow.ellipsis, ), Text( - capitalize(_orders[i].status), + _orders[i].status.capitalize(), maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -381,11 +383,10 @@ class _AccountDetailPageState extends State formatStringCurrency( total: _orders[i].total), style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText2 .copyWith( - fontWeight: FontWeight.w600, - color: Colors.black), + fontWeight: FontWeight.w600), textAlign: TextAlign.left, ), Text( @@ -393,11 +394,10 @@ class _AccountDetailPageState extends State " " + trans(context, "items"), style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText1 .copyWith( - fontWeight: FontWeight.w600, - color: Colors.black), + fontWeight: FontWeight.w600), textAlign: TextAlign.left, ), ], @@ -416,11 +416,10 @@ class _AccountDetailPageState extends State ), textAlign: TextAlign.right, style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText1 .copyWith( fontWeight: FontWeight.w400, - color: Colors.black, ), ), ], diff --git a/LabelStoreMax/lib/pages/account_landing.dart b/LabelStoreMax/lib/resources/pages/account_landing.dart similarity index 80% rename from LabelStoreMax/lib/pages/account_landing.dart rename to LabelStoreMax/lib/resources/pages/account_landing.dart index 47b3205..f456cf8 100644 --- a/LabelStoreMax/lib/pages/account_landing.dart +++ b/LabelStoreMax/lib/resources/pages/account_landing.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,15 +8,17 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:flutter_app/app/models/user.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:wp_json_api/exceptions/incorrect_password_exception.dart'; import 'package:wp_json_api/exceptions/invalid_email_exception.dart'; import 'package:wp_json_api/exceptions/invalid_nonce_exception.dart'; @@ -35,6 +37,7 @@ class _AccountLandingPageState extends State { bool _hasTappedLogin = false; TextEditingController _tfEmailController = TextEditingController(), _tfPasswordController = TextEditingController(); + AppTheme _appTheme = AppTheme(); @override void initState() { @@ -43,8 +46,8 @@ class _AccountLandingPageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( - backgroundColor: Colors.white, resizeToAvoidBottomInset: false, body: SafeArea( child: Column( @@ -66,10 +69,7 @@ class _AccountLandingPageState extends State { child: Text( trans(context, "Login"), textAlign: TextAlign.left, - style: Theme.of(context) - .primaryTextTheme - .headline4 - .copyWith( + style: Theme.of(context).textTheme.headline4.copyWith( fontSize: 24, fontWeight: FontWeight.w700, ), @@ -79,8 +79,10 @@ class _AccountLandingPageState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - boxShadow: wsBoxShadow(), - color: Colors.white, + boxShadow: adaptiveTheme.isLight ? wsBoxShadow() : null, + color: adaptiveTheme.isLight + ? Colors.white + : _appTheme.accentColor(brightness: Brightness.dark), ), padding: EdgeInsets.symmetric(vertical: 18, horizontal: 8), margin: EdgeInsets.symmetric(horizontal: 16), @@ -114,32 +116,38 @@ class _AccountLandingPageState extends State { children: [ Icon( Icons.account_circle, - color: Colors.black38, + color: + adaptiveTheme.isLight ? Colors.black38 : Colors.white70, ), Padding( child: Text( trans(context, "Create an account"), - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, ), padding: EdgeInsets.only(left: 8), ) ], ), - onPressed: () { - Navigator.pushNamed(context, "/account-register"); - }, + onPressed: () => + Navigator.pushNamed(context, "/account-register"), ), LinkButton( title: trans(context, "Forgot Password"), action: () { String forgotPasswordUrl = AppHelper.instance.appConfig.wpLoginForgotPasswordUrl; - launch(forgotPasswordUrl); + if (forgotPasswordUrl != null) { + openBrowserTab(url: forgotPasswordUrl); + } else { + NyLogger.info( + "No URL found for \"forgot password\".\nAdd your forgot password URL here https://woosignal.com/dashboard/apps"); + } }), Divider(), LinkButton( - title: trans(context, "Back"), - action: () => Navigator.pop(context)), + title: trans(context, "Back"), + action: () => Navigator.pop(context), + ), ], ), ), @@ -214,8 +222,9 @@ class _AccountLandingPageState extends State { if (wpUserLoginResponse != null && wpUserLoginResponse.status == 200) { String token = wpUserLoginResponse.data.userToken; - authUser(token); - storeUserId(wpUserLoginResponse.data.userId.toString()); + String userId = wpUserLoginResponse.data.userId.toString(); + User user = User.fromUserAuthResponse(token: token, userId: userId); + user.save(SharedKey.authUser); showEdgeAlertWith(context, title: trans(context, "Hello"), diff --git a/LabelStoreMax/lib/pages/account_order_detail.dart b/LabelStoreMax/lib/resources/pages/account_order_detail.dart similarity index 78% rename from LabelStoreMax/lib/pages/account_order_detail.dart rename to LabelStoreMax/lib/resources/pages/account_order_detail.dart index 5c29ff7..c53653e 100644 --- a/LabelStoreMax/lib/pages/account_order_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_order_detail.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,37 +8,43 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_app/app/controllers/account_order_detail_controller.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; import 'package:woosignal/models/response/order.dart'; -class AccountOrderDetailPage extends StatefulWidget { - final int orderId; - - AccountOrderDetailPage({Key key, @required this.orderId}) : super(key: key); +class AccountOrderDetailPage extends StatefulPageWidget { + final AccountOrderDetailController controller = + AccountOrderDetailController(); + AccountOrderDetailPage({Key key}) : super(key: key); @override _AccountOrderDetailPageState createState() => _AccountOrderDetailPageState(); } -class _AccountOrderDetailPageState extends State { - _AccountOrderDetailPageState(); - +class _AccountOrderDetailPageState extends NyState { + int _orderId; Order _order; bool _isLoading = true; @override - void initState() { - super.initState(); - _fetchOrder(); + widgetDidLoad() async { + super.widgetDidLoad(); + _orderId = widget.controller.data(); + await _fetchOrder(); } @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, @@ -50,8 +56,8 @@ class _AccountOrderDetailPageState extends State { margin: EdgeInsets.only(left: 0), ), title: Text( - "${capitalize(trans(context, "Order"))} #${widget.orderId.toString()}", - style: Theme.of(context).primaryTextTheme.headline6, + "${trans(context, "Order").capitalize()} #${_orderId.toString()}", + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -59,12 +65,12 @@ class _AccountOrderDetailPageState extends State { body: SafeArea( minimum: safeAreaDefault(), child: _isLoading - ? showAppLoader() + ? AppLoaderWidget() : Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("${capitalize(trans(context, "Date Ordered"))}: " + + Text("${trans(context, "Date Ordered").capitalize()}: " + dateFormatted( date: _order.dateCreated, formatType: formatForDateTime(FormatType.Date))), @@ -77,7 +83,7 @@ class _AccountOrderDetailPageState extends State { children: [ Flexible( child: Text( - "${capitalize(trans(context, "Ships to"))}:"), + "${trans(context, "Ships to").capitalize()}:"), ), Flexible( child: Text( @@ -103,8 +109,11 @@ class _AccountOrderDetailPageState extends State { ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - boxShadow: wsBoxShadow(), - color: Colors.white, + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, + color: adaptiveThemeMode.isLight + ? Colors.white + : Color(0xFF2C2C2C), ), ), Expanded( @@ -134,10 +143,9 @@ class _AccountOrderDetailPageState extends State { ), ), Text( - capitalize( - formatStringCurrency( - total: _order.lineItems[i].price), - ), + formatStringCurrency( + total: _order.lineItems[i].price) + .capitalize(), maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -161,23 +169,18 @@ class _AccountOrderDetailPageState extends State { total: _order.lineItems[i].total, ), style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText2 .copyWith( fontWeight: FontWeight.w600, - color: Colors.black, ), textAlign: TextAlign.left, ), Text( "x${_order.lineItems[i].quantity.toString()}", style: Theme.of(context) - .primaryTextTheme - .bodyText1 - .copyWith( - fontWeight: FontWeight.w600, - color: Colors.black, - ), + .textTheme + .bodyText1, textAlign: TextAlign.left, ), ], @@ -204,7 +207,7 @@ class _AccountOrderDetailPageState extends State { _fetchOrder() async { _order = await appWooSignal((api) { - return api.retrieveOrder(widget.orderId); + return api.retrieveOrder(_orderId); }); if (_order != null) { setState(() { diff --git a/LabelStoreMax/lib/pages/account_profile_update.dart b/LabelStoreMax/lib/resources/pages/account_profile_update.dart similarity index 92% rename from LabelStoreMax/lib/pages/account_profile_update.dart rename to LabelStoreMax/lib/resources/pages/account_profile_update.dart index f921ec3..35a1849 100644 --- a/LabelStoreMax/lib/pages/account_profile_update.dart +++ b/LabelStoreMax/lib/resources/pages/account_profile_update.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -10,11 +10,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:wp_json_api/models/responses/wp_user_info_response.dart'; import 'package:wp_json_api/models/responses/wp_user_info_updated_response.dart'; import 'package:wp_json_api/wp_json_api.dart'; @@ -62,7 +63,6 @@ class _AccountProfileUpdatePageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - backgroundColor: Colors.white, title: Text( trans(context, "Update Details"), style: TextStyle( @@ -73,7 +73,7 @@ class _AccountProfileUpdatePageState extends State { elevation: 1, ), body: isLoading - ? showAppLoader() + ? AppLoaderWidget() : SafeArea( child: Column( children: [ @@ -116,7 +116,6 @@ class _AccountProfileUpdatePageState extends State { ), margin: EdgeInsets.all(8), padding: EdgeInsets.all(8), - color: Colors.white, ), ), ], diff --git a/LabelStoreMax/lib/pages/account_register.dart b/LabelStoreMax/lib/resources/pages/account_register.dart similarity index 88% rename from LabelStoreMax/lib/pages/account_register.dart rename to LabelStoreMax/lib/resources/pages/account_register.dart index 27cc99a..e6f0285 100644 --- a/LabelStoreMax/lib/pages/account_register.dart +++ b/LabelStoreMax/lib/resources/pages/account_register.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,13 +8,15 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_user_id.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/user.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/shared_key.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/helpers/shared_pref.dart'; import 'package:woosignal/models/response/woosignal_app.dart'; import 'package:wp_json_api/exceptions/empty_username_exception.dart'; @@ -38,10 +40,11 @@ class _AccountRegistrationPageState extends State { _AccountRegistrationPageState(); bool _hasTappedRegister = false; - TextEditingController _tfEmailAddressController = TextEditingController(); - TextEditingController _tfPasswordController = TextEditingController(); - TextEditingController _tfFirstNameController = TextEditingController(); - TextEditingController _tfLastNameController = TextEditingController(); + TextEditingController _tfEmailAddressController = TextEditingController(), + _tfPasswordController = TextEditingController(), + _tfFirstNameController = TextEditingController(), + _tfLastNameController = TextEditingController(); + WooSignalApp _wooSignalApp = AppHelper.instance.appConfig; @override @@ -51,6 +54,7 @@ class _AccountRegistrationPageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, @@ -60,7 +64,7 @@ class _AccountRegistrationPageState extends State { ), title: Text( "Register", - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -126,7 +130,10 @@ class _AccountRegistrationPageState extends State { text: trans(context, "privacy policy"), style: TextStyle(fontWeight: FontWeight.bold)), ], - style: TextStyle(color: Colors.black45), + style: TextStyle( + color: adaptiveTheme.isLight + ? Colors.black45 + : Colors.white70), ), textAlign: TextAlign.center, ), @@ -228,8 +235,9 @@ class _AccountRegistrationPageState extends State { if (wpUserRegisterResponse != null && wpUserRegisterResponse.status == 200) { String token = wpUserRegisterResponse.data.userToken; - authUser(token); - storeUserId(wpUserRegisterResponse.data.userId.toString()); + String userId = wpUserRegisterResponse.data.userId.toString(); + User user = User.fromUserAuthResponse(token: token, userId: userId); + user.save(SharedKey.authUser); await WPJsonAPI.instance.api((request) => request .wpUpdateUserInfo(token, firstName: firstName, lastName: lastName)); diff --git a/LabelStoreMax/lib/pages/account_shipping_details.dart b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart similarity index 85% rename from LabelStoreMax/lib/pages/account_shipping_details.dart rename to LabelStoreMax/lib/resources/pages/account_shipping_details.dart index 1faade8..1e5e4c6 100644 --- a/LabelStoreMax/lib/pages/account_shipping_details.dart +++ b/LabelStoreMax/lib/resources/pages/account_shipping_details.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,14 +8,16 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:wp_json_api/models/responses/wc_customer_info_response.dart'; import 'package:wp_json_api/models/responses/wc_customer_updated_response.dart'; import 'package:wp_json_api/wp_json_api.dart'; @@ -32,14 +34,16 @@ class _AccountShippingDetailsPageState extends State { _AccountShippingDetailsPageState(); + AppTheme _appTheme = AppTheme(); + // BILLING TEXT CONTROLLERS - TextEditingController _txtShippingFirstName = TextEditingController(); - TextEditingController _txtShippingLastName = TextEditingController(); - TextEditingController _txtShippingAddressLine = TextEditingController(); - TextEditingController _txtShippingCity = TextEditingController(); - TextEditingController _txtShippingPostalCode = TextEditingController(); - TextEditingController _txtShippingState = TextEditingController(); - TextEditingController _txtShippingCountry = TextEditingController(); + TextEditingController _txtShippingFirstName = TextEditingController(), + _txtShippingLastName = TextEditingController(), + _txtShippingAddressLine = TextEditingController(), + _txtShippingCity = TextEditingController(), + _txtShippingPostalCode = TextEditingController(), + _txtShippingState = TextEditingController(), + _txtShippingCountry = TextEditingController(); bool _isLoading = true, _isUpdating = false; @@ -87,13 +91,14 @@ class _AccountShippingDetailsPageState @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, title: Text( trans(context, "Shipping Details"), - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -104,7 +109,7 @@ class _AccountShippingDetailsPageState FocusScope.of(context).requestFocus(new FocusNode()); }, child: _isLoading - ? showAppLoader() + ? AppLoaderWidget() : LayoutBuilder( builder: (context, constraints) => Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -112,6 +117,7 @@ class _AccountShippingDetailsPageState children: [ SizedBox( child: Container( + margin: EdgeInsets.only(top: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -176,20 +182,13 @@ class _AccountShippingDetailsPageState ], ), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveTheme.isLight + ? Colors.white + : _appTheme.accentColor( + brightness: Brightness.dark), borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: HexColor("#e8e8e8"), - blurRadius: 15.0, - // has the effect of softening the shadow - spreadRadius: 0, - offset: Offset( - 0, - 0, - ), - ) - ], + boxShadow: + adaptiveTheme.isLight ? wsBoxShadow() : null, ), padding: EdgeInsets.all(8), ), diff --git a/LabelStoreMax/lib/pages/browse_category.dart b/LabelStoreMax/lib/resources/pages/browse_category.dart similarity index 71% rename from LabelStoreMax/lib/pages/browse_category.dart rename to LabelStoreMax/lib/resources/pages/browse_category.dart index ec6c009..1738a88 100644 --- a/LabelStoreMax/lib/pages/browse_category.dart +++ b/LabelStoreMax/lib/resources/pages/browse_category.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -10,29 +10,32 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/enums/sort_enums.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; +import 'package:flutter_app/app/controllers/browse_category_controller.dart'; +import 'package:flutter_app/bootstrap/enums/sort_enums.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/product_category.dart'; import 'package:woosignal/models/response/products.dart' as WS; -import 'package:label_storemax/widgets/woosignal_ui.dart'; -class BrowseCategoryPage extends StatefulWidget { - final ProductCategory productCategory; - const BrowseCategoryPage({Key key, @required this.productCategory}) - : super(key: key); +class BrowseCategoryPage extends StatefulPageWidget { + final BrowseCategoryController controller = BrowseCategoryController(); + BrowseCategoryPage({Key key}) : super(key: key); @override _BrowseCategoryPageState createState() => _BrowseCategoryPageState(); } -class _BrowseCategoryPageState extends State { +class _BrowseCategoryPageState extends NyState { + ProductCategory productCategory; _BrowseCategoryPageState(); List _products = []; - RefreshController _refreshController = RefreshController(initialRefresh: false); @@ -42,9 +45,10 @@ class _BrowseCategoryPageState extends State { _isLoading = true; @override - void initState() { - super.initState(); - _fetchMoreProducts(); + widgetDidLoad() async { + super.widgetDidLoad(); + this.productCategory = widget.controller.data(); + await _fetchMoreProducts(); } _fetchMoreProducts() async { @@ -52,7 +56,7 @@ class _BrowseCategoryPageState extends State { List products = await appWooSignal( (api) => api.getProducts( perPage: 50, - category: widget.productCategory.id.toString(), + category: productCategory.id.toString(), page: _page, status: "publish", stockStatus: "instock"), @@ -85,9 +89,9 @@ class _BrowseCategoryPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text(trans(context, "Browse"), - style: Theme.of(context).primaryTextTheme.subtitle1), - Text(parseHtmlString(widget.productCategory.name), - style: Theme.of(context).primaryTextTheme.headline6) + style: Theme.of(context).textTheme.subtitle1), + Text(parseHtmlString(productCategory.name), + style: Theme.of(context).textTheme.headline6) ], ), centerTitle: true, @@ -102,7 +106,7 @@ class _BrowseCategoryPageState extends State { minimum: safeAreaDefault(), child: _isLoading ? Center( - child: showAppLoader(), + child: AppLoaderWidget(), ) : refreshableScroll(context, refreshController: _refreshController, @@ -173,26 +177,30 @@ class _BrowseCategoryPageState extends State { bodyWidget: ListView( children: [ LinkButton( - title: trans(context, "Sort: Low to high"), - action: () => _sortProducts(by: SortByType.LowToHigh)), + title: trans(context, "Sort: Low to high"), + action: () => _sortProducts(by: SortByType.LowToHigh), + ), Divider( height: 0, ), LinkButton( - title: trans(context, "Sort: High to low"), - action: () => _sortProducts(by: SortByType.HighToLow)), + title: trans(context, "Sort: High to low"), + action: () => _sortProducts(by: SortByType.HighToLow), + ), Divider( height: 0, ), LinkButton( - title: trans(context, "Sort: Name A-Z"), - action: () => _sortProducts(by: SortByType.NameAZ)), + title: trans(context, "Sort: Name A-Z"), + action: () => _sortProducts(by: SortByType.NameAZ), + ), Divider( height: 0, ), LinkButton( - title: trans(context, "Sort: Name Z-A"), - action: () => _sortProducts(by: SortByType.NameZA)), + title: trans(context, "Sort: Name Z-A"), + action: () => _sortProducts(by: SortByType.NameZA), + ), Divider( height: 0, ), diff --git a/LabelStoreMax/lib/pages/browse_search.dart b/LabelStoreMax/lib/resources/pages/browse_search.dart similarity index 73% rename from LabelStoreMax/lib/pages/browse_search.dart rename to LabelStoreMax/lib/resources/pages/browse_search.dart index ec554d2..e727473 100644 --- a/LabelStoreMax/lib/pages/browse_search.dart +++ b/LabelStoreMax/lib/resources/pages/browse_search.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,22 +9,24 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; +import 'package:flutter_app/app/controllers/browse_search_controller.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/products.dart' as WS; -class BrowseSearchPage extends StatefulWidget { - final String search; - BrowseSearchPage({Key key, @required this.search}) : super(key: key); +class BrowseSearchPage extends StatefulPageWidget { + final BrowseSearchController controller = BrowseSearchController(); + BrowseSearchPage({Key key}) : super(key: key); @override - _BrowseSearchState createState() => _BrowseSearchState(search); + _BrowseSearchState createState() => _BrowseSearchState(); } -class _BrowseSearchState extends State { - _BrowseSearchState(this._search); - +class _BrowseSearchState extends NyState { RefreshController _refreshController = RefreshController(initialRefresh: false); @@ -36,9 +38,10 @@ class _BrowseSearchState extends State { _isLoading = true; @override - void initState() { - super.initState(); - _fetchProductsForSearch(); + widgetDidLoad() async { + super.widgetDidLoad(); + _search = widget.controller.data(); + await _fetchProductsForSearch(); } _fetchProductsForSearch() async { @@ -80,9 +83,9 @@ class _BrowseSearchState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text(trans(context, "Search results for"), - style: Theme.of(context).primaryTextTheme.subtitle1), + style: Theme.of(context).textTheme.subtitle1), Text("\"" + _search + "\"", - style: Theme.of(context).primaryTextTheme.headline6) + style: Theme.of(context).textTheme.headline6) ], ), centerTitle: true, @@ -91,7 +94,7 @@ class _BrowseSearchState extends State { minimum: safeAreaDefault(), child: _isLoading ? Center( - child: showAppLoader(), + child: AppLoaderWidget(), ) : refreshableScroll(context, refreshController: _refreshController, diff --git a/LabelStoreMax/lib/pages/cart.dart b/LabelStoreMax/lib/resources/pages/cart.dart similarity index 88% rename from LabelStoreMax/lib/pages/cart.dart rename to LabelStoreMax/lib/resources/pages/cart.dart index e8a128f..f91d862 100644 --- a/LabelStoreMax/lib/pages/cart.dart +++ b/LabelStoreMax/lib/resources/pages/cart.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -10,16 +10,18 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/shared_pref/sp_auth.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/customer_address.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/text_row_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class CartPage extends StatefulWidget { CartPage(); @@ -166,7 +168,7 @@ class _CartPageState extends State { setState(() {}); } - void _clearCart() { + _clearCart() { Cart.getInstance.clear(); _cartLines = []; showEdgeAlertWith(context, @@ -197,7 +199,7 @@ class _CartPageState extends State { child: Padding( child: Text( trans(context, "Clear Cart"), - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, ), padding: EdgeInsets.only(right: 8), ), @@ -229,8 +231,7 @@ class _CartPageState extends State { Padding( child: Text( trans(context, "Empty Basket"), - style: - Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).textTheme.bodyText2, ), padding: EdgeInsets.only(top: 10), ) @@ -242,7 +243,7 @@ class _CartPageState extends State { ) : (_isLoading ? Expanded( - child: showAppLoader(), + child: AppLoaderWidget(), ) : Expanded( child: ListView.builder( @@ -278,10 +279,9 @@ class _CartPageState extends State { return Text(""); else return new Padding( - child: wsRow2Text( - context, - text1: trans(context, "Total"), - text2: (_isLoading ? "" : snapshot.data), + child: TextRowWidget( + title: trans(context, "Total"), + text: (_isLoading ? "" : snapshot.data), ), padding: EdgeInsets.only(bottom: 15, top: 15), ); diff --git a/LabelStoreMax/lib/pages/checkout_confirmation.dart b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart similarity index 83% rename from LabelStoreMax/lib/pages/checkout_confirmation.dart rename to LabelStoreMax/lib/resources/pages/checkout_confirmation.dart index c134f9c..ec17f95 100644 --- a/LabelStoreMax/lib/pages/checkout_confirmation.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_confirmation.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,17 +8,18 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/app_payment_methods.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/customer_address.dart'; -import 'package:label_storemax/models/customer_country.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; +import 'package:flutter_app/app/models/customer_country.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/response/tax_rate.dart'; import 'package:woosignal/models/response/woosignal_app.dart'; @@ -35,24 +36,22 @@ class CheckoutConfirmationPageState extends State { bool _showFullLoader = true, _isProcessingPayment = false; - List _taxRates; + List _taxRates = []; TaxRate _taxRate; - WooSignalApp _wooSignalApp; + final WooSignalApp _wooSignalApp = AppHelper.instance.appConfig; @override void initState() { super.initState(); - _wooSignalApp = AppHelper.instance.appConfig; - _taxRates = []; - if (CheckoutSession.getInstance.paymentType == null) { - CheckoutSession.getInstance.paymentType = arrPaymentMethods.first; + if (CheckoutSession.getInstance.paymentType == null && + getPaymentTypes().length > 0) { + CheckoutSession.getInstance.paymentType = getPaymentTypes().first; } - _getTaxes(); } - void reloadState({bool showLoader}) { + reloadState({bool showLoader}) { setState(() { _showFullLoader = showLoader ?? false; }); @@ -179,10 +178,17 @@ class CheckoutConfirmationPageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, - title: StoreLogo(height: 50), + title: Text( + trans(context, "Checkout"), + style: Theme.of(context) + .textTheme + .subtitle1 + .copyWith(fontWeight: FontWeight.bold), + ), centerTitle: true, ), resizeToAvoidBottomInset: false, @@ -193,25 +199,35 @@ class CheckoutConfirmationPageState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Center( - child: Text( - trans(context, "Checkout"), - style: Theme.of(context).primaryTextTheme.subtitle1, - ), - ), Expanded( child: Container( padding: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveThemeMode.isLight + ? Colors.white + : Colors.white54, borderRadius: BorderRadius.circular(10), - boxShadow: wsBoxShadow(), + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, ), margin: EdgeInsets.only(top: 5, bottom: 5), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + Container( + decoration: BoxDecoration( + boxShadow: adaptiveThemeMode.isLight + ? wsBoxShadow(blurRadius: 10) + : null, + color: Colors.transparent, + ), + padding: EdgeInsets.all(2), + margin: EdgeInsets.only(top: 16), + child: ClipRRect( + child: StoreLogo(height: 65), + borderRadius: BorderRadius.circular(8), + )), ((CheckoutSession.getInstance.billingDetails != null && CheckoutSession.getInstance.billingDetails .billingAddress != @@ -242,11 +258,13 @@ class CheckoutConfirmationPageState extends State { (CheckoutSession.getInstance.paymentType != null ? wsCheckoutRow(context, heading: trans(context, "Payment method"), - leadImage: Image( - image: AssetImage("assets/images/" + - CheckoutSession.getInstance - .paymentType.assetImage), + leadImage: Image.asset( + getImageAsset(CheckoutSession + .getInstance.paymentType.assetImage), width: 70, + color: adaptiveThemeMode.isLight + ? null + : Colors.white, ), leadTitle: CheckoutSession .getInstance.paymentType.desc, @@ -327,12 +345,12 @@ class CheckoutConfirmationPageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - showAppLoader(), + AppLoaderWidget(), Padding( padding: const EdgeInsets.only(top: 15), child: Text( "${trans(context, "One moment")}...", - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, ), ) ], @@ -391,14 +409,14 @@ class CheckoutConfirmationPageState extends State { } if (_wooSignalApp.disableShipping != 1 && - CheckoutSession.getInstance.shippingType.minimumValue != null) { + CheckoutSession.getInstance.shippingType?.minimumValue != null) { String total = await Cart.getInstance.getTotal(); if (total == null) { return; } double doubleTotal = double.parse(total); double doubleMinimumValue = - double.parse(CheckoutSession.getInstance.shippingType.minimumValue); + double.parse(CheckoutSession.getInstance.shippingType?.minimumValue); if (doubleTotal < doubleMinimumValue) { showEdgeAlertWith(context, diff --git a/LabelStoreMax/lib/pages/checkout_details.dart b/LabelStoreMax/lib/resources/pages/checkout_details.dart similarity index 88% rename from LabelStoreMax/lib/pages/checkout_details.dart rename to LabelStoreMax/lib/resources/pages/checkout_details.dart index 96571c2..accd4a6 100644 --- a/LabelStoreMax/lib/pages/checkout_details.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_details.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,16 +8,19 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/billing_details.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/customer_address.dart'; -import 'package:label_storemax/models/customer_country.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/customer_address_input.dart'; -import 'package:label_storemax/widgets/switch_address_tab.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/billing_details.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; +import 'package:flutter_app/app/models/customer_country.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/customer_address_input.dart'; +import 'package:flutter_app/resources/widgets/switch_address_tab.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class CheckoutDetailsPage extends StatefulWidget { CheckoutDetailsPage(); @@ -31,6 +34,7 @@ class _CheckoutDetailsPageState extends State { bool _hasDifferentShippingAddress = false, valRememberDetails = true; int activeTabIndex = 0; + AppTheme _appTheme = AppTheme(); // TEXT CONTROLLERS TextEditingController @@ -154,13 +158,14 @@ class _CheckoutDetailsPageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, title: Text( trans(context, "Billing & Shipping Details"), - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -179,7 +184,7 @@ class _CheckoutDetailsPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Container( - margin: EdgeInsets.symmetric(vertical: 6), + margin: EdgeInsets.symmetric(vertical: 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -213,7 +218,7 @@ class _CheckoutDetailsPageState extends State { })), ].where((e) => e != null).toList(), ), - padding: EdgeInsets.symmetric(vertical: 8), + padding: EdgeInsets.symmetric(vertical: 4), ) : null), ].where((e) => e != null).toList(), @@ -223,13 +228,18 @@ class _CheckoutDetailsPageState extends State { Flexible( fit: FlexFit.tight, child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: wsBoxShadow(), - ), - padding: EdgeInsets.all(8), - child: (activeTab ?? tabBillingDetails())), + decoration: BoxDecoration( + color: adaptiveThemeMode.isLight + ? Colors.white + : _appTheme.accentColor( + brightness: Brightness.dark), + borderRadius: BorderRadius.circular(10), + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, + ), + padding: EdgeInsets.only(left: 8, right: 8, top: 8), + child: (activeTab ?? tabBillingDetails()), + ), ), ], ), @@ -244,7 +254,7 @@ class _CheckoutDetailsPageState extends State { children: [ Text( trans(context, "Ship to a different address?"), - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).textTheme.bodyText2, ), Checkbox( value: _hasDifferentShippingAddress, @@ -258,7 +268,7 @@ class _CheckoutDetailsPageState extends State { children: [ Text( trans(context, "Remember my details"), - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).textTheme.bodyText2, ), Checkbox( value: valRememberDetails, @@ -271,8 +281,9 @@ class _CheckoutDetailsPageState extends State { ], ), PrimaryButton( - title: trans(context, "USE DETAILS"), - action: () => _useDetailsTapped()), + title: trans(context, "USE DETAILS"), + action: () => _useDetailsTapped(), + ), ], ), ), diff --git a/LabelStoreMax/lib/pages/checkout_payment_type.dart b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart similarity index 65% rename from LabelStoreMax/lib/pages/checkout_payment_type.dart rename to LabelStoreMax/lib/resources/pages/checkout_payment_type.dart index 671ed71..23d5a1a 100644 --- a/LabelStoreMax/lib/pages/checkout_payment_type.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,11 +8,15 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/payment_type.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class CheckoutPaymentTypePage extends StatefulWidget { CheckoutPaymentTypePage(); @@ -25,6 +29,8 @@ class CheckoutPaymentTypePage extends StatefulWidget { class _CheckoutPaymentTypePageState extends State { _CheckoutPaymentTypePageState(); + AppTheme _appTheme = AppTheme(); + @override void initState() { super.initState(); @@ -38,12 +44,15 @@ class _CheckoutPaymentTypePageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, - title: Text(trans(context, "Payment Method"), - style: Theme.of(context).primaryTextTheme.headline6), + title: Text( + trans(context, "Payment Method"), + style: Theme.of(context).textTheme.headline6, + ), automaticallyImplyLeading: false, centerTitle: true, ), @@ -58,10 +67,8 @@ class _CheckoutPaymentTypePageState extends State { children: [ Padding( child: Center( - child: Image( - image: AssetImage("assets/images/credit_cards.png"), - fit: BoxFit.fitHeight, - height: 100), + child: Image.asset(getImageAsset("credit_cards.png"), + fit: BoxFit.fitHeight, height: 100), ), padding: EdgeInsets.only(top: 20), ), @@ -75,28 +82,35 @@ class _CheckoutPaymentTypePageState extends State { child: ListView.separated( itemCount: getPaymentTypes().length, itemBuilder: (BuildContext context, int index) { + PaymentType paymentType = + getPaymentTypes()[index]; return ListTile( contentPadding: EdgeInsets.only( - top: 10, bottom: 10, left: 8, right: 8), - leading: Image( - image: AssetImage("assets/images/" + - getPaymentTypes()[index].assetImage), + top: 10, + bottom: 10, + left: 8, + right: 8, + ), + leading: Image.asset( + getImageAsset(paymentType.assetImage), width: 60, + color: adaptiveThemeMode.isLight + ? null + : Colors.white, fit: BoxFit.contain, alignment: Alignment.center), - title: Text(getPaymentTypes()[index].desc, - style: Theme.of(context) - .primaryTextTheme - .subtitle1), + title: Text(paymentType.desc, + style: + Theme.of(context).textTheme.subtitle1), selected: true, trailing: (CheckoutSession.getInstance.paymentType == - getPaymentTypes()[index] + paymentType ? Icon(Icons.check) : null), onTap: () { CheckoutSession.getInstance.paymentType = - getPaymentTypes()[index]; + paymentType; Navigator.pop(context); }, ); @@ -113,9 +127,12 @@ class _CheckoutPaymentTypePageState extends State { ], ), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveThemeMode.isLight + ? Colors.white + : _appTheme.accentColor(brightness: Brightness.dark), borderRadius: BorderRadius.circular(10), - boxShadow: wsBoxShadow(), + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, ), padding: EdgeInsets.all(8), ), diff --git a/LabelStoreMax/lib/pages/checkout_shipping_type.dart b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart similarity index 77% rename from LabelStoreMax/lib/pages/checkout_shipping_type.dart rename to LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart index dbfd5ab..d66ba83 100644 --- a/LabelStoreMax/lib/pages/checkout_shipping_type.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_shipping_type.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,17 +8,20 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/models/customer_address.dart'; -import 'package:label_storemax/models/customer_country.dart'; -import 'package:label_storemax/models/shipping_type.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/app/models/customer_address.dart'; +import 'package:flutter_app/app/models/customer_country.dart'; +import 'package:flutter_app/app/models/shipping_type.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:woosignal/models/response/shipping_method.dart'; class CheckoutShippingTypePage extends StatefulWidget { @@ -32,6 +35,7 @@ class CheckoutShippingTypePage extends StatefulWidget { class _CheckoutShippingTypePageState extends State { _CheckoutShippingTypePageState(); + AppTheme _appTheme = AppTheme(); bool _isShippingSupported, _isLoading; List> _wsShippingOptions; WSShipping _shipping; @@ -237,6 +241,7 @@ class _CheckoutShippingTypePageState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; return Scaffold( resizeToAvoidBottomInset: false, appBar: AppBar( @@ -246,7 +251,7 @@ class _CheckoutShippingTypePageState extends State { context, "Shipping Methods", ), - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).textTheme.headline6, ), automaticallyImplyLeading: false, centerTitle: true, @@ -262,10 +267,12 @@ class _CheckoutShippingTypePageState extends State { children: [ Padding( child: Center( - child: Image( - image: AssetImage("assets/images/shipping_icon.png"), - height: 100, - fit: BoxFit.fitHeight), + child: Image.asset( + getImageAsset('shipping_icon.png'), + height: 100, + color: adaptiveThemeMode.isLight ? null : Colors.white, + fit: BoxFit.fitHeight, + ), ), padding: EdgeInsets.only(top: 20), ), @@ -276,7 +283,7 @@ class _CheckoutShippingTypePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ (_isLoading - ? Expanded(child: showAppLoader()) + ? Expanded(child: AppLoaderWidget()) : (_isShippingSupported ? Expanded( child: ListView.separated( @@ -289,12 +296,17 @@ class _CheckoutShippingTypePageState extends State { (BuildContext context, int index) { return ListTile( contentPadding: EdgeInsets.only( - left: 16, right: 16), + left: 16, + right: 16, + ), title: Text( _wsShippingOptions[index]['title'], style: Theme.of(context) - .primaryTextTheme - .subtitle1, + .textTheme + .subtitle1 + .copyWith( + fontWeight: FontWeight.bold, + ), ), selected: true, subtitle: FutureBuilder( @@ -310,52 +322,53 @@ class _CheckoutShippingTypePageState extends State { case ConnectionState.waiting: return Text(''); case ConnectionState.done: - if (snapshot.hasError) + if (snapshot.hasError) { return Text(''); - return RichText( + } else { + Map + shippingOption = + _wsShippingOptions[ + index]; + return RichText( text: TextSpan( - text: '', - style: DefaultTextStyle.of( - context) - .style, - children: [ - (_wsShippingOptions[index] - ["object"] - is FreeShipping - ? TextSpan( - text: - "Free postage") - : TextSpan( - text: trans( - context, - "Price") + - ": " + - formatStringCurrency( - total: snapshot - .data), - )), - _wsShippingOptions[index][ + text: '', + style: Theme.of(context) + .textTheme + .bodyText2, + children: [ + (shippingOption[ + "object"] + is FreeShipping + ? TextSpan( + text: + "Free postage", + ) + : TextSpan( + text: + "${trans(context, "Price")}: ${formatStringCurrency(total: snapshot.data)}", + )), + if (shippingOption[ "min_amount"] != - null - ? TextSpan( - text: "\nSpend a minimum of " + - formatStringCurrency( - total: _wsShippingOptions[ - index] - [ - "min_amount"]), - style: Theme.of( - context) - .primaryTextTheme - .bodyText2 - .copyWith( - fontSize: - 14)) - : null, - ] - .where((e) => e != null) - .toList(), - )); + null) + TextSpan( + text: "\nSpend a minimum of " + + formatStringCurrency( + total: shippingOption[ + "min_amount"]), + style: Theme.of( + context) + .textTheme + .bodyText2 + .copyWith( + fontSize: + 14)) + ] + .where((e) => + e != null) + .toList(), + ), + ); + } } return null; }, @@ -380,9 +393,8 @@ class _CheckoutShippingTypePageState extends State { : Text( trans(context, "Shipping is not supported for your country, sorry"), - style: Theme.of(context) - .primaryTextTheme - .headline6, + style: + Theme.of(context).textTheme.headline6, textAlign: TextAlign.center, ))), LinkButton( @@ -392,9 +404,12 @@ class _CheckoutShippingTypePageState extends State { ], ), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveThemeMode.isLight + ? Colors.white + : _appTheme.accentColor(brightness: Brightness.dark), borderRadius: BorderRadius.circular(10), - boxShadow: wsBoxShadow(), + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, ), padding: EdgeInsets.all(8), ), diff --git a/LabelStoreMax/lib/resources/pages/checkout_status.dart b/LabelStoreMax/lib/resources/pages/checkout_status.dart new file mode 100644 index 0000000..2c7ced5 --- /dev/null +++ b/LabelStoreMax/lib/resources/pages/checkout_status.dart @@ -0,0 +1,183 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:adaptive_theme/adaptive_theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_app/app/controllers/checkout_status_controller.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; +import 'package:woosignal/models/response/order.dart' as WS; +import 'package:nylo_framework/helpers/helper.dart'; + +import '../widgets/woosignal_ui.dart'; + +class CheckoutStatusPage extends StatefulPageWidget { + final CheckoutStatusController controller = CheckoutStatusController(); + CheckoutStatusPage({Key key}) : super(key: key); + + @override + _CheckoutStatusState createState() => _CheckoutStatusState(); +} + +class _CheckoutStatusState extends NyState { + WS.Order _order; + + @override + widgetDidLoad() async { + super.widgetDidLoad(); + _order = widget.controller.data(); + Cart.getInstance.clear(); + CheckoutSession.getInstance.clear(); + } + + @override + Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; + return Scaffold( + appBar: AppBar( + elevation: 0.0, + title: StoreLogo(height: 60), + automaticallyImplyLeading: false, + centerTitle: true, + ), + body: SafeArea( + child: Center( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: Column( + children: [ + Padding( + child: Text( + trans(context, "Order Status"), + style: Theme.of(context).textTheme.subtitle1, + ), + padding: EdgeInsets.only(bottom: 15), + ), + Text( + trans(context, "Thank You!"), + style: Theme.of(context).textTheme.headline6, + textAlign: TextAlign.left, + ), + Text( + trans(context, "Your transaction details"), + style: Theme.of(context).textTheme.bodyText2, + textAlign: TextAlign.left, + ), + Text( + "${trans(context, "Order Ref")}. #${_order.id.toString()}", + style: Theme.of(context).textTheme.bodyText1, + textAlign: TextAlign.left, + ), + ], + ), + width: double.infinity, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide(color: Colors.black12, width: 1.0), + ), + color: adaptiveThemeMode.isLight ? Colors.white : null), + padding: EdgeInsets.only(bottom: 20), + ), + Container( + child: Image.asset( + getImageAsset("camion.gif"), + height: 170, + ), + decoration: BoxDecoration( + color: Colors.white, + ), + width: double.infinity, + ), + ], + ), + Align( + child: Padding( + child: Text( + trans(context, "Items"), + style: Theme.of(context).textTheme.subtitle1, + textAlign: TextAlign.left, + ), + padding: EdgeInsets.all(8), + ), + alignment: Alignment.center, + ), + Expanded( + child: new ListView.builder( + itemCount: + _order.lineItems == null ? 0 : _order.lineItems.length, + itemBuilder: (BuildContext context, int index) { + WS.LineItems lineItem = _order.lineItems[index]; + return Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + Text( + lineItem.name, + style: + Theme.of(context).textTheme.bodyText1, + softWrap: false, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + Text( + "x${lineItem.quantity.toString()}", + style: + Theme.of(context).textTheme.bodyText2, + ), + ], + ), + ), + Text( + formatStringCurrency( + total: lineItem.total.toString(), + ), + style: Theme.of(context).textTheme.bodyText1, + ) + ], + ), + padding: EdgeInsets.all(16), + margin: EdgeInsets.all(8), + color: + adaptiveThemeMode.isLight ? Colors.white : null); + }), + ), + Align( + child: LinkButton( + title: trans(context, "Back to Home"), + action: () => Navigator.pushNamed(context, "/home"), + ), + alignment: Alignment.bottomCenter, + ), + ], + ), + ), + ), + ); + } +} diff --git a/LabelStoreMax/lib/pages/customer_countries.dart b/LabelStoreMax/lib/resources/pages/customer_countries.dart similarity index 90% rename from LabelStoreMax/lib/pages/customer_countries.dart rename to LabelStoreMax/lib/resources/pages/customer_countries.dart index a19a3ad..4850ea2 100644 --- a/LabelStoreMax/lib/pages/customer_countries.dart +++ b/LabelStoreMax/lib/resources/pages/customer_countries.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,9 +9,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/default_shipping.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/default_shipping.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class CustomerCountriesPage extends StatefulWidget { CustomerCountriesPage(); @@ -24,12 +25,11 @@ class _CustomerCountriesPageState extends State { _CustomerCountriesPageState(); List _defaultShipping = [], _activeShippingResults = []; - TextEditingController _tfSearchCountry; + TextEditingController _tfSearchCountry = TextEditingController(); @override void initState() { super.initState(); - _tfSearchCountry = TextEditingController(); _getDefaultShipping(); } @@ -47,7 +47,7 @@ class _CustomerCountriesPageState extends State { backgroundColor: Colors.transparent, title: Text( trans(context, "Select a country"), - style: Theme.of(context).primaryTextTheme.headline6, + style: Theme.of(context).textTheme.headline6, ), centerTitle: true, ), @@ -60,13 +60,12 @@ class _CustomerCountriesPageState extends State { margin: EdgeInsets.only(bottom: 10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(18), - color: Colors.white, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), spreadRadius: 2, blurRadius: 3, - offset: Offset(0, 2), // changes position of shadow + offset: Offset(0, 2), ), ], ), @@ -100,7 +99,7 @@ class _CustomerCountriesPageState extends State { onTap: () => _handleCountryTapped(defaultShipping), child: Container( decoration: BoxDecoration( - color: Colors.white, + // color: Colors.white, borderRadius: BorderRadius.circular(8), border: Border.all(color: Colors.grey[200])), margin: EdgeInsets.symmetric(vertical: 4), @@ -148,7 +147,7 @@ class _CustomerCountriesPageState extends State { child: Container( child: Text( state.name, - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, ), padding: EdgeInsets.only(top: 25, bottom: 25), ), diff --git a/LabelStoreMax/lib/pages/home.dart b/LabelStoreMax/lib/resources/pages/home.dart similarity index 82% rename from LabelStoreMax/lib/pages/home.dart rename to LabelStoreMax/lib/resources/pages/home.dart index 640fe7d..f54d4ee 100644 --- a/LabelStoreMax/lib/pages/home.dart +++ b/LabelStoreMax/lib/resources/pages/home.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,14 +9,17 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/cart_icon.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/cart_icon_widget.dart'; +import 'package:flutter_app/resources/widgets/home_drawer_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/product_category.dart' as WS; import 'package:woosignal/models/response/products.dart' as WSProduct; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:woosignal/models/response/woosignal_app.dart'; class HomePage extends StatefulWidget { HomePage(); @@ -28,14 +31,19 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { _HomePageState(); + final GlobalKey _key = GlobalKey(); + final WooSignalApp _wooSignalApp = AppHelper.instance.appConfig; + RefreshController _refreshController = RefreshController(initialRefresh: false); + List _products = []; List _categories = []; - final GlobalKey _key = GlobalKey(); int _page = 1; - bool _shouldStopRequests, waitForNextRequest, _isLoading = true; + bool _shouldStopRequests = false, + waitForNextRequest = false, + _isLoading = true; @override void initState() { @@ -44,8 +52,6 @@ class _HomePageState extends State { } _home() async { - _shouldStopRequests = false; - waitForNextRequest = false; await _fetchMoreProducts(); await _fetchCategories(); setState(() { @@ -106,17 +112,10 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { - List bannerImages = AppHelper.instance.appConfig.bannerImages; + List bannerImages = _wooSignalApp.bannerImages; return Scaffold( + drawer: HomeDrawerWidget(wooSignalApp: _wooSignalApp), appBar: AppBar( - backgroundColor: Colors.transparent, - leading: Container( - child: IconButton( - icon: Icon(Icons.menu), - onPressed: () => Navigator.pushNamed(context, "/home-menu"), - ), - margin: EdgeInsets.only(left: 0), - ), title: StoreLogo(height: 55), centerTitle: true, actions: [ @@ -124,16 +123,14 @@ class _HomePageState extends State { alignment: Alignment.centerLeft, icon: Icon( Icons.search, - color: Colors.black, size: 35, ), onPressed: () => Navigator.pushNamed(context, "/home-search") .then((value) => _key.currentState.setState(() {})), ), - wsCartIcon(context, key: _key), + CartIconWidget(key: _key), ], ), - backgroundColor: Colors.white, body: SafeArea( minimum: safeAreaDefault(), child: Column( @@ -141,7 +138,7 @@ class _HomePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ (_isLoading - ? Expanded(child: showAppLoader()) + ? Expanded(child: AppLoaderWidget()) : Expanded( child: RefreshableScrollContainer( controller: _refreshController, @@ -161,7 +158,7 @@ class _HomePageState extends State { ); } - void _onRefresh() async { + _onRefresh() async { _products = []; _page = 1; _shouldStopRequests = false; diff --git a/LabelStoreMax/lib/pages/home_search.dart b/LabelStoreMax/lib/resources/pages/home_search.dart similarity index 86% rename from LabelStoreMax/lib/pages/home_search.dart rename to LabelStoreMax/lib/resources/pages/home_search.dart index fb66f38..1ca6d38 100644 --- a/LabelStoreMax/lib/pages/home_search.dart +++ b/LabelStoreMax/lib/resources/pages/home_search.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -9,8 +9,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/buttons.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import '../widgets/woosignal_ui.dart'; @@ -24,13 +25,11 @@ class HomeSearchPage extends StatefulWidget { class _HomeSearchPageState extends State { _HomeSearchPageState(); - TextEditingController _txtSearchController; + TextEditingController _txtSearchController = TextEditingController(); @override void initState() { super.initState(); - - _txtSearchController = TextEditingController(); } _actionSearch() { @@ -61,7 +60,7 @@ class _HomeSearchPageState extends State { ), TextField( controller: _txtSearchController, - style: Theme.of(context).primaryTextTheme.headline3, + style: Theme.of(context).textTheme.headline3, keyboardType: TextInputType.text, autocorrect: false, autofocus: true, diff --git a/LabelStoreMax/lib/pages/no_connection_page.dart b/LabelStoreMax/lib/resources/pages/no_connection_page.dart similarity index 86% rename from LabelStoreMax/lib/pages/no_connection_page.dart rename to LabelStoreMax/lib/resources/pages/no_connection_page.dart index 14fa152..dd4d591 100644 --- a/LabelStoreMax/lib/pages/no_connection_page.dart +++ b/LabelStoreMax/lib/resources/pages/no_connection_page.dart @@ -9,9 +9,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/widgets/buttons.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class NoConnectionPage extends StatefulWidget { NoConnectionPage(); @@ -48,7 +49,7 @@ class _NoConnectionPageState extends State { padding: const EdgeInsets.all(16.0), child: Text( trans(context, "Oops, something went wrong"), - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).textTheme.bodyText2, textAlign: TextAlign.center, ), ), diff --git a/LabelStoreMax/lib/pages/product_detail.dart b/LabelStoreMax/lib/resources/pages/product_detail.dart similarity index 82% rename from LabelStoreMax/lib/pages/product_detail.dart rename to LabelStoreMax/lib/resources/pages/product_detail.dart index 48a9430..a48cc33 100644 --- a/LabelStoreMax/lib/pages/product_detail.dart +++ b/LabelStoreMax/lib/resources/pages/product_detail.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,45 +8,49 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/labelconfig.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/cart_icon.dart'; +import 'package:flutter_app/app/controllers/product_detail_controller.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/cached_image_widget.dart'; +import 'package:flutter_app/resources/widgets/cart_icon_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; import 'package:woosignal/models/response/product_variation.dart' as WS; import 'package:woosignal/models/response/products.dart' as WSProduct; import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -class ProductDetailPage extends StatefulWidget { - final WSProduct.Product product; - const ProductDetailPage({Key key, @required this.product}) : super(key: key); +class ProductDetailPage extends StatefulPageWidget { + final ProductDetailController controller = ProductDetailController(); + ProductDetailPage({Key key}) : super(key: key); @override - _ProductDetailState createState() => _ProductDetailState(this.product); + _ProductDetailState createState() => _ProductDetailState(); } -class _ProductDetailState extends State { - _ProductDetailState(this._product); - - bool _isLoading; +class _ProductDetailState extends NyState { + bool _isLoading = false; WSProduct.Product _product; int _quantityIndicator = 1; List _productVariations = []; + Map _tmpAttributeObj = {}; + AppTheme _appTheme = AppTheme(); @override - void initState() { - super.initState(); + widgetDidLoad() async { + _product = widget.controller.data(); + if (_product.type == "variable") { _isLoading = true; - _fetchProductVariations(); - } else { - _isLoading = false; + await _fetchProductVariations(); } } @@ -76,8 +80,6 @@ class _ProductDetailState extends State { }); } - Map _tmpAttributeObj = {}; - WS.ProductVariation findProductVariation() { WS.ProductVariation tmpProductVariation; @@ -101,7 +103,7 @@ class _ProductDetailState extends State { return tmpProductVariation; } - void _modalBottomSheetOptionsForAttribute(int attributeIndex) { + _modalBottomSheetOptionsForAttribute(int attributeIndex) { wsModalBottom( context, title: @@ -113,7 +115,7 @@ class _ProductDetailState extends State { return ListTile( title: Text( _product.attributes[attributeIndex].options[index], - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, ), trailing: (_tmpAttributeObj.isNotEmpty && _tmpAttributeObj.containsKey(attributeIndex) && @@ -136,17 +138,17 @@ class _ProductDetailState extends State { ); } - _itemAddToCart({CartLineItem cartLineItem}) { - Cart.getInstance.addToCart(cartLineItem: cartLineItem); + _itemAddToCart({CartLineItem cartLineItem}) async { + await Cart.getInstance.addToCart(cartLineItem: cartLineItem); showStatusAlert(context, - title: "Success", + title: trans(context, "Success"), subtitle: trans(context, "Added to cart"), duration: 1, icon: Icons.add_shopping_cart); setState(() {}); } - void _modalBottomSheetAttributes() { + _modalBottomSheetAttributes() { wsModalBottom( context, title: trans(context, "Options"), @@ -159,11 +161,11 @@ class _ProductDetailState extends State { itemBuilder: (BuildContext context, int index) { return ListTile( title: Text(_product.attributes[index].name, - style: Theme.of(context).primaryTextTheme.subtitle1), + style: Theme.of(context).textTheme.subtitle1), subtitle: (_tmpAttributeObj.isNotEmpty && _tmpAttributeObj.containsKey(index)) ? Text(_tmpAttributeObj[index]["value"], - style: Theme.of(context).primaryTextTheme.bodyText1) + style: Theme.of(context).textTheme.bodyText1) : Text( "${trans(context, "Select a")} ${_product.attributes[index].name}"), trailing: (_tmpAttributeObj.isNotEmpty && @@ -182,15 +184,13 @@ class _ProductDetailState extends State { children: [ Text( (findProductVariation() != null - ? trans(context, "Price") + - ": " + - formatStringCurrency(total: findProductVariation().price) + ? "${trans(context, "Price")}: ${formatStringCurrency(total: findProductVariation().price)}" : (((_product.attributes.length == _tmpAttributeObj.values.length) && findProductVariation() == null) ? trans(context, "This variation is unavailable") : trans(context, "Choose your options"))), - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, ), Text( (findProductVariation() != null @@ -198,7 +198,7 @@ class _ProductDetailState extends State { ? trans(context, "Out of stock") : "" : ""), - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, ), PrimaryButton( title: trans(context, "Add to cart"), @@ -240,7 +240,7 @@ class _ProductDetailState extends State { name: _product.name, productId: _product.id, variationId: productVariation.id, - quantity: 1, + quantity: _quantityIndicator, taxStatus: productVariation.taxStatus, shippingClassId: productVariation.shippingClassId.toString(), @@ -251,7 +251,7 @@ class _ProductDetailState extends State { imageSrc: (productVariation.image != null ? productVariation.image.src : _product.images.length == 0 - ? app_product_placeholder_image + ? getEnv("PRODUCT_PLACEHOLDER_IMAGE") : _product.images.first.src), shippingIsTaxable: _product.shippingTaxable, variationOptions: options.join(", "), @@ -268,7 +268,7 @@ class _ProductDetailState extends State { ); } - void _modalBottomSheetMenu() { + _modalBottomSheetMenu() { wsModalBottom( context, title: trans(context, "Description"), @@ -282,18 +282,19 @@ class _ProductDetailState extends State { @override Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, actions: [ - wsCartIcon(context), + CartIconWidget(), ], - title: StoreLogo(height: 55), + title: StoreLogo(height: 55, showBgWhite: !adaptiveTheme.isLight), centerTitle: true, ), body: SafeArea( child: _isLoading - ? showAppLoader() + ? AppLoaderWidget() : Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, @@ -304,29 +305,18 @@ class _ProductDetailState extends State { SizedBox( height: MediaQuery.of(context).size.height * 0.40, child: SizedBox( - child: new Swiper( - itemBuilder: (BuildContext context, int index) { - return CachedNetworkImage( - imageUrl: _product.images.length == 0 - ? app_product_placeholder_image - : _product.images[index].src, - placeholder: (context, url) => Center( - child: new CircularProgressIndicator( - strokeWidth: 2, - backgroundColor: Colors.black12, - ), - ), - errorWidget: (context, url, error) => - new Icon(Icons.error), - fit: BoxFit.contain, - ); - }, + child: Swiper( + itemBuilder: (BuildContext context, int index) => + CachedImageWidget( + image: _product.images[index].src, + ), itemCount: _product.images.length == 0 ? 1 : _product.images.length, viewportFraction: 0.85, scale: 0.9, - onTap: _productImageTapped, + onTap: (int i) => widget.controller + .viewProductImages(i, _product), ), ), ), @@ -344,10 +334,9 @@ class _ProductDetailState extends State { child: Text( _product.name, style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText1 - .copyWith( - color: Colors.black87, fontSize: 20), + .copyWith(fontSize: 20), textAlign: TextAlign.left, overflow: TextOverflow.ellipsis, maxLines: 2, @@ -363,7 +352,7 @@ class _ProductDetailState extends State { formatStringCurrency( total: _product.price), style: Theme.of(context) - .primaryTextTheme + .textTheme .headline4 .copyWith( fontSize: 20, @@ -391,8 +380,10 @@ class _ProductDetailState extends State { ), Container( decoration: BoxDecoration( - color: Colors.white, - boxShadow: wsBoxShadow(), + color: adaptiveTheme.isLight + ? Colors.white + : Colors.black26, + // boxShadow: wsBoxShadow(), borderRadius: BorderRadius.circular(4), ), padding: @@ -410,7 +401,7 @@ class _ProductDetailState extends State { Text( trans(context, "Description"), style: Theme.of(context) - .primaryTextTheme + .textTheme .caption .copyWith(fontSize: 18), textAlign: TextAlign.left, @@ -419,10 +410,11 @@ class _ProductDetailState extends State { child: Text( trans(context, "Full description"), style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText2 .copyWith(fontSize: 14), textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, ), height: 50, minWidth: 60, @@ -437,6 +429,8 @@ class _ProductDetailState extends State { ? parseHtmlString( _product.shortDescription) : parseHtmlString(_product.description)), + maxLines: 5, + overflow: TextOverflow.ellipsis, ), flex: 3, ), @@ -449,7 +443,10 @@ class _ProductDetailState extends State { Container( padding: EdgeInsets.symmetric(horizontal: 16), decoration: BoxDecoration( - color: Colors.white, + color: adaptiveTheme.isLight + ? Colors.white + : _appTheme.scaffoldColor( + brightness: Brightness.dark), boxShadow: [ BoxShadow( color: Colors.black12, @@ -475,8 +472,9 @@ class _ProductDetailState extends State { Text( trans(context, "Quantity"), style: Theme.of(context) - .primaryTextTheme - .bodyText1, + .textTheme + .bodyText1 + .copyWith(color: Colors.grey), ), Row( children: [ @@ -490,7 +488,7 @@ class _ProductDetailState extends State { Text( _quantityIndicator.toString(), style: Theme.of(context) - .primaryTextTheme + .textTheme .bodyText1, ), IconButton( @@ -516,9 +514,7 @@ class _ProductDetailState extends State { total: (parseWcPrice(_product.price) * _quantityIndicator) .toString()), - style: Theme.of(context) - .primaryTextTheme - .headline4, + style: Theme.of(context).textTheme.headline4, textAlign: TextAlign.center, ), alignment: Alignment.centerLeft, @@ -527,7 +523,8 @@ class _ProductDetailState extends State { ? Flexible( child: PrimaryButton( title: trans(context, "Buy Product"), - action: () => _viewExternalProduct(), + action: () => widget.controller + .viewExternalProduct(_product), ), ) : Flexible( @@ -549,23 +546,6 @@ class _ProductDetailState extends State { } _addItemToCart() { - CartLineItem cartLineItem = CartLineItem( - name: _product.name, - productId: _product.id, - quantity: _quantityIndicator, - taxStatus: _product.taxStatus, - shippingClassId: _product.shippingClassId.toString(), - subtotal: _product.price, - taxClass: _product.taxClass, - isManagedStock: _product.manageStock, - stockQuantity: _product.stockQuantity, - shippingIsTaxable: _product.shippingTaxable, - imageSrc: _product.images.length == 0 - ? app_product_placeholder_image - : _product.images.first.src, - total: _product.price, - ); - if (_product.type != "simple") { _modalBottomSheetAttributes(); return; @@ -578,15 +558,23 @@ class _ProductDetailState extends State { icon: Icons.local_shipping); return; } - _itemAddToCart(cartLineItem: cartLineItem); - } - - _productImageTapped(int i) { - Map obj = { - "index": i, - "images": _product.images.map((f) => f.src).toList() - }; - Navigator.pushNamed(context, "/product-images", arguments: obj); + _itemAddToCart( + cartLineItem: CartLineItem( + name: _product.name, + productId: _product.id, + quantity: _quantityIndicator, + taxStatus: _product.taxStatus, + shippingClassId: _product.shippingClassId.toString(), + subtotal: _product.price, + taxClass: _product.taxClass, + isManagedStock: _product.manageStock, + stockQuantity: _product.stockQuantity, + shippingIsTaxable: _product.shippingTaxable, + imageSrc: _product.images.length == 0 + ? getEnv("PRODUCT_PLACEHOLDER_IMAGE") + : _product.images.first.src, + total: _product.price, + )); } _addQuantityTapped() { @@ -614,10 +602,4 @@ class _ProductDetailState extends State { }); } } - - _viewExternalProduct() { - if (_product.externalUrl != null && _product.externalUrl.isNotEmpty) { - openBrowserTab(url: _product.externalUrl); - } - } } diff --git a/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart new file mode 100644 index 0000000..3fc221d --- /dev/null +++ b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart @@ -0,0 +1,73 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_app/app/controllers/product_image_viewer_controller.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/cached_image_widget.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:nylo_framework/widgets/ny_state.dart'; +import 'package:nylo_framework/widgets/stateful_page_widget.dart'; + +class ProductImageViewerPage extends StatefulPageWidget { + final ProductImageViewerController controller = + ProductImageViewerController(); + ProductImageViewerPage({Key key}) : super(key: key); + + @override + _ProductImageViewerPageState createState() => _ProductImageViewerPageState(); +} + +class _ProductImageViewerPageState extends NyState { + int _initialIndex; + List _arrImageSrc; + + @override + void initState() { + this._initialIndex = widget.controller.data()['index']; + this._arrImageSrc = widget.controller.data()['images']; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + minimum: safeAreaDefault(), + child: Column( + children: [ + Expanded( + child: Swiper( + index: _initialIndex, + itemBuilder: (BuildContext context, int index) => + CachedImageWidget( + image: (_arrImageSrc.length == 0 + ? getEnv("PRODUCT_PLACEHOLDER_IMAGE") + : _arrImageSrc[index]), + ), + itemCount: _arrImageSrc.length == 0 ? 1 : _arrImageSrc.length, + viewportFraction: 0.9, + scale: 0.95, + ), + ), + Container( + child: IconButton( + icon: Icon(Icons.close), + onPressed: () => Navigator.pop(context), + ), + ) + ], + ), + ), + ); + } +} diff --git a/LabelStoreMax/lib/resources/themes/dark_theme.dart b/LabelStoreMax/lib/resources/themes/dark_theme.dart new file mode 100644 index 0000000..baf2480 --- /dev/null +++ b/LabelStoreMax/lib/resources/themes/dark_theme.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:nylo_framework/helpers/helper.dart'; + +/* +|-------------------------------------------------------------------------- +| Dark Theme +| +| Theme Config - config/app_theme.dart +|-------------------------------------------------------------------------- +*/ + +TextTheme _defaultTextTheme(AppTheme appTheme) { + return TextTheme( + headline5: TextStyle( + fontSize: 22.0, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + headline4: TextStyle( + fontSize: 24.0, + fontWeight: FontWeight.w600, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + headline3: TextStyle( + fontSize: 26.0, + fontWeight: FontWeight.w700, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + headline2: TextStyle( + fontSize: 28.0, + fontWeight: FontWeight.w600, + color: appTheme.mainColor(brightness: Brightness.dark), + ), + headline1: TextStyle( + fontSize: 36.0, + fontWeight: FontWeight.w300, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + subtitle2: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w500, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + subtitle1: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w500, + color: Colors.white, + ), + overline: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.w400, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + button: TextStyle( + color: Colors.white, + ), + headline6: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: appTheme.mainColor(brightness: Brightness.dark), + ), + bodyText2: TextStyle( + fontSize: 14.0, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + bodyText1: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: appTheme.secondColor(brightness: Brightness.dark), + ), + caption: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: appTheme.accentColor(brightness: Brightness.dark), + ), + ); +} + +ThemeData darkTheme(AppTheme appTheme) => ThemeData( + primaryColor: appTheme.mainColor(brightness: Brightness.dark), + backgroundColor: Colors.white, + brightness: Brightness.dark, + accentColor: appTheme.accentColor(brightness: Brightness.dark), + iconTheme: IconThemeData( + color: appTheme.secondColor(brightness: Brightness.dark)), + primaryColorLight: appTheme.accentColor( + brightness: Brightness.light, + ), + primaryColorDark: appTheme.accentColor( + brightness: Brightness.dark, + ), + primaryTextTheme: _defaultTextTheme(appTheme).copyWith( + bodyText2: + TextStyle(color: Colors.white70, fontWeight: FontWeight.bold), + bodyText1: + TextStyle(color: Colors.grey, fontWeight: FontWeight.bold)), + accentColorBrightness: Brightness.dark, + accentTextTheme: _defaultTextTheme(appTheme).apply( + bodyColor: appTheme.accentColor(brightness: Brightness.dark), + displayColor: appTheme.accentColor(brightness: Brightness.dark), + ), + focusColor: appTheme.accentColor(brightness: Brightness.dark), + scaffoldBackgroundColor: + appTheme.scaffoldColor(brightness: Brightness.dark), + hintColor: appTheme.secondColor(brightness: Brightness.dark), + appBarTheme: AppBarTheme( + textTheme: getAppTextTheme(appThemeFont, _defaultTextTheme(appTheme)), + color: + appTheme.scaffoldColor(brightness: Brightness.dark, opacity: 0.5), + iconTheme: IconThemeData( + color: appTheme.mainColor(brightness: Brightness.dark)), + elevation: 1.0, + brightness: Brightness.dark, + ), + buttonColor: Colors.white, + buttonTheme: ButtonThemeData( + buttonColor: appTheme.accentColor(), + ), + textTheme: getAppTextTheme(appThemeFont, _defaultTextTheme(appTheme)), + ); diff --git a/LabelStoreMax/lib/resources/themes/default_theme.dart b/LabelStoreMax/lib/resources/themes/default_theme.dart new file mode 100644 index 0000000..13c68b0 --- /dev/null +++ b/LabelStoreMax/lib/resources/themes/default_theme.dart @@ -0,0 +1,111 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_app/config/app_theme.dart'; +import 'package:nylo_framework/helpers/helper.dart'; + +/* +|-------------------------------------------------------------------------- +| Default Theme +| +| Theme Config - config/app_theme.dart +|-------------------------------------------------------------------------- +*/ + +ThemeData defaultTheme(AppTheme appTheme) => ThemeData( + primaryColor: appTheme.mainColor(), + backgroundColor: Colors.white, + brightness: Brightness.light, + accentColor: appTheme.accentColor(), + primaryColorLight: appTheme.accentColor( + brightness: Brightness.light, + ), + primaryColorDark: appTheme.accentColor( + brightness: Brightness.dark, + ), + accentColorBrightness: Brightness.light, + accentTextTheme: _defaultTextTheme(appTheme).apply( + bodyColor: appTheme.accentColor(), + displayColor: appTheme.accentColor(), + ), + focusColor: appTheme.accentColor(), + scaffoldBackgroundColor: appTheme.scaffoldColor(), + primaryTextTheme: _defaultTextTheme(appTheme).copyWith( + bodyText2: TextStyle(color: Colors.grey), + bodyText1: TextStyle(color: Colors.grey)), + hintColor: appTheme.secondColor(), + appBarTheme: AppBarTheme( + color: Colors.white, + textTheme: getAppTextTheme(appThemeFont, _defaultTextTheme(appTheme)), + iconTheme: IconThemeData(color: appTheme.mainColor()), + elevation: 0.0, + brightness: Brightness.light, + ), + buttonColor: Colors.white, + buttonTheme: ButtonThemeData( + buttonColor: appTheme.accentColor(), + ), + textTheme: getAppTextTheme(appThemeFont, _defaultTextTheme(appTheme)), + ); + +TextTheme _defaultTextTheme(AppTheme appTheme) { + return TextTheme( + headline5: TextStyle( + fontSize: 22.0, + color: appTheme.secondColor(), + ), + headline4: TextStyle( + fontSize: 24.0, + fontWeight: FontWeight.w600, + color: appTheme.secondColor(), + ), + headline3: TextStyle( + fontSize: 26.0, + fontWeight: FontWeight.w700, + color: appTheme.secondColor(), + ), + headline2: TextStyle( + fontSize: 28.0, + fontWeight: FontWeight.w600, + color: appTheme.mainColor(), + ), + headline1: TextStyle( + fontSize: 36.0, + fontWeight: FontWeight.w300, + color: appTheme.secondColor(), + ), + subtitle2: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w500, + color: appTheme.secondColor(), + ), + subtitle1: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w500, + color: appTheme.secondColor(), + ), + overline: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.w400, + color: appTheme.secondColor(), + ), + button: TextStyle( + color: Colors.white, + ), + headline6: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: appTheme.mainColor(), + ), + bodyText2: TextStyle( + fontSize: 14.0, + color: appTheme.secondColor(), + ), + bodyText1: TextStyle( + fontSize: 16.0, + color: appTheme.secondColor(), + fontWeight: FontWeight.bold), + caption: TextStyle( + fontSize: 16.0, + color: appTheme.accentColor(), + fontWeight: FontWeight.bold), + ); +} diff --git a/LabelStoreMax/lib/resources/widgets/app_loader_widget.dart b/LabelStoreMax/lib/resources/widgets/app_loader_widget.dart new file mode 100644 index 0000000..62ad4b6 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/app_loader_widget.dart @@ -0,0 +1,27 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:adaptive_theme/adaptive_theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AppLoaderWidget extends StatelessWidget { + const AppLoaderWidget({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; + return SpinKitDoubleBounce( + color: adaptiveThemeMode.isLight + ? HexColor("#424242") + : HexColor("#c7c7c7")); + } +} diff --git a/LabelStoreMax/lib/resources/widgets/app_version_widget.dart b/LabelStoreMax/lib/resources/widgets/app_version_widget.dart new file mode 100644 index 0000000..2a4f6d5 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/app_version_widget.dart @@ -0,0 +1,45 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/material.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:package_info/package_info.dart'; + +class AppVersionWidget extends StatelessWidget { + const AppVersionWidget({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: PackageInfo.fromPlatform(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.none: + return Text(""); + case ConnectionState.active: + case ConnectionState.waiting: + return Text(""); + case ConnectionState.done: + if (snapshot.hasError) return Text(""); + return Padding( + child: Text( + "${trans(context, "Version")}: ${snapshot.data.version}", + style: Theme.of(context) + .textTheme + .bodyText1 + .copyWith(fontWeight: FontWeight.w300)), + padding: EdgeInsets.only(top: 15, bottom: 15), + ); + } + return null; // unreachable + }, + ); + } +} diff --git a/LabelStoreMax/lib/widgets/buttons.dart b/LabelStoreMax/lib/resources/widgets/buttons.dart similarity index 82% rename from LabelStoreMax/lib/widgets/buttons.dart rename to LabelStoreMax/lib/resources/widgets/buttons.dart index 7a78021..6fbf9a3 100644 --- a/LabelStoreMax/lib/widgets/buttons.dart +++ b/LabelStoreMax/lib/resources/widgets/buttons.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -11,7 +11,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; class PrimaryButton extends StatelessWidget { const PrimaryButton({ @@ -28,8 +27,10 @@ class PrimaryButton extends StatelessWidget { key: key, title: title, action: action, - textStyle: - Theme.of(context).primaryTextTheme.button.copyWith(fontSize: 16), + textStyle: Theme.of(context) + .textTheme + .button + .copyWith(fontSize: 16, fontWeight: FontWeight.bold), bgColor: HexColor("#529cda"), ); } @@ -49,7 +50,7 @@ class SecondaryButton extends StatelessWidget { key: key, title: title, action: action, - textStyle: Theme.of(context).primaryTextTheme.bodyText1.copyWith( + textStyle: Theme.of(context).textTheme.bodyText1.copyWith( color: Colors.black87, ), bgColor: HexColor("#f6f6f9"), @@ -71,7 +72,7 @@ class LinkButton extends StatelessWidget { key: key, title: title, action: action, - textStyle: Theme.of(context).primaryTextTheme.bodyText1, + textStyle: Theme.of(context).textTheme.bodyText1, bgColor: Colors.transparent, ); } @@ -92,8 +93,9 @@ class WooSignalButton extends StatelessWidget { @override Widget build(BuildContext context) { + final double screenWidth = MediaQuery.of(context).size.width; return Container( - height: 55, + height: (screenWidth >= 385 ? 55 : 49), width: double.infinity, decoration: BoxDecoration( color: Colors.transparent, @@ -101,7 +103,8 @@ class WooSignalButton extends StatelessWidget { child: ElevatedButton( style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12.0)), + borderRadius: BorderRadius.circular(12.0), + ), padding: EdgeInsets.all(8), elevation: 0, primary: bgColor, @@ -109,7 +112,7 @@ class WooSignalButton extends StatelessWidget { child: Text( title, style: textStyle, - maxLines: 2, + maxLines: (screenWidth >= 385 ? 2 : 1), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, ), diff --git a/LabelStoreMax/lib/resources/widgets/cached_image_widget.dart b/LabelStoreMax/lib/resources/widgets/cached_image_widget.dart new file mode 100644 index 0000000..280d5f9 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/cached_image_widget.dart @@ -0,0 +1,45 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; + +class CachedImageWidget extends StatelessWidget { + const CachedImageWidget({ + Key key, + this.image, + this.height = 70, + this.width = 70, + this.placeholder = const Center( + child: CircularProgressIndicator( + strokeWidth: 2, + backgroundColor: Colors.black12, + ), + ), + this.fit = BoxFit.contain, + }) : super(key: key); + + final String image; + final double height; + final double width; + final Widget placeholder; + final BoxFit fit; + + @override + Widget build(BuildContext context) => CachedNetworkImage( + imageUrl: image, + placeholder: (context, url) => placeholder, + errorWidget: (context, url, error) => new Icon(Icons.error), + height: height, + width: width, + alignment: Alignment.center, + fit: fit, + ); +} diff --git a/LabelStoreMax/lib/resources/widgets/cart_icon_widget.dart b/LabelStoreMax/lib/resources/widgets/cart_icon_widget.dart new file mode 100644 index 0000000..9a71d2a --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/cart_icon_widget.dart @@ -0,0 +1,75 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/material.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; + +class CartIconWidget extends StatefulWidget { + CartIconWidget({Key key}) : super(key: key); + + @override + _CartIconWidgetState createState() => _CartIconWidgetState(); +} + +class _CartIconWidgetState extends State { + @override + Widget build(BuildContext context) { + return IconButton( + icon: Stack( + children: [ + Positioned.fill( + child: Align( + child: Icon(Icons.shopping_cart, size: 20), + alignment: Alignment.bottomCenter, + ), + bottom: 0, + ), + Positioned.fill( + child: Align( + child: FutureBuilder>( + future: Cart.getInstance.getCart(), + builder: (BuildContext context, + AsyncSnapshot> snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Text(""); + default: + if (snapshot.hasError) { + return Text(""); + } else { + List cartItems = + snapshot.data.map((e) => e.quantity).toList(); + String cartValue = "0"; + if (cartItems.length > 0) { + cartValue = cartItems + .reduce((value, element) => value + element) + .toString(); + } + return Text( + cartValue, + style: Theme.of(context).textTheme.bodyText1, + textAlign: TextAlign.center, + ); + } + } + }, + ), + alignment: Alignment.topCenter, + ), + top: 0, + ) + ], + ), + onPressed: () => Navigator.pushNamed(context, "/cart") + .then((value) => setState(() {})), + ); + } +} diff --git a/LabelStoreMax/lib/widgets/customer_address_input.dart b/LabelStoreMax/lib/resources/widgets/customer_address_input.dart similarity index 81% rename from LabelStoreMax/lib/widgets/customer_address_input.dart rename to LabelStoreMax/lib/resources/widgets/customer_address_input.dart index 27297f4..e8a9894 100644 --- a/LabelStoreMax/lib/widgets/customer_address_input.dart +++ b/LabelStoreMax/lib/resources/widgets/customer_address_input.dart @@ -1,9 +1,19 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:label_storemax/models/customer_country.dart'; -import 'package:label_storemax/widgets/buttons.dart'; -import 'package:label_storemax/widgets/woosignal_ui.dart'; +import 'package:flutter_app/app/models/customer_country.dart'; +import 'package:flutter_app/resources/widgets/buttons.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; class CustomerAddressInput extends StatelessWidget { const CustomerAddressInput( @@ -18,12 +28,13 @@ class CustomerAddressInput extends StatelessWidget { @required this.onTapCountry}) : super(key: key); - final TextEditingController txtControllerFirstName; - final TextEditingController txtControllerLastName; - final TextEditingController txtControllerAddressLine; - final TextEditingController txtControllerCity; - final TextEditingController txtControllerPostalCode; - final TextEditingController txtControllerEmailAddress; + final TextEditingController txtControllerFirstName, + txtControllerLastName, + txtControllerAddressLine, + txtControllerCity, + txtControllerPostalCode, + txtControllerEmailAddress; + final CustomerCountry customerCountry; final Function() onTapCountry; @@ -100,9 +111,10 @@ class CustomerAddressInput extends StatelessWidget { child: Column( children: [ Container( + height: 23, child: Text( trans(context, "State"), - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, textAlign: TextAlign.left, ), width: double.infinity, @@ -110,7 +122,7 @@ class CustomerAddressInput extends StatelessWidget { Padding( child: SecondaryButton( title: (customerCountry.state != null - ? "${trans(context, "Selected")}\n${customerCountry?.state?.name ?? ""}" + ? (customerCountry?.state?.name ?? "") : trans(context, "Select state")), action: onTapCountry, ), @@ -123,9 +135,10 @@ class CustomerAddressInput extends StatelessWidget { child: Column( children: [ Container( + height: 23, child: Text( trans(context, "Country"), - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, textAlign: TextAlign.left, ), width: double.infinity, @@ -134,7 +147,7 @@ class CustomerAddressInput extends StatelessWidget { child: SecondaryButton( title: (customerCountry != null && (customerCountry?.name ?? "").isNotEmpty - ? "${trans(context, "Selected")}\n${customerCountry.name}" + ? customerCountry.name : trans(context, "Select country")), action: onTapCountry, ), diff --git a/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart b/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart new file mode 100644 index 0000000..6913e0e --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/home_drawer_widget.dart @@ -0,0 +1,127 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:adaptive_theme/adaptive_theme.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/bootstrap/shared_pref/sp_auth.dart'; +import 'package:flutter_app/resources/widgets/app_version_widget.dart'; +import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; +import 'package:nylo_framework/helpers/helper.dart'; +import 'package:woosignal/models/response/woosignal_app.dart'; + +class HomeDrawerWidget extends StatefulWidget { + const HomeDrawerWidget({Key key, @required this.wooSignalApp}) + : super(key: key); + + final WooSignalApp wooSignalApp; + + @override + _HomeDrawerWidgetState createState() => _HomeDrawerWidgetState(); +} + +class _HomeDrawerWidgetState extends State { + @override + Widget build(BuildContext context) { + AdaptiveThemeMode adaptiveTheme = AdaptiveTheme.of(context).mode; + return Drawer( + child: Container( + color: adaptiveTheme == AdaptiveThemeMode.light + ? Colors.white + : Color(0xFF2C2C2C), + child: ListView( + padding: EdgeInsets.zero, + children: [ + DrawerHeader( + child: Center(child: StoreLogo()), + decoration: BoxDecoration( + color: adaptiveTheme.isLight ? Colors.white : Colors.black87, + ), + ), + Padding( + child: Text( + trans(context, "Menu"), + style: Theme.of(context).textTheme.subtitle2, + ), + padding: EdgeInsets.only(left: 16, top: 8, bottom: 8), + ), + if (widget.wooSignalApp.wpLoginEnabled == 1) + ListTile( + title: Text(trans(context, "Profile")), + leading: Icon(Icons.account_circle), + onTap: _actionProfile, + ), + ListTile( + title: Text(trans(context, "Cart")), + leading: Icon(Icons.shopping_cart), + onTap: _actionCart, + ), + Padding( + child: Text( + trans(context, "About Us"), + style: Theme.of(context).textTheme.subtitle2, + ), + padding: EdgeInsets.only(left: 16, top: 8, bottom: 8), + ), + if (widget.wooSignalApp.appTermslink != null && + widget.wooSignalApp.appTermslink.isNotEmpty) + ListTile( + title: Text(trans(context, "Terms and conditions")), + leading: Icon(Icons.menu_book_rounded), + trailing: Icon(Icons.keyboard_arrow_right_rounded), + onTap: _actionTerms, + ), + if (widget.wooSignalApp.appPrivacylink != null && + widget.wooSignalApp.appPrivacylink.isNotEmpty) + ListTile( + title: Text(trans(context, "Privacy policy")), + trailing: Icon(Icons.keyboard_arrow_right_rounded), + leading: Icon(Icons.account_balance), + onTap: _actionPrivacy, + ), + ListTile( + title: Text(adaptiveTheme.isDark + ? trans(context, "Light Mode") + : trans(context, "Dark Mode")), + leading: Icon(Icons.brightness_4_rounded), + onTap: () { + setState(() { + AdaptiveTheme.of(context).toggleThemeMode(); + }); + }, + ), + ListTile( + title: AppVersionWidget(), + ), + ], + ), + ), + ); + } + + _actionTerms() => openBrowserTab(url: widget.wooSignalApp.appTermslink); + + _actionPrivacy() => openBrowserTab(url: widget.wooSignalApp.appPrivacylink); + + _actionProfile() async { + Navigator.pop(context); + if (widget.wooSignalApp.wpLoginEnabled == 1 && !(await authCheck())) { + UserAuth.instance.redirect = "/account-detail"; + Navigator.pushNamed(context, "/account-landing"); + return; + } + Navigator.pushNamed(context, "/account-detail"); + } + + _actionCart() { + Navigator.pop(context); + Navigator.pushNamed(context, "/cart"); + } +} diff --git a/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart b/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart new file mode 100644 index 0000000..87a1ef5 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/no_results_for_products_widget.dart @@ -0,0 +1,26 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/material.dart'; +import 'package:nylo_framework/helpers/helper.dart'; + +class NoResultsForProductsWidget extends StatelessWidget { + const NoResultsForProductsWidget({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) => Column( + children: [ + Text( + trans(context, "No results"), + style: Theme.of(context).textTheme.bodyText2, + ), + ], + ); +} diff --git a/LabelStoreMax/lib/resources/widgets/safearea_widget.dart b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart new file mode 100644 index 0000000..42cc862 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart @@ -0,0 +1,24 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/material.dart'; + +class SafeAreaWidget extends StatelessWidget { + final Widget child; + const SafeAreaWidget({Key key, this.child}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SafeArea( + minimum: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: child, + ); + } +} diff --git a/LabelStoreMax/lib/widgets/switch_address_tab.dart b/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart similarity index 80% rename from LabelStoreMax/lib/widgets/switch_address_tab.dart rename to LabelStoreMax/lib/resources/widgets/switch_address_tab.dart index bd09dbb..9f489a1 100644 --- a/LabelStoreMax/lib/widgets/switch_address_tab.dart +++ b/LabelStoreMax/lib/resources/widgets/switch_address_tab.dart @@ -1,3 +1,13 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/LabelStoreMax/lib/resources/widgets/text_row_widget.dart b/LabelStoreMax/lib/resources/widgets/text_row_widget.dart new file mode 100644 index 0000000..ba8c047 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/text_row_widget.dart @@ -0,0 +1,45 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:flutter/material.dart'; + +class TextRowWidget extends StatelessWidget { + const TextRowWidget({Key key, @required this.title, @required this.text}) + : super(key: key); + + final String title; + final String text; + + @override + Widget build(BuildContext context) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Container( + child: Text(title, style: Theme.of(context).textTheme.headline6), + ), + flex: 3, + ), + Flexible( + child: Container( + child: Text( + text, + style: + Theme.of(context).textTheme.bodyText1.copyWith(fontSize: 16), + ), + ), + flex: 3, + ) + ], + ); + } +} diff --git a/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart b/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart new file mode 100644 index 0000000..d89c0e6 --- /dev/null +++ b/LabelStoreMax/lib/resources/widgets/top_nav_widget.dart @@ -0,0 +1,61 @@ +// Label StoreMax +// +// Created by Anthony Gordon. +// 2021, WooSignal Ltd. All rights reserved. +// + +// 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. + +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/material.dart'; +import 'package:nylo_framework/helpers/helper.dart'; + +class TopNavWidget extends StatelessWidget { + const TopNavWidget({Key key, this.onPressBrowseCategories}) : super(key: key); + + final Function() onPressBrowseCategories; + + @override + Widget build(BuildContext context) => Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "${(trans(context, "Shop").capitalize())} / ", + style: Theme.of(context) + .textTheme + .subtitle1 + .copyWith(fontWeight: FontWeight.bold), + maxLines: 1, + ), + AutoSizeText( + trans(context, "Newest"), + style: Theme.of(context) + .primaryTextTheme + .bodyText2 + .copyWith(fontWeight: FontWeight.bold), + maxLines: 1, + ), + ], + ), + Flexible( + child: MaterialButton( + minWidth: 100, + height: 60, + child: AutoSizeText( + trans(context, "Browse categories"), + style: Theme.of(context).textTheme.bodyText1, + maxLines: 1, + textAlign: TextAlign.right, + ), + onPressed: onPressBrowseCategories, + ), + ) + ], + ); +} diff --git a/LabelStoreMax/lib/widgets/woosignal_ui.dart b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart similarity index 76% rename from LabelStoreMax/lib/widgets/woosignal_ui.dart rename to LabelStoreMax/lib/resources/widgets/woosignal_ui.dart index 31b7274..85eee74 100644 --- a/LabelStoreMax/lib/widgets/woosignal_ui.dart +++ b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart @@ -1,4 +1,4 @@ -// Label StoreMAX +// Label StoreMax // // Created by Anthony Gordon. // 2021, WooSignal Ltd. All rights reserved. @@ -8,109 +8,28 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_app/app/models/cart.dart'; +import 'package:flutter_app/app/models/cart_line_item.dart'; +import 'package:flutter_app/app/models/checkout_session.dart'; +import 'package:flutter_app/bootstrap/app_helper.dart'; +import 'package:flutter_app/bootstrap/helpers.dart'; +import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; +import 'package:flutter_app/resources/widgets/cached_image_widget.dart'; +import 'package:flutter_app/resources/widgets/no_results_for_products_widget.dart'; +import 'package:flutter_app/resources/widgets/text_row_widget.dart'; +import 'package:flutter_app/resources/widgets/top_nav_widget.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:label_storemax/helpers/app_helper.dart'; -import 'package:label_storemax/labelconfig.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; -import 'package:label_storemax/models/checkout_session.dart'; -import 'package:label_storemax/widgets/app_loader.dart'; +import 'package:nylo_framework/helpers/helper.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/products.dart'; -import 'package:label_storemax/helpers/tools.dart'; -import 'package:cached_network_image/cached_network_image.dart'; import 'package:woosignal/models/response/tax_rate.dart'; -const appFontFamily = "Overpass"; - -Widget wsRow2Text(BuildContext context, {String text1, String text2}) { - return Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Container( - child: Text(text1, style: Theme.of(context).textTheme.headline6), - ), - flex: 3, - ), - Flexible( - child: Container( - child: Text( - text2, - style: Theme.of(context) - .primaryTextTheme - .bodyText1 - .copyWith(fontSize: 16, color: Colors.black87), - ), - ), - flex: 3, - ) - ], - ); -} - -class NoProductResults extends StatelessWidget { - const NoProductResults({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) => Column( - children: [ - Text(trans(context, "No results"), - style: Theme.of(context).primaryTextTheme.bodyText2), - ], - ); -} - -class TopNav extends StatelessWidget { - const TopNav({Key key, this.onPressBrowseCategories}) : super(key: key); - - final Function() onPressBrowseCategories; - - @override - Widget build(BuildContext context) => Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "${capitalize(trans(context, "Shop"))} / ", - style: Theme.of(context).primaryTextTheme.subtitle1, - maxLines: 1, - ), - AutoSizeText( - trans(context, "Newest"), - style: Theme.of(context).primaryTextTheme.bodyText2, - maxLines: 1, - ), - ], - ), - Flexible( - child: MaterialButton( - minWidth: 100, - height: 60, - child: AutoSizeText( - trans(context, "Browse categories"), - style: Theme.of(context).primaryTextTheme.bodyText1, - maxLines: 1, - textAlign: TextAlign.right, - ), - onPressed: onPressBrowseCategories, - ), - ) - ], - ); -} - class RefreshableScrollContainer extends StatelessWidget { const RefreshableScrollContainer( {Key key, @@ -170,7 +89,7 @@ class RefreshableScrollContainer extends StatelessWidget { return Container( child: Swiper( itemBuilder: (BuildContext context, int index) { - return CachedImage( + return CachedImageWidget( image: bannerImages[index], fit: BoxFit.contain, ); @@ -184,7 +103,7 @@ class RefreshableScrollContainer extends StatelessWidget { } if (bannerImages.length > 0 && index == 1 || bannerImages.length == 0 && index == 0) { - return TopNav( + return TopNavWidget( onPressBrowseCategories: modalBottomSheetMenu, ); } @@ -215,7 +134,7 @@ class RefreshableScrollContainer extends StatelessWidget { mainAxisSpacing: 4.0, crossAxisSpacing: 4.0, ) - : NoProductResults()), + : NoResultsForProductsWidget()), ); } @@ -233,11 +152,13 @@ Widget wsCheckoutRow(BuildContext context, mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - child: Text(heading, - style: Theme.of(context) - .primaryTextTheme - .bodyText2 - .copyWith(fontSize: 16)), + child: Text( + heading, + style: Theme.of(context) + .textTheme + .bodyText2 + .copyWith(fontSize: 16, fontWeight: FontWeight.bold), + ), padding: EdgeInsets.only(bottom: 8), ), Flexible( @@ -255,8 +176,7 @@ Widget wsCheckoutRow(BuildContext context, child: Container( child: Text( leadTitle, - style: - Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, maxLines: 2, overflow: TextOverflow.ellipsis, softWrap: false, @@ -316,7 +236,7 @@ class TextEditingRow extends StatelessWidget { child: Padding( child: Text( heading, - style: Theme.of(context).primaryTextTheme.bodyText1, + style: Theme.of(context).textTheme.bodyText1, ), padding: EdgeInsets.only(bottom: 2), ), @@ -324,7 +244,7 @@ class TextEditingRow extends StatelessWidget { Flexible( child: TextField( controller: controller, - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context).textTheme.subtitle1, keyboardType: keyboardType ?? TextInputType.text, autocorrect: false, autofocus: shouldAutoFocus ?? false, @@ -346,15 +266,13 @@ Widget widgetCheckoutMeta(BuildContext context, {String title, String amount}) { children: [ Flexible( child: Container( - child: - Text(title, style: Theme.of(context).primaryTextTheme.bodyText2), + child: Text(title, style: Theme.of(context).textTheme.bodyText2), ), flex: 3, ), Flexible( child: Container( - child: - Text(amount, style: Theme.of(context).primaryTextTheme.bodyText1), + child: Text(amount, style: Theme.of(context).textTheme.bodyText1), ), flex: 3, ) @@ -406,18 +324,10 @@ class ProductItemContainer extends StatelessWidget { height: double.infinity, width: double.infinity, ), - CachedNetworkImage( - imageUrl: (product.images.length > 0 + CachedImageWidget( + image: (product.images.length > 0 ? product.images.first.src - : app_product_placeholder_image), - placeholder: (context, url) => Container( - child: Center( - child: CircularProgressIndicator(), - ), - height: constraints.maxHeight / 2, - ), - errorWidget: (context, url, error) => - new Icon(Icons.error), + : getEnv("PRODUCT_PLACEHOLDER_IMAGE")), fit: BoxFit.contain, height: constraints.maxHeight / 2, width: double.infinity, @@ -477,7 +387,7 @@ class ProductItemContainer extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ AutoSizeText( - formatStringCurrency(total: product.price) + " ", + "${formatStringCurrency(total: product.price)} ", style: Theme.of(context) .textTheme .bodyText2 @@ -493,8 +403,8 @@ class ProductItemContainer extends StatelessWidget { .textTheme .bodyText1 .copyWith( - color: Colors.black54, - fontSize: 11), + fontSize: 11, + ), ), TextSpan( text: formatStringCurrency( @@ -504,10 +414,11 @@ class ProductItemContainer extends StatelessWidget { .textTheme .bodyText1 .copyWith( - decoration: - TextDecoration.lineThrough, - color: Colors.grey, - fontSize: 11), + decoration: + TextDecoration.lineThrough, + color: Colors.grey, + fontSize: 11, + ), ), ]), ) @@ -524,8 +435,9 @@ class ProductItemContainer extends StatelessWidget { ); } -void wsModalBottom(BuildContext context, +wsModalBottom(BuildContext context, {String title, Widget bodyWidget, Widget extraWidget}) { + AdaptiveThemeMode adaptiveThemeMode = AdaptiveTheme.of(context).mode; showModalBottomSheet( context: context, backgroundColor: Colors.transparent, @@ -538,7 +450,9 @@ void wsModalBottom(BuildContext context, child: new Container( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: new BoxDecoration( - color: Colors.white, + color: adaptiveThemeMode.isLight + ? Colors.white + : Color(0xFF2C2C2C), borderRadius: new BorderRadius.only( topLeft: const Radius.circular(10.0), topRight: const Radius.circular(10.0), @@ -550,10 +464,7 @@ void wsModalBottom(BuildContext context, padding: EdgeInsets.symmetric(vertical: 16), child: Text( title, - style: Theme.of(context) - .primaryTextTheme - .headline4 - .copyWith(fontSize: 20), + style: Theme.of(context).textTheme.headline4, textAlign: TextAlign.left, ), ), @@ -563,8 +474,11 @@ void wsModalBottom(BuildContext context, EdgeInsets.symmetric(horizontal: 16, vertical: 8), width: double.infinity, decoration: BoxDecoration( - boxShadow: wsBoxShadow(), - color: Colors.white, + boxShadow: + adaptiveThemeMode.isLight ? wsBoxShadow() : null, + color: adaptiveThemeMode.isLight + ? Colors.white + : Color(0xFF4a4a4a), borderRadius: BorderRadius.circular(8), ), child: bodyWidget, @@ -584,14 +498,16 @@ FutureBuilder getTotalWidget() => FutureBuilder( builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return showAppLoader(); + return AppLoaderWidget(); default: if (snapshot.hasError) return Text(""); else return new Padding( - child: wsRow2Text(context, - text1: trans(context, "Total"), text2: snapshot.data), + child: TextRowWidget( + title: trans(context, "Total"), + text: snapshot.data, + ), padding: EdgeInsets.only(bottom: 15, top: 15), ); } @@ -605,7 +521,7 @@ FutureBuilder wsCheckoutTotalWidgetFB({String title, TaxRate taxRate}) { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return showAppLoader(); + return AppLoaderWidget(); default: if (snapshot.hasError) return Text(""); @@ -626,7 +542,7 @@ FutureBuilder wsCheckoutTaxAmountWidgetFB({TaxRate taxRate}) { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return showAppLoader(); + return AppLoaderWidget(); default: if (snapshot.hasError) return Text(""); @@ -652,7 +568,7 @@ FutureBuilder wsCheckoutSubtotalWidgetFB({String title}) { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return showAppLoader(); + return AppLoaderWidget(); default: if (snapshot.hasError) return Text(""); @@ -680,7 +596,7 @@ FutureBuilder wsWidgetCartItemsFB( (BuildContext context, AsyncSnapshot> snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return showAppLoader(); + return AppLoaderWidget(); default: if (snapshot.hasError) return Text(""); @@ -719,12 +635,13 @@ class CartItemContainer extends StatelessWidget { Widget build(BuildContext context) => Container( margin: EdgeInsets.only(bottom: 7), decoration: BoxDecoration( - color: Colors.white, - border: Border( - bottom: BorderSide( + border: Border( + bottom: BorderSide( color: Colors.black12, width: 1, - ))), + ), + ), + ), padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8), child: Column( children: [ @@ -733,10 +650,10 @@ class CartItemContainer extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Flexible( - child: CachedNetworkImage( - imageUrl: cartLineItem.imageSrc == "" - ? app_product_placeholder_image - : cartLineItem.imageSrc, + child: CachedImageWidget( + image: (cartLineItem.imageSrc == "" + ? getEnv("PRODUCT_PLACEHOLDER_IMAGE") + : cartLineItem.imageSrc), width: 100, height: 100, fit: BoxFit.contain, @@ -751,15 +668,16 @@ class CartItemContainer extends StatelessWidget { children: [ Text( cartLineItem.name, - style: Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context) + .textTheme + .subtitle1 + .copyWith(fontWeight: FontWeight.bold), overflow: TextOverflow.ellipsis, maxLines: 3, ), (cartLineItem.variationOptions != null ? Text(cartLineItem.variationOptions, - style: Theme.of(context) - .primaryTextTheme - .bodyText1) + style: Theme.of(context).textTheme.bodyText1) : Container()), Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -771,16 +689,16 @@ class CartItemContainer extends StatelessWidget { : trans(context, "In Stock")), style: (cartLineItem.stockStatus == "outofstock" ? Theme.of(context).textTheme.caption - : Theme.of(context) - .primaryTextTheme - .bodyText2), + : Theme.of(context).textTheme.bodyText2), ), Text( formatDoubleCurrency( total: parseWcPrice(cartLineItem.total), ), - style: - Theme.of(context).primaryTextTheme.subtitle1, + style: Theme.of(context) + .textTheme + .subtitle1 + .copyWith(fontWeight: FontWeight.bold), textAlign: TextAlign.center, ) ], @@ -807,7 +725,7 @@ class CartItemContainer extends StatelessWidget { highlightColor: Colors.transparent, ), Text(cartLineItem.quantity.toString(), - style: Theme.of(context).primaryTextTheme.headline6), + style: Theme.of(context).textTheme.headline6), IconButton( icon: Icon(Icons.remove_circle_outline), onPressed: actionDecrementQuantity, @@ -830,50 +748,30 @@ class CartItemContainer extends StatelessWidget { } class StoreLogo extends StatelessWidget { - const StoreLogo({ - Key key, - this.height = 100, - this.width = 100, - this.placeholder = const CircularProgressIndicator(), - this.fit = BoxFit.contain, - }) : super(key: key); + const StoreLogo( + {Key key, + this.height = 100, + this.width = 100, + this.placeholder = const CircularProgressIndicator(), + this.fit = BoxFit.contain, + this.showBgWhite = true}) + : super(key: key); + final bool showBgWhite; final double height; final double width; final Widget placeholder; final BoxFit fit; @override - Widget build(BuildContext context) => CachedImage( - image: AppHelper.instance.appConfig.appLogo, - height: height, - placeholder: Container(height: height, width: width)); -} - -class CachedImage extends StatelessWidget { - const CachedImage({ - Key key, - this.image, - this.height = 70, - this.width = 70, - this.placeholder = const CircularProgressIndicator(), - this.fit = BoxFit.contain, - }) : super(key: key); - - final String image; - final double height; - final double width; - final Widget placeholder; - final BoxFit fit; - - @override - Widget build(BuildContext context) => CachedNetworkImage( - imageUrl: image, - placeholder: (context, url) => placeholder, - errorWidget: (context, url, error) => new Icon(Icons.error), - height: height, - width: width, - alignment: Alignment.center, - fit: fit, + Widget build(BuildContext context) => Container( + decoration: BoxDecoration( + color: showBgWhite ? Colors.white : Colors.transparent, + borderRadius: BorderRadius.circular(3)), + child: CachedImageWidget( + image: AppHelper.instance.appConfig.appLogo, + height: height, + placeholder: Container(height: height, width: width), + ), ); } diff --git a/LabelStoreMax/lib/routes/router.dart b/LabelStoreMax/lib/routes/router.dart new file mode 100644 index 0000000..0fbafe3 --- /dev/null +++ b/LabelStoreMax/lib/routes/router.dart @@ -0,0 +1,92 @@ +import 'package:flutter_app/resources/pages/account_billing_details.dart'; +import 'package:flutter_app/resources/pages/account_detail.dart'; +import 'package:flutter_app/resources/pages/account_landing.dart'; +import 'package:flutter_app/resources/pages/account_order_detail.dart'; +import 'package:flutter_app/resources/pages/account_profile_update.dart'; +import 'package:flutter_app/resources/pages/account_register.dart'; +import 'package:flutter_app/resources/pages/account_shipping_details.dart'; +import 'package:flutter_app/resources/pages/browse_category.dart'; +import 'package:flutter_app/resources/pages/browse_search.dart'; +import 'package:flutter_app/resources/pages/cart.dart'; +import 'package:flutter_app/resources/pages/checkout_confirmation.dart'; +import 'package:flutter_app/resources/pages/checkout_details.dart'; +import 'package:flutter_app/resources/pages/checkout_payment_type.dart'; +import 'package:flutter_app/resources/pages/checkout_shipping_type.dart'; +import 'package:flutter_app/resources/pages/checkout_status.dart'; +import 'package:flutter_app/resources/pages/customer_countries.dart'; +import 'package:flutter_app/resources/pages/home.dart'; +import 'package:flutter_app/resources/pages/home_search.dart'; +import 'package:flutter_app/resources/pages/no_connection_page.dart'; +import 'package:flutter_app/resources/pages/product_detail.dart'; +import 'package:flutter_app/resources/pages/product_image_viewer_page.dart'; +import 'package:nylo_framework/router/router.dart'; +import 'package:page_transition/page_transition.dart'; + +/* +|-------------------------------------------------------------------------- +| App Router +|-------------------------------------------------------------------------- +*/ + +buildRouter() => nyCreateRoutes((router) { + router.route("/home", (context) => HomePage()); + + router.route("/cart", (context) => CartPage()); + + router.route("/checkout", (context) => CheckoutConfirmationPage()); + + router.route("/browse-category", (context) => BrowseCategoryPage(), + transition: PageTransitionType.fade); + + router.route("/product-search", (context) => BrowseSearchPage(), + transition: PageTransitionType.fade); + + router.route("/product-detail", (context) => ProductDetailPage(), + transition: PageTransitionType.rightToLeftWithFade); + + router.route("/product-images", (context) => ProductImageViewerPage(), + transition: PageTransitionType.fade); + + router.route( + "/account-order-detail", (context) => AccountOrderDetailPage(), + transition: PageTransitionType.rightToLeftWithFade); + + router.route("/checkout-status", (context) => CheckoutStatusPage(), + transition: PageTransitionType.rightToLeftWithFade); + + router.route("/checkout-details", (context) => CheckoutDetailsPage(), + transition: PageTransitionType.bottomToTop); + + router.route( + "/checkout-payment-type", (context) => CheckoutPaymentTypePage(), + transition: PageTransitionType.bottomToTop); + + router.route( + "/checkout-shipping-type", (context) => CheckoutShippingTypePage(), + transition: PageTransitionType.bottomToTop); + + router.route("/home-search", (context) => HomeSearchPage(), + transition: PageTransitionType.bottomToTop); + + router.route("/customer-countries", (context) => CustomerCountriesPage(), + transition: PageTransitionType.bottomToTop); + + router.route("/no-connection", (context) => NoConnectionPage()); + + // Account Section + + router.route("/account-landing", (context) => AccountLandingPage(), + transition: PageTransitionType.bottomToTop); + + router.route("/account-register", (context) => AccountRegistrationPage()); + + router.route("/account-detail", (context) => AccountDetailPage()); + + router.route("/account-update", (context) => AccountProfileUpdatePage()); + + router.route( + "/account-billing-details", (context) => AccountBillingDetailsPage()); + + router.route("/account-shipping-details", + (context) => AccountShippingDetailsPage()); + }); diff --git a/LabelStoreMax/lib/widgets/cart_icon.dart b/LabelStoreMax/lib/widgets/cart_icon.dart deleted file mode 100644 index ce475ac..0000000 --- a/LabelStoreMax/lib/widgets/cart_icon.dart +++ /dev/null @@ -1,59 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; -import 'package:label_storemax/models/cart.dart'; -import 'package:label_storemax/models/cart_line_item.dart'; - -Widget wsCartIcon(BuildContext context, {Key key}) { - return StatefulBuilder( - key: key, - builder: (BuildContext context, StateSetter setState) => IconButton( - icon: Stack( - children: [ - Positioned.fill( - child: Align( - child: - Icon(Icons.shopping_cart, size: 20, color: Colors.black87), - alignment: Alignment.bottomCenter, - ), - bottom: 0), - Positioned.fill( - child: Align( - child: FutureBuilder>( - future: Cart.getInstance.getCart(), - builder: (BuildContext context, - AsyncSnapshot> snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Text(""); - default: - if (snapshot.hasError) - return Text(""); - else - return new Text( - snapshot.data.length.toString(), - style: Theme.of(context).primaryTextTheme.bodyText1, - textAlign: TextAlign.center, - ); - } - }, - ), - alignment: Alignment.topCenter, - ), - top: 0, - ) - ], - ), - onPressed: () => Navigator.pushNamed(context, "/cart") - .then((value) => setState(() {})), - ), - ); -} diff --git a/LabelStoreMax/lib/widgets/menu_item.dart b/LabelStoreMax/lib/widgets/menu_item.dart deleted file mode 100644 index e5efa13..0000000 --- a/LabelStoreMax/lib/widgets/menu_item.dart +++ /dev/null @@ -1,50 +0,0 @@ -// Label StoreMAX -// -// Created by Anthony Gordon. -// 2021, WooSignal Ltd. All rights reserved. -// - -// 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. - -import 'package:flutter/material.dart'; - -class MenuItem extends StatelessWidget { - const MenuItem({ - Key key, - this.title, - this.leading, - this.action, - }) : super(key: key); - - final String title; - final Widget leading; - final void Function() action; - - @override - Widget build(BuildContext context) => Flexible( - child: InkWell( - child: Card( - child: Container( - width: double.infinity, - padding: EdgeInsets.only(top: 15, bottom: 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - leading, - Text( - " " + title, - style: Theme.of(context).primaryTextTheme.bodyText2, - ), - ], - ), - ), - elevation: 1, - margin: EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8), - ), - onTap: action, - ), - ); -} diff --git a/LabelStoreMax/assets/icon/appicon.png b/LabelStoreMax/public/assets/app_icon/appicon.png similarity index 100% rename from LabelStoreMax/assets/icon/appicon.png rename to LabelStoreMax/public/assets/app_icon/appicon.png diff --git a/LabelStoreMax/public/assets/fonts/.gitkeep b/LabelStoreMax/public/assets/fonts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/LabelStoreMax/assets/images/camion.gif b/LabelStoreMax/public/assets/images/camion.gif similarity index 100% rename from LabelStoreMax/assets/images/camion.gif rename to LabelStoreMax/public/assets/images/camion.gif diff --git a/LabelStoreMax/assets/images/cash_on_delivery.jpeg b/LabelStoreMax/public/assets/images/cash_on_delivery.jpeg similarity index 100% rename from LabelStoreMax/assets/images/cash_on_delivery.jpeg rename to LabelStoreMax/public/assets/images/cash_on_delivery.jpeg diff --git a/LabelStoreMax/assets/images/credit_cards.png b/LabelStoreMax/public/assets/images/credit_cards.png similarity index 100% rename from LabelStoreMax/assets/images/credit_cards.png rename to LabelStoreMax/public/assets/images/credit_cards.png diff --git a/LabelStoreMax/assets/images/dark_powered_by_stripe.png b/LabelStoreMax/public/assets/images/dark_powered_by_stripe.png similarity index 100% rename from LabelStoreMax/assets/images/dark_powered_by_stripe.png rename to LabelStoreMax/public/assets/images/dark_powered_by_stripe.png diff --git a/LabelStoreMax/assets/images/razorpay.png b/LabelStoreMax/public/assets/images/razorpay.png similarity index 100% rename from LabelStoreMax/assets/images/razorpay.png rename to LabelStoreMax/public/assets/images/razorpay.png diff --git a/LabelStoreMax/assets/images/shipping_icon.png b/LabelStoreMax/public/assets/images/shipping_icon.png similarity index 100% rename from LabelStoreMax/assets/images/shipping_icon.png rename to LabelStoreMax/public/assets/images/shipping_icon.png diff --git a/LabelStoreMax/assets/default_shipping.json b/LabelStoreMax/public/assets/json/default_shipping.json similarity index 100% rename from LabelStoreMax/assets/default_shipping.json rename to LabelStoreMax/public/assets/json/default_shipping.json diff --git a/LabelStoreMax/pubspec.lock b/LabelStoreMax/pubspec.lock index 40ef181..fdfcac0 100644 --- a/LabelStoreMax/pubspec.lock +++ b/LabelStoreMax/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + adaptive_theme: + dependency: "direct main" + description: + name: adaptive_theme + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + analyzer: + dependency: "direct main" + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "0.38.5" archive: dependency: transitive description: @@ -42,14 +56,14 @@ packages: name: bubble_tab_indicator url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.1.6" cached_network_image: dependency: "direct main" description: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.5.1" characters: dependency: transitive description: @@ -105,7 +119,14 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.3" device_info: dependency: transitive description: @@ -161,14 +182,14 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.0" + version: "6.1.0" flare_dart: dependency: transitive description: @@ -208,6 +229,13 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted + version: "2.1.2" + flutter_dotenv: + dependency: transitive + description: + name: flutter_dotenv + url: "https://pub.dartlang.org" + source: hosted version: "2.1.0" flutter_launcher_icons: dependency: "direct main" @@ -235,13 +263,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.3" + flutter_secure_storage: + dependency: transitive + description: + name: flutter_secure_storage + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.5" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit url: "https://pub.dartlang.org" source: hosted - version: "4.1.2+1" + version: "5.0.0" flutter_staggered_grid_view: dependency: "direct main" description: @@ -267,19 +302,47 @@ packages: name: flutter_web_browser url: "https://pub.dartlang.org" source: hosted - version: "0.13.1" + version: "0.14.0" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" + front_end: + dependency: transitive + description: + name: front_end + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.27" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + grapheme_splitter: + dependency: transitive + description: + name: grapheme_splitter + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" hexcolor: dependency: "direct main" description: name: hexcolor url: "https://pub.dartlang.org" source: hosted - version: "1.0.6" + version: "2.0.3" html: dependency: "direct main" description: @@ -293,7 +356,7 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.1" + version: "0.12.2" http_parser: dependency: transitive description: @@ -322,6 +385,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.3" + json_ast: + dependency: transitive + description: + name: json_ast + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + json_to_dart: + dependency: transitive + description: + name: json_to_dart + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + kernel: + dependency: transitive + description: + name: kernel + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.27" + logger: + dependency: transitive + description: + name: logger + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.4" matcher: dependency: transitive description: @@ -335,7 +426,7 @@ packages: name: math_expressions url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.0" meta: dependency: transitive description: @@ -343,6 +434,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" + node_interop: + dependency: transitive + description: + name: node_interop + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + node_io: + dependency: transitive + description: + name: node_io + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + nylo_framework: + dependency: "direct main" + description: + name: nylo_framework + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0+1" octo_image: dependency: transitive description: @@ -350,13 +462,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.3.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" package_info: dependency: "direct main" description: name: package_info url: "https://pub.dartlang.org" source: hosted - version: "0.4.3+2" + version: "2.0.0" page_transition: dependency: "direct main" description: @@ -377,14 +496,14 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.24" + version: "1.6.27" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+1" + version: "0.0.1+2" path_provider_macos: dependency: transitive description: @@ -398,14 +517,14 @@ packages: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+1" + version: "0.0.5" pedantic: dependency: transitive description: @@ -419,14 +538,14 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.0.4" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" platform_alert_dialog: dependency: "direct main" description: @@ -447,7 +566,14 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.1.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" pull_to_refresh: dependency: "direct main" description: @@ -455,22 +581,29 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.4" + queue: + dependency: transitive + description: + name: queue + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.7+2" razorpay_flutter: dependency: "direct main" description: name: razorpay_flutter url: "https://pub.dartlang.org" source: hosted - version: "1.2.3" + version: "1.2.5" rxdart: dependency: transitive description: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.24.1" + version: "0.25.0" shared_preferences: - dependency: "direct main" + dependency: transitive description: name: shared_preferences url: "https://pub.dartlang.org" @@ -482,7 +615,7 @@ packages: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+2" + version: "0.0.2+4" shared_preferences_macos: dependency: transitive description: @@ -510,7 +643,7 @@ packages: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+1" + version: "0.0.2+3" sky_engine: dependency: transitive description: flutter @@ -529,14 +662,14 @@ packages: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "2.0.0+2" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "1.0.2+1" + version: "2.0.0+2" stack_trace: dependency: transitive description: @@ -571,7 +704,7 @@ packages: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "2.2.0+1" + version: "3.0.0" term_glyph: dependency: transitive description: @@ -600,48 +733,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - url: "https://pub.dartlang.org" - source: hosted - version: "5.7.10" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+1" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+7" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.9" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.5" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+1" uuid: dependency: transitive description: @@ -656,20 +747,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+15" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.3" + version: "2.0.3" woosignal: dependency: "direct main" description: name: woosignal url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.1+1" woosignal_stripe: dependency: "direct main" description: @@ -690,14 +788,14 @@ packages: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.1.2" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "4.5.1" + version: "4.2.0" yaml: dependency: transitive description: @@ -707,4 +805,4 @@ packages: version: "2.2.1" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.22.0" + flutter: ">=2.0.0" diff --git a/LabelStoreMax/pubspec.yaml b/LabelStoreMax/pubspec.yaml index bc38922..8f2f9cc 100644 --- a/LabelStoreMax/pubspec.yaml +++ b/LabelStoreMax/pubspec.yaml @@ -1,89 +1,97 @@ # Official WooSignal App Template for WooCommerce # Label StoreMax -# Version 3.0.0 +# Version: 4.0.0 +# Author: Anthony Gordon # Homepage: https://woosignal.com -# Author: Anthony Gordon # Documentation: https://woosignal.com/docs/app/ios/label-storemax ### Change App Icon -# 1 Replace: assets/icon/appicon.png (1024px1024px icon size) +# 1 Replace: public/assets/icon/appicon.png (1024px1024px icon size) # 2 Run this command from the terminal: "flutter pub run flutter_launcher_icons:main" ### Uploading the IOS/Android app # IOS https://flutter.dev/docs/deployment/ios # Android https://flutter.dev/docs/deployment/android -name: label_storemax -description: LabelStoreMAX +name: flutter_app +description: Label StoreMax + +publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 -publish_to: none - environment: sdk: ">=2.7.0 <3.0.0" dependencies: - woosignal: ^1.4.0 - woosignal_stripe: ^0.1.0 - razorpay_flutter: 1.2.3 - wp_json_api: ^2.0.0 - shared_preferences: ^0.5.12+4 - cached_network_image: ^2.5.0 + google_fonts: ^1.1.2 + analyzer: ^0.38.2 + adaptive_theme: ^1.1.0 + intl: ^0.17.0 page_transition: ^1.1.7+6 - package_info: ^0.4.3+2 - url_launcher: ^5.7.10 + nylo_framework: ^0.7.0+1 + woosignal: ^1.5.1+1 + woosignal_stripe: ^0.1.0 + razorpay_flutter: ^1.2.5 + wp_json_api: ^2.0.0 + cached_network_image: ^2.5.0 + package_info: ^2.0.0 flutter_money_formatter: ^0.8.3 platform_alert_dialog: ^1.0.0+2 - flutter_web_browser: ^0.13.1 + flutter_web_browser: ^0.14.0 pull_to_refresh: 1.6.4 - intl: ^0.17.0 flutter_swiper: ^1.1.6 edge_alert: ^0.0.1 bubble_tab_indicator: ^0.1.5 status_alert: ^0.1.3 - math_expressions: ^2.0.2 - hexcolor: ^1.0.6 - flutter_spinkit: ^4.1.2+1 + math_expressions: ^2.1.0 + hexcolor: ^2.0.3 + flutter_spinkit: ^5.0.0 flutter_launcher_icons: ^0.8.1 auto_size_text: ^2.1.0 html: ^0.14.0+4 flutter_staggered_grid_view: ^0.3.4 flutter: sdk: flutter - flutter_localizations: sdk: flutter - cupertino_icons: ^0.1.3 + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 dev_dependencies: flutter_application_id: "^1.0.0" flutter_test: sdk: flutter +# APP ICON flutter_icons: android: "launcher_icon" ios: true - image_path: "assets/icon/appicon.png" + image_path: "public/assets/app_icon/appicon.png" dependency_overrides: intl: ^0.17.0-nullsafety.2 flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: assets: - - assets/images/camion.gif - - assets/images/credit_cards.png - - assets/images/shipping_icon.png - - assets/images/dark_powered_by_stripe.png - - assets/images/cash_on_delivery.jpeg - - assets/images/razorpay.png - - assets/default_shipping.json + - public/assets/fonts/ + - public/assets/images/camion.gif + - public/assets/images/credit_cards.png + - public/assets/images/shipping_icon.png + - public/assets/images/dark_powered_by_stripe.png + - public/assets/images/cash_on_delivery.jpeg + - public/assets/images/razorpay.png + - public/assets/json/default_shipping.json - lang/en.json - lang/es.json - lang/fr.json @@ -91,8 +99,4 @@ flutter: - lang/de.json - lang/hi.json - lang/pt.json - - fonts: - - family: Overpass - fonts: - - asset: assets/fonts/Overpass/Overpass-Regular.ttf + - .env \ No newline at end of file diff --git a/README.md b/README.md index 311bcf7..d6f9a7d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@

WooSignal logo

- + # WooCommerce App: Label StoreMax -### Label StoreMax - v3.0.0 +### Label StoreMax - v4.0.0 [Official WooSignal WooCommerce App](https://woosignal.com) @@ -15,23 +15,46 @@ ![alt text](https://woosignal.com/images/woocommerce_app_preview_1.png "Full integration with WooCommerce") +![alt text](https://woosignal.com/images/mock_dark_light_mode.png "Dark and light mode shopping") + ### About Label StoreMax -Label StoreMax is a WooCommerce Flutter App template, built exclusively for online shopping and it offers a great variety of options to customise the look and feel of the App. Label StoreMax supports product views, multi-variation products, category searches + more. +Label StoreMax is an App Template for WooCommerce stores. Your customers will be able to browse products, make orders and login via WordPress. You can also customise the look and feel of the app in the WooSignal dashboard. -1. Supports the latest WooCommerce (3.5+) -2. [Documentation available](https://woosignal.com/docs/app/ios/label-storemax) +You can also upload the app to the IOS app store and Google play store using Flutter. + +### Requirements + +- WooCommerce Store 3.5+ +- Android Studio/VSCode (for running the app) +- Flutter installed + +### Getting Started + +1. Download/Clone this repository +2. Sign up for free on [WooSignal](https://woosignal.com) and link your WooCommerce store +3. Add your app key into the **.env** file and hit play (with Android Studio) to build the app 🥳 + +Full documentation this available [here](https://woosignal.com/docs/app/ios/label-storemax) ## Some features integrated - App Store Ready -- One config file -- Login/Register via WordPress +- Simple configuration +- Browse products, make orders, customer login (via WordPress) +- Change app name, logo, customize default language, currency + more +- Light and dark mode - Stripe, Cash On Delivery, RazorPay - Localized for en, es, pt, it, hi, fr +- Orders show as normal in WooCommerce ## Security Vulnerabilities If you discover a security vulnerability within WooSignal, please send an e-mail support@woosignal.com +## Uploading to the app stores + +- [IOS - Deployment](https://flutter.dev/docs/deployment/ios) +- [Android - Deployment](https://flutter.dev/docs/deployment/android) + ## Licence The Label StoreMax framework is open-sourced software licensed under the MIT license.