diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea78..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md deleted file mode 100644 index 48d5f81f..00000000 --- a/.github/ISSUE_TEMPLATE/custom.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Custom issue template -about: Describe this issue template's purpose here. -title: '' -labels: '' -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..739ce965 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,24 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "pub" + directory: "/" + schedule: + interval: "daily" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-minor", "version-update:semver-patch"] + + - package-ecosystem: "gradle" + directory: "android" + schedule: + interval: "daily" diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml deleted file mode 100644 index 6dfa1c94..00000000 --- a/.github/workflows/dart.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Dart CI - -on: push -# push: -# branches: [ master ] -# pull_request: -# branches: [ master ] - -env: - flutter_channel: 'stable' # or: 'dev' or 'beta' - flutter_version: '1.17.0' - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: subosito/flutter-action@v1 - with: - channel: ${{ env.flutter_channel }} - flutter-version: ${{ env.flutter_version }} - - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - - run: flutter pub get - working-directory: best_flutter_ui_templates - # - run: flutter test - - - name: build APK - run: flutter build apk - working-directory: best_flutter_ui_templates - - - name: upload APK - uses: actions/upload-artifact@v1 - with: - name: apk - path: best_flutter_ui_templates/build/app/outputs/apk/release/app-release.apk \ No newline at end of file diff --git a/.github/workflows/flutter_build.yml b/.github/workflows/flutter_build.yml new file mode 100644 index 00000000..83a57997 --- /dev/null +++ b/.github/workflows/flutter_build.yml @@ -0,0 +1,54 @@ +name: Flutter build + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + build_android: + name: Build for Android + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Flutter build appbundle + run: flutter build appbundle --release + + build_ios: + name: Build for iOS + runs-on: macos-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Pod install + run: | + cd ios + pod install + - name: Flutter build iOS + run: flutter build ios --release --no-codesign diff --git a/.github/workflows/flutter_checks.yml b/.github/workflows/flutter_checks.yml new file mode 100644 index 00000000..3a39c406 --- /dev/null +++ b/.github/workflows/flutter_checks.yml @@ -0,0 +1,97 @@ +name: Flutter checks + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + check_pub_dependencies: + name: Check dependencies + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + + pod_install: + name: Pod install + runs-on: macos-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Pod install + run: | + cd ios + pod install + + check_formatting: + name: Check formatting + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Check Dart formatting + run: dart format --line-length 80 --set-exit-if-changed . + + analyze: + name: Dart analyze + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Run Dart analyze + uses: invertase/github-action-dart-analyzer@v3.0.0 + + test: + name: Flutter test + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Install Flutter + uses: subosito/flutter-action@v2 + - name: Disable analytics + run: flutter config --no-analytics + - name: Flutter pub get + run: flutter pub get + - name: Flutter test + run: flutter test diff --git a/.gitignore b/.gitignore index 353fc521..ac57938d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,65 @@ -photos +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +# Exceptions to above rules. +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages + +# Fastlane related +ios/fastlane/.env +ios/fastlane/report.xml +android/fastlane/report.xml + +# Release related +ios/Runner.ipa +ios/Runner.app.dSYM.zip +android/app/release/app-release.aab + +# Other +ios/Flutter/flutter_export_environment.sh +local.properties +**/dgph +**/dgph~ diff --git a/.metadata b/.metadata new file mode 100644 index 00000000..8d5d37ee --- /dev/null +++ b/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: android + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md index ead3843b..f7515fec 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,7 @@ -# Best-Flutter-UI-Templates -completely free for everyone. Its build-in Flutter Dart. +# Flutter Templates +Completely free for everyone. +Built with Flutter. -![Image](best_flutter_ui_templates/assets/hotel/hotel_booking.png) -![Image](best_flutter_ui_templates/assets/fitness_app/fitness_app.png) -![Image](images/custom_drawer.png) -![Image](best_flutter_ui_templates/assets/design_course/design_course.png) - -### Some Screenshots - - +![Image](assets/hotel/hotel_booking.png) +![Image](assets/fitness_app/fitness_app.png) +![Image](assets/design_course/design_course.png) diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 00000000..24662462 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,5 @@ +include: package:flutter_lints/flutter.yaml + +analyzer: + errors: + todo: info diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 00000000..6f568019 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 00000000..e82b239f --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,58 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file("local.properties") +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader("UTF-8") { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") +if (flutterVersionCode == null) { + flutterVersionCode = "1" +} + +def flutterVersionName = localProperties.getProperty("flutter.versionName") +if (flutterVersionName == null) { + flutterVersionName = "1.0" +} + +android { + namespace = "com.example.templates" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.templates" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} diff --git a/best_flutter_ui_templates/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml similarity index 57% rename from best_flutter_ui_templates/android/app/src/debug/AndroidManifest.xml rename to android/app/src/debug/AndroidManifest.xml index 35caba39..399f6981 100644 --- a/best_flutter_ui_templates/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/best_flutter_ui_templates/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml similarity index 67% rename from best_flutter_ui_templates/android/app/src/main/AndroidManifest.xml rename to android/app/src/main/AndroidManifest.xml index c2f47da9..08d2455d 100644 --- a/best_flutter_ui_templates/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,17 +1,24 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/templates/MainActivity.kt b/android/app/src/main/kotlin/com/example/templates/MainActivity.kt new file mode 100644 index 00000000..475e6d81 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/templates/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.templates + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..ee0d04c7 Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..8351e14b Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..d43f9b57 Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..7691fb6c Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..9a5198e9 Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from best_flutter_ui_templates/android/app/src/main/res/drawable/launch_background.xml rename to android/app/src/main/res/drawable/launch_background.xml diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..5f349f7f --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..04c453d4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..cfc979ed Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..8f0b2c3f Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..18854319 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..9c5ebfc7 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values-night/styles.xml similarity index 80% rename from best_flutter_ui_templates/android/app/src/main/res/values/styles.xml rename to android/app/src/main/res/values-night/styles.xml index 1f83a33f..06952be7 100644 --- a/best_flutter_ui_templates/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values-night/styles.xml @@ -1,18 +1,18 @@ - + diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..ab983282 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #ffffff + \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..cb1ef880 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/best_flutter_ui_templates/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml similarity index 57% rename from best_flutter_ui_templates/android/app/src/profile/AndroidManifest.xml rename to android/app/src/profile/AndroidManifest.xml index 35caba39..399f6981 100644 --- a/best_flutter_ui_templates/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 00000000..d2ffbffa --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 00000000..3b5b324f --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/best_flutter_ui_templates/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties similarity index 79% rename from best_flutter_ui_templates/android/gradle/wrapper/gradle-wrapper.properties rename to android/gradle/wrapper/gradle-wrapper.properties index 296b146b..6e968fad 100644 --- a/best_flutter_ui_templates/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 00000000..969bf33f --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.4" apply false + id "org.jetbrains.kotlin.android" version "2.0.0" apply false +} + +include ":app" diff --git a/assets/design_course/design_course.png b/assets/design_course/design_course.png new file mode 100644 index 00000000..da3ace57 Binary files /dev/null and b/assets/design_course/design_course.png differ diff --git a/assets/design_course/interFace1.png b/assets/design_course/interFace1.png new file mode 100644 index 00000000..d2a43264 Binary files /dev/null and b/assets/design_course/interFace1.png differ diff --git a/assets/design_course/interFace2.png b/assets/design_course/interFace2.png new file mode 100644 index 00000000..c3589bda Binary files /dev/null and b/assets/design_course/interFace2.png differ diff --git a/assets/design_course/interFace3.png b/assets/design_course/interFace3.png new file mode 100644 index 00000000..a563eaf2 Binary files /dev/null and b/assets/design_course/interFace3.png differ diff --git a/assets/design_course/interFace4.png b/assets/design_course/interFace4.png new file mode 100644 index 00000000..b7c288ec Binary files /dev/null and b/assets/design_course/interFace4.png differ diff --git a/assets/design_course/userImage.png b/assets/design_course/userImage.png new file mode 100644 index 00000000..ef8abfee Binary files /dev/null and b/assets/design_course/userImage.png differ diff --git a/assets/design_course/webInterFace.png b/assets/design_course/webInterFace.png new file mode 100644 index 00000000..a867bb05 Binary files /dev/null and b/assets/design_course/webInterFace.png differ diff --git a/assets/fitness_app/area1.png b/assets/fitness_app/area1.png new file mode 100644 index 00000000..6e31898d Binary files /dev/null and b/assets/fitness_app/area1.png differ diff --git a/assets/fitness_app/area2.png b/assets/fitness_app/area2.png new file mode 100644 index 00000000..64166e3c Binary files /dev/null and b/assets/fitness_app/area2.png differ diff --git a/assets/fitness_app/area3.png b/assets/fitness_app/area3.png new file mode 100644 index 00000000..8e4c2141 Binary files /dev/null and b/assets/fitness_app/area3.png differ diff --git a/assets/fitness_app/back.png b/assets/fitness_app/back.png new file mode 100644 index 00000000..355373af Binary files /dev/null and b/assets/fitness_app/back.png differ diff --git a/assets/fitness_app/bell.png b/assets/fitness_app/bell.png new file mode 100644 index 00000000..71d14419 Binary files /dev/null and b/assets/fitness_app/bell.png differ diff --git a/assets/fitness_app/bottle.png b/assets/fitness_app/bottle.png new file mode 100644 index 00000000..e693dff5 Binary files /dev/null and b/assets/fitness_app/bottle.png differ diff --git a/assets/fitness_app/breakfast.png b/assets/fitness_app/breakfast.png new file mode 100644 index 00000000..9d98c8d7 Binary files /dev/null and b/assets/fitness_app/breakfast.png differ diff --git a/assets/fitness_app/burned.png b/assets/fitness_app/burned.png new file mode 100644 index 00000000..3a6e9649 Binary files /dev/null and b/assets/fitness_app/burned.png differ diff --git a/assets/fitness_app/dinner.png b/assets/fitness_app/dinner.png new file mode 100644 index 00000000..5ff489a5 Binary files /dev/null and b/assets/fitness_app/dinner.png differ diff --git a/assets/fitness_app/eaten.png b/assets/fitness_app/eaten.png new file mode 100644 index 00000000..b9061939 Binary files /dev/null and b/assets/fitness_app/eaten.png differ diff --git a/assets/fitness_app/fitness_app.png b/assets/fitness_app/fitness_app.png new file mode 100644 index 00000000..e57e6075 Binary files /dev/null and b/assets/fitness_app/fitness_app.png differ diff --git a/assets/fitness_app/glass.png b/assets/fitness_app/glass.png new file mode 100644 index 00000000..8ca885c9 Binary files /dev/null and b/assets/fitness_app/glass.png differ diff --git a/assets/fitness_app/lunch.png b/assets/fitness_app/lunch.png new file mode 100644 index 00000000..a4165431 Binary files /dev/null and b/assets/fitness_app/lunch.png differ diff --git a/assets/fitness_app/runner.png b/assets/fitness_app/runner.png new file mode 100644 index 00000000..788dd4cb Binary files /dev/null and b/assets/fitness_app/runner.png differ diff --git a/assets/fitness_app/snack.png b/assets/fitness_app/snack.png new file mode 100644 index 00000000..3320949a Binary files /dev/null and b/assets/fitness_app/snack.png differ diff --git a/assets/fitness_app/tab_1.png b/assets/fitness_app/tab_1.png new file mode 100644 index 00000000..315d0a22 Binary files /dev/null and b/assets/fitness_app/tab_1.png differ diff --git a/assets/fitness_app/tab_1s.png b/assets/fitness_app/tab_1s.png new file mode 100644 index 00000000..1f7036af Binary files /dev/null and b/assets/fitness_app/tab_1s.png differ diff --git a/assets/fitness_app/tab_2.png b/assets/fitness_app/tab_2.png new file mode 100644 index 00000000..8b8fd78b Binary files /dev/null and b/assets/fitness_app/tab_2.png differ diff --git a/assets/fitness_app/tab_2s.png b/assets/fitness_app/tab_2s.png new file mode 100644 index 00000000..9b98c84c Binary files /dev/null and b/assets/fitness_app/tab_2s.png differ diff --git a/assets/fitness_app/tab_3.png b/assets/fitness_app/tab_3.png new file mode 100644 index 00000000..c20c96cd Binary files /dev/null and b/assets/fitness_app/tab_3.png differ diff --git a/assets/fitness_app/tab_3s.png b/assets/fitness_app/tab_3s.png new file mode 100644 index 00000000..6afcdafe Binary files /dev/null and b/assets/fitness_app/tab_3s.png differ diff --git a/assets/fitness_app/tab_4.png b/assets/fitness_app/tab_4.png new file mode 100644 index 00000000..a38617b8 Binary files /dev/null and b/assets/fitness_app/tab_4.png differ diff --git a/assets/fitness_app/tab_4s.png b/assets/fitness_app/tab_4s.png new file mode 100644 index 00000000..e3c04f84 Binary files /dev/null and b/assets/fitness_app/tab_4s.png differ diff --git a/best_flutter_ui_templates/assets/fonts/Roboto-Bold.ttf b/assets/fonts/Roboto-Bold.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/Roboto-Bold.ttf rename to assets/fonts/Roboto-Bold.ttf diff --git a/best_flutter_ui_templates/assets/fonts/Roboto-Medium.ttf b/assets/fonts/Roboto-Medium.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/Roboto-Medium.ttf rename to assets/fonts/Roboto-Medium.ttf diff --git a/best_flutter_ui_templates/assets/fonts/Roboto-Regular.ttf b/assets/fonts/Roboto-Regular.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/Roboto-Regular.ttf rename to assets/fonts/Roboto-Regular.ttf diff --git a/best_flutter_ui_templates/assets/fonts/WorkSans-Bold.ttf b/assets/fonts/WorkSans-Bold.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/WorkSans-Bold.ttf rename to assets/fonts/WorkSans-Bold.ttf diff --git a/best_flutter_ui_templates/assets/fonts/WorkSans-Medium.ttf b/assets/fonts/WorkSans-Medium.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/WorkSans-Medium.ttf rename to assets/fonts/WorkSans-Medium.ttf diff --git a/best_flutter_ui_templates/assets/fonts/WorkSans-Regular.ttf b/assets/fonts/WorkSans-Regular.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/WorkSans-Regular.ttf rename to assets/fonts/WorkSans-Regular.ttf diff --git a/best_flutter_ui_templates/assets/fonts/WorkSans-SemiBold.ttf b/assets/fonts/WorkSans-SemiBold.ttf similarity index 100% rename from best_flutter_ui_templates/assets/fonts/WorkSans-SemiBold.ttf rename to assets/fonts/WorkSans-SemiBold.ttf diff --git a/assets/hotel/hotel_1.png b/assets/hotel/hotel_1.png new file mode 100644 index 00000000..c824c6cf Binary files /dev/null and b/assets/hotel/hotel_1.png differ diff --git a/assets/hotel/hotel_2.png b/assets/hotel/hotel_2.png new file mode 100644 index 00000000..778fcb5a Binary files /dev/null and b/assets/hotel/hotel_2.png differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_3.png b/assets/hotel/hotel_3.png similarity index 99% rename from best_flutter_ui_templates/assets/hotel/hotel_3.png rename to assets/hotel/hotel_3.png index d7a34aff..6609f870 100644 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_3.png and b/assets/hotel/hotel_3.png differ diff --git a/assets/hotel/hotel_4.png b/assets/hotel/hotel_4.png new file mode 100644 index 00000000..5a76a750 Binary files /dev/null and b/assets/hotel/hotel_4.png differ diff --git a/assets/hotel/hotel_5.png b/assets/hotel/hotel_5.png new file mode 100644 index 00000000..6beb1268 Binary files /dev/null and b/assets/hotel/hotel_5.png differ diff --git a/assets/hotel/hotel_booking.png b/assets/hotel/hotel_booking.png new file mode 100644 index 00000000..5fcddc2a Binary files /dev/null and b/assets/hotel/hotel_booking.png differ diff --git a/assets/images/feedbackImage.png b/assets/images/feedbackImage.png new file mode 100644 index 00000000..5b2c1a13 Binary files /dev/null and b/assets/images/feedbackImage.png differ diff --git a/assets/images/helpImage.png b/assets/images/helpImage.png new file mode 100644 index 00000000..12916bd2 Binary files /dev/null and b/assets/images/helpImage.png differ diff --git a/assets/images/inviteImage.png b/assets/images/inviteImage.png new file mode 100644 index 00000000..40b198b0 Binary files /dev/null and b/assets/images/inviteImage.png differ diff --git a/assets/images/supportIcon.png b/assets/images/supportIcon.png new file mode 100644 index 00000000..baaaf85a Binary files /dev/null and b/assets/images/supportIcon.png differ diff --git a/assets/images/userImage.png b/assets/images/userImage.png new file mode 100644 index 00000000..7b2d31d4 Binary files /dev/null and b/assets/images/userImage.png differ diff --git a/best_flutter_ui_templates/.gitignore b/best_flutter_ui_templates/.gitignore deleted file mode 100644 index 1ba9c339..00000000 --- a/best_flutter_ui_templates/.gitignore +++ /dev/null @@ -1,43 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Exceptions to above rules. -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/best_flutter_ui_templates/.metadata b/best_flutter_ui_templates/.metadata deleted file mode 100644 index 0c50e4f8..00000000 --- a/best_flutter_ui_templates/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: e6b34c2b5c96bb95325269a29a84e83ed8909b5f - channel: stable - -project_type: app diff --git a/best_flutter_ui_templates/README.md b/best_flutter_ui_templates/README.md deleted file mode 100644 index 02e26490..00000000 --- a/best_flutter_ui_templates/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# best_flutter_ui_templates - -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/best_flutter_ui_templates/android/.gitignore b/best_flutter_ui_templates/android/.gitignore deleted file mode 100644 index bc2100d8..00000000 --- a/best_flutter_ui_templates/android/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java diff --git a/best_flutter_ui_templates/android/app/build.gradle b/best_flutter_ui_templates/android/app/build.gradle deleted file mode 100644 index c917fead..00000000 --- a/best_flutter_ui_templates/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.best_flutter_ui_templates" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/best_flutter_ui_templates/android/app/src/main/kotlin/com/example/best_flutter_ui_templates/MainActivity.kt b/best_flutter_ui_templates/android/app/src/main/kotlin/com/example/best_flutter_ui_templates/MainActivity.kt deleted file mode 100644 index 663c7b3c..00000000 --- a/best_flutter_ui_templates/android/app/src/main/kotlin/com/example/best_flutter_ui_templates/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.best_flutter_ui_templates - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/best_flutter_ui_templates/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/best_flutter_ui_templates/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/best_flutter_ui_templates/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/best_flutter_ui_templates/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/best_flutter_ui_templates/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/best_flutter_ui_templates/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/best_flutter_ui_templates/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/best_flutter_ui_templates/android/build.gradle b/best_flutter_ui_templates/android/build.gradle deleted file mode 100644 index 3100ad2d..00000000 --- a/best_flutter_ui_templates/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/best_flutter_ui_templates/android/gradle.properties b/best_flutter_ui_templates/android/gradle.properties deleted file mode 100644 index 38c8d454..00000000 --- a/best_flutter_ui_templates/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/best_flutter_ui_templates/android/settings.gradle b/best_flutter_ui_templates/android/settings.gradle deleted file mode 100644 index 5a2f14fb..00000000 --- a/best_flutter_ui_templates/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/best_flutter_ui_templates/assets/design_course/design_course.png b/best_flutter_ui_templates/assets/design_course/design_course.png deleted file mode 100644 index 9bccb388..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/design_course.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/interFace1.png b/best_flutter_ui_templates/assets/design_course/interFace1.png deleted file mode 100644 index 72ef917d..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/interFace1.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/interFace2.png b/best_flutter_ui_templates/assets/design_course/interFace2.png deleted file mode 100644 index 4c1d4dca..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/interFace2.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/interFace3.png b/best_flutter_ui_templates/assets/design_course/interFace3.png deleted file mode 100644 index 81158462..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/interFace3.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/interFace4.png b/best_flutter_ui_templates/assets/design_course/interFace4.png deleted file mode 100644 index f22a7f4d..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/interFace4.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/userImage.png b/best_flutter_ui_templates/assets/design_course/userImage.png deleted file mode 100644 index 42b8c77a..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/userImage.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/design_course/webInterFace.png b/best_flutter_ui_templates/assets/design_course/webInterFace.png deleted file mode 100644 index 0e337c62..00000000 Binary files a/best_flutter_ui_templates/assets/design_course/webInterFace.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/area1.png b/best_flutter_ui_templates/assets/fitness_app/area1.png deleted file mode 100644 index 3d89330c..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/area1.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/area2.png b/best_flutter_ui_templates/assets/fitness_app/area2.png deleted file mode 100644 index 2be8b589..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/area2.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/area3.png b/best_flutter_ui_templates/assets/fitness_app/area3.png deleted file mode 100644 index 01c4ed02..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/area3.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/back.png b/best_flutter_ui_templates/assets/fitness_app/back.png deleted file mode 100644 index bbbde1ee..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/back.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/bell.png b/best_flutter_ui_templates/assets/fitness_app/bell.png deleted file mode 100644 index f18a1de1..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/bell.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/bottle.png b/best_flutter_ui_templates/assets/fitness_app/bottle.png deleted file mode 100644 index 5f09d99c..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/bottle.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/breakfast.png b/best_flutter_ui_templates/assets/fitness_app/breakfast.png deleted file mode 100644 index 1eb55e72..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/breakfast.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/burned.png b/best_flutter_ui_templates/assets/fitness_app/burned.png deleted file mode 100644 index 544e340a..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/burned.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/dinner.png b/best_flutter_ui_templates/assets/fitness_app/dinner.png deleted file mode 100644 index a56514c9..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/dinner.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/eaten.png b/best_flutter_ui_templates/assets/fitness_app/eaten.png deleted file mode 100644 index c007474d..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/eaten.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/fitness_app.png b/best_flutter_ui_templates/assets/fitness_app/fitness_app.png deleted file mode 100644 index a6028aaa..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/fitness_app.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/glass.png b/best_flutter_ui_templates/assets/fitness_app/glass.png deleted file mode 100644 index a7532317..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/glass.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/lunch.png b/best_flutter_ui_templates/assets/fitness_app/lunch.png deleted file mode 100644 index 425d41ce..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/lunch.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/runner.png b/best_flutter_ui_templates/assets/fitness_app/runner.png deleted file mode 100644 index 97d8c2a4..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/runner.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/snack.png b/best_flutter_ui_templates/assets/fitness_app/snack.png deleted file mode 100644 index c631a799..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/snack.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_1.png b/best_flutter_ui_templates/assets/fitness_app/tab_1.png deleted file mode 100644 index 326e74dc..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_1.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_1s.png b/best_flutter_ui_templates/assets/fitness_app/tab_1s.png deleted file mode 100644 index 379c825b..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_1s.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_2.png b/best_flutter_ui_templates/assets/fitness_app/tab_2.png deleted file mode 100644 index 512af6f4..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_2.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_2s.png b/best_flutter_ui_templates/assets/fitness_app/tab_2s.png deleted file mode 100644 index c83dfcf2..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_2s.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_3.png b/best_flutter_ui_templates/assets/fitness_app/tab_3.png deleted file mode 100644 index 189b573c..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_3.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_3s.png b/best_flutter_ui_templates/assets/fitness_app/tab_3s.png deleted file mode 100644 index fbe5731a..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_3s.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_4.png b/best_flutter_ui_templates/assets/fitness_app/tab_4.png deleted file mode 100644 index a483d7ce..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_4.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/fitness_app/tab_4s.png b/best_flutter_ui_templates/assets/fitness_app/tab_4s.png deleted file mode 100644 index abe020f5..00000000 Binary files a/best_flutter_ui_templates/assets/fitness_app/tab_4s.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_1.png b/best_flutter_ui_templates/assets/hotel/hotel_1.png deleted file mode 100644 index 4f2e2f65..00000000 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_1.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_2.png b/best_flutter_ui_templates/assets/hotel/hotel_2.png deleted file mode 100644 index 1dd62f5f..00000000 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_2.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_4.png b/best_flutter_ui_templates/assets/hotel/hotel_4.png deleted file mode 100644 index 15eb0d80..00000000 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_4.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_5.png b/best_flutter_ui_templates/assets/hotel/hotel_5.png deleted file mode 100644 index 163c6703..00000000 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_5.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/hotel/hotel_booking.png b/best_flutter_ui_templates/assets/hotel/hotel_booking.png deleted file mode 100644 index fdc76616..00000000 Binary files a/best_flutter_ui_templates/assets/hotel/hotel_booking.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/images/feedbackImage.png b/best_flutter_ui_templates/assets/images/feedbackImage.png deleted file mode 100644 index 6e06f851..00000000 Binary files a/best_flutter_ui_templates/assets/images/feedbackImage.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/images/helpImage.png b/best_flutter_ui_templates/assets/images/helpImage.png deleted file mode 100644 index 4e0ec4ce..00000000 Binary files a/best_flutter_ui_templates/assets/images/helpImage.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/images/inviteImage.png b/best_flutter_ui_templates/assets/images/inviteImage.png deleted file mode 100644 index 5ab808a7..00000000 Binary files a/best_flutter_ui_templates/assets/images/inviteImage.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/images/supportIcon.png b/best_flutter_ui_templates/assets/images/supportIcon.png deleted file mode 100644 index 5da2d66a..00000000 Binary files a/best_flutter_ui_templates/assets/images/supportIcon.png and /dev/null differ diff --git a/best_flutter_ui_templates/assets/images/userImage.png b/best_flutter_ui_templates/assets/images/userImage.png deleted file mode 100644 index 858def73..00000000 Binary files a/best_flutter_ui_templates/assets/images/userImage.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Flutter/Debug.xcconfig b/best_flutter_ui_templates/ios/Flutter/Debug.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/best_flutter_ui_templates/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/best_flutter_ui_templates/ios/Flutter/Release.xcconfig b/best_flutter_ui_templates/ios/Flutter/Release.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/best_flutter_ui_templates/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/best_flutter_ui_templates/lib/design_course/category_list_view.dart b/best_flutter_ui_templates/lib/design_course/category_list_view.dart deleted file mode 100644 index 76e753b8..00000000 --- a/best_flutter_ui_templates/lib/design_course/category_list_view.dart +++ /dev/null @@ -1,284 +0,0 @@ -import 'package:best_flutter_ui_templates/design_course/design_course_app_theme.dart'; -import 'package:best_flutter_ui_templates/design_course/models/category.dart'; -import 'package:best_flutter_ui_templates/main.dart'; -import 'package:flutter/material.dart'; - -class CategoryListView extends StatefulWidget { - const CategoryListView({Key key, this.callBack}) : super(key: key); - - final Function callBack; - @override - _CategoryListViewState createState() => _CategoryListViewState(); -} - -class _CategoryListViewState extends State - with TickerProviderStateMixin { - AnimationController animationController; - - @override - void initState() { - animationController = AnimationController( - duration: const Duration(milliseconds: 2000), vsync: this); - super.initState(); - } - - Future getData() async { - await Future.delayed(const Duration(milliseconds: 50)); - return true; - } - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 16, bottom: 16), - child: Container( - height: 134, - width: double.infinity, - child: FutureBuilder( - future: getData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return const SizedBox(); - } else { - return ListView.builder( - padding: const EdgeInsets.only( - top: 0, bottom: 0, right: 16, left: 16), - itemCount: Category.categoryList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (BuildContext context, int index) { - final int count = Category.categoryList.length > 10 - ? 10 - : Category.categoryList.length; - final Animation animation = - Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: animationController, - curve: Interval((1 / count) * index, 1.0, - curve: Curves.fastOutSlowIn))); - animationController.forward(); - - return CategoryView( - category: Category.categoryList[index], - animation: animation, - animationController: animationController, - callback: () { - widget.callBack(); - }, - ); - }, - ); - } - }, - ), - ), - ); - } -} - -class CategoryView extends StatelessWidget { - const CategoryView( - {Key key, - this.category, - this.animationController, - this.animation, - this.callback}) - : super(key: key); - - final VoidCallback callback; - final Category category; - final AnimationController animationController; - final Animation animation; - - @override - Widget build(BuildContext context) { - return AnimatedBuilder( - animation: animationController, - builder: (BuildContext context, Widget child) { - return FadeTransition( - opacity: animation, - child: Transform( - transform: Matrix4.translationValues( - 100 * (1.0 - animation.value), 0.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - onTap: () { - callback(); - }, - child: SizedBox( - width: 280, - child: Stack( - children: [ - Container( - child: Row( - children: [ - const SizedBox( - width: 48, - ), - Expanded( - child: Container( - decoration: BoxDecoration( - color: HexColor('#F8FAFB'), - borderRadius: const BorderRadius.all( - Radius.circular(16.0)), - ), - child: Row( - children: [ - const SizedBox( - width: 48 + 24.0, - ), - Expanded( - child: Container( - child: Column( - children: [ - Padding( - padding: - const EdgeInsets.only(top: 16), - child: Text( - category.title, - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16, - letterSpacing: 0.27, - color: DesignCourseAppTheme - .darkerText, - ), - ), - ), - const Expanded( - child: SizedBox(), - ), - Padding( - padding: const EdgeInsets.only( - right: 16, bottom: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - '${category.lessonCount} lesson', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 12, - letterSpacing: 0.27, - color: DesignCourseAppTheme - .grey, - ), - ), - Container( - child: Row( - children: [ - Text( - '${category.rating}', - textAlign: - TextAlign.left, - style: TextStyle( - fontWeight: - FontWeight.w200, - fontSize: 18, - letterSpacing: 0.27, - color: - DesignCourseAppTheme - .grey, - ), - ), - Icon( - Icons.star, - color: - DesignCourseAppTheme - .nearlyBlue, - size: 20, - ), - ], - ), - ) - ], - ), - ), - Padding( - padding: const EdgeInsets.only( - bottom: 16, right: 16), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '\$${category.money}', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 18, - letterSpacing: 0.27, - color: DesignCourseAppTheme - .nearlyBlue, - ), - ), - Container( - decoration: BoxDecoration( - color: DesignCourseAppTheme - .nearlyBlue, - borderRadius: - const BorderRadius.all( - Radius.circular( - 8.0)), - ), - child: Padding( - padding: - const EdgeInsets.all( - 4.0), - child: Icon( - Icons.add, - color: - DesignCourseAppTheme - .nearlyWhite, - ), - ), - ) - ], - ), - ), - ], - ), - ), - ), - ], - ), - ), - ) - ], - ), - ), - Container( - child: Padding( - padding: const EdgeInsets.only( - top: 24, bottom: 24, left: 16), - child: Row( - children: [ - ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(16.0)), - child: AspectRatio( - aspectRatio: 1.0, - child: Image.asset(category.imagePath)), - ) - ], - ), - ), - ), - ], - ), - ), - ), - ), - ); - }, - ); - } -} diff --git a/best_flutter_ui_templates/lib/design_course/course_info_screen.dart b/best_flutter_ui_templates/lib/design_course/course_info_screen.dart deleted file mode 100644 index 25f702ac..00000000 --- a/best_flutter_ui_templates/lib/design_course/course_info_screen.dart +++ /dev/null @@ -1,364 +0,0 @@ -import 'package:flutter/material.dart'; -import 'design_course_app_theme.dart'; - -class CourseInfoScreen extends StatefulWidget { - @override - _CourseInfoScreenState createState() => _CourseInfoScreenState(); -} - -class _CourseInfoScreenState extends State - with TickerProviderStateMixin { - final double infoHeight = 364.0; - AnimationController animationController; - Animation animation; - double opacity1 = 0.0; - double opacity2 = 0.0; - double opacity3 = 0.0; - @override - void initState() { - animationController = AnimationController( - duration: const Duration(milliseconds: 1000), vsync: this); - animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( - parent: animationController, - curve: Interval(0, 1.0, curve: Curves.fastOutSlowIn))); - setData(); - super.initState(); - } - - Future setData() async { - animationController.forward(); - await Future.delayed(const Duration(milliseconds: 200)); - setState(() { - opacity1 = 1.0; - }); - await Future.delayed(const Duration(milliseconds: 200)); - setState(() { - opacity2 = 1.0; - }); - await Future.delayed(const Duration(milliseconds: 200)); - setState(() { - opacity3 = 1.0; - }); - } - - @override - Widget build(BuildContext context) { - final double tempHeight = MediaQuery.of(context).size.height - - (MediaQuery.of(context).size.width / 1.2) + - 24.0; - return Container( - color: DesignCourseAppTheme.nearlyWhite, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Stack( - children: [ - Column( - children: [ - AspectRatio( - aspectRatio: 1.2, - child: Image.asset('assets/design_course/webInterFace.png'), - ), - ], - ), - Positioned( - top: (MediaQuery.of(context).size.width / 1.2) - 24.0, - bottom: 0, - left: 0, - right: 0, - child: Container( - decoration: BoxDecoration( - color: DesignCourseAppTheme.nearlyWhite, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(32.0), - topRight: Radius.circular(32.0)), - boxShadow: [ - BoxShadow( - color: DesignCourseAppTheme.grey.withOpacity(0.2), - offset: const Offset(1.1, 1.1), - blurRadius: 10.0), - ], - ), - child: Padding( - padding: const EdgeInsets.only(left: 8, right: 8), - child: SingleChildScrollView( - child: Container( - constraints: BoxConstraints( - minHeight: infoHeight, - maxHeight: tempHeight > infoHeight - ? tempHeight - : infoHeight), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only( - top: 32.0, left: 18, right: 16), - child: Text( - 'Web Design\nCourse', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 22, - letterSpacing: 0.27, - color: DesignCourseAppTheme.darkerText, - ), - ), - ), - Padding( - padding: const EdgeInsets.only( - left: 16, right: 16, bottom: 8, top: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - '\$28.99', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 22, - letterSpacing: 0.27, - color: DesignCourseAppTheme.nearlyBlue, - ), - ), - Container( - child: Row( - children: [ - Text( - '4.3', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 22, - letterSpacing: 0.27, - color: DesignCourseAppTheme.grey, - ), - ), - Icon( - Icons.star, - color: DesignCourseAppTheme.nearlyBlue, - size: 24, - ), - ], - ), - ) - ], - ), - ), - AnimatedOpacity( - duration: const Duration(milliseconds: 500), - opacity: opacity1, - child: Padding( - padding: const EdgeInsets.all(8), - child: Row( - children: [ - getTimeBoxUI('24', 'Classe'), - getTimeBoxUI('2hours', 'Time'), - getTimeBoxUI('24', 'Seat'), - ], - ), - ), - ), - Expanded( - child: AnimatedOpacity( - duration: const Duration(milliseconds: 500), - opacity: opacity2, - child: Padding( - padding: const EdgeInsets.only( - left: 16, right: 16, top: 8, bottom: 8), - child: Text( - 'Lorem ipsum is simply dummy text of printing & typesetting industry, Lorem ipsum is simply dummy text of printing & typesetting industry.', - textAlign: TextAlign.justify, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 14, - letterSpacing: 0.27, - color: DesignCourseAppTheme.grey, - ), - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), - ), - ), - ), - AnimatedOpacity( - duration: const Duration(milliseconds: 500), - opacity: opacity3, - child: Padding( - padding: const EdgeInsets.only( - left: 16, bottom: 16, right: 16), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 48, - height: 48, - child: Container( - decoration: BoxDecoration( - color: DesignCourseAppTheme.nearlyWhite, - borderRadius: const BorderRadius.all( - Radius.circular(16.0), - ), - border: Border.all( - color: DesignCourseAppTheme.grey - .withOpacity(0.2)), - ), - child: Icon( - Icons.add, - color: DesignCourseAppTheme.nearlyBlue, - size: 28, - ), - ), - ), - const SizedBox( - width: 16, - ), - Expanded( - child: Container( - height: 48, - decoration: BoxDecoration( - color: DesignCourseAppTheme.nearlyBlue, - borderRadius: const BorderRadius.all( - Radius.circular(16.0), - ), - boxShadow: [ - BoxShadow( - color: DesignCourseAppTheme - .nearlyBlue - .withOpacity(0.5), - offset: const Offset(1.1, 1.1), - blurRadius: 10.0), - ], - ), - child: Center( - child: Text( - 'Join Course', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 18, - letterSpacing: 0.0, - color: DesignCourseAppTheme - .nearlyWhite, - ), - ), - ), - ), - ) - ], - ), - ), - ), - SizedBox( - height: MediaQuery.of(context).padding.bottom, - ) - ], - ), - ), - ), - ), - ), - ), - Positioned( - top: (MediaQuery.of(context).size.width / 1.2) - 24.0 - 35, - right: 35, - child: ScaleTransition( - alignment: Alignment.center, - scale: CurvedAnimation( - parent: animationController, curve: Curves.fastOutSlowIn), - child: Card( - color: DesignCourseAppTheme.nearlyBlue, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(50.0)), - elevation: 10.0, - child: Container( - width: 60, - height: 60, - child: Center( - child: Icon( - Icons.favorite, - color: DesignCourseAppTheme.nearlyWhite, - size: 30, - ), - ), - ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: SizedBox( - width: AppBar().preferredSize.height, - height: AppBar().preferredSize.height, - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: - BorderRadius.circular(AppBar().preferredSize.height), - child: Icon( - Icons.arrow_back_ios, - color: DesignCourseAppTheme.nearlyBlack, - ), - onTap: () { - Navigator.pop(context); - }, - ), - ), - ), - ) - ], - ), - ), - ); - } - - Widget getTimeBoxUI(String text1, String txt2) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - decoration: BoxDecoration( - color: DesignCourseAppTheme.nearlyWhite, - borderRadius: const BorderRadius.all(Radius.circular(16.0)), - boxShadow: [ - BoxShadow( - color: DesignCourseAppTheme.grey.withOpacity(0.2), - offset: const Offset(1.1, 1.1), - blurRadius: 8.0), - ], - ), - child: Padding( - padding: const EdgeInsets.only( - left: 18.0, right: 18.0, top: 12.0, bottom: 12.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - text1, - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 14, - letterSpacing: 0.27, - color: DesignCourseAppTheme.nearlyBlue, - ), - ), - Text( - txt2, - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 14, - letterSpacing: 0.27, - color: DesignCourseAppTheme.grey, - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/best_flutter_ui_templates/lib/design_course/popular_course_list_view.dart b/best_flutter_ui_templates/lib/design_course/popular_course_list_view.dart deleted file mode 100644 index 8c8ecb53..00000000 --- a/best_flutter_ui_templates/lib/design_course/popular_course_list_view.dart +++ /dev/null @@ -1,253 +0,0 @@ -import 'package:best_flutter_ui_templates/design_course/design_course_app_theme.dart'; -import 'package:best_flutter_ui_templates/design_course/models/category.dart'; -import 'package:best_flutter_ui_templates/main.dart'; -import 'package:flutter/material.dart'; - -class PopularCourseListView extends StatefulWidget { - const PopularCourseListView({Key key, this.callBack}) : super(key: key); - - final Function callBack; - @override - _PopularCourseListViewState createState() => _PopularCourseListViewState(); -} - -class _PopularCourseListViewState extends State - with TickerProviderStateMixin { - AnimationController animationController; - @override - void initState() { - animationController = AnimationController( - duration: const Duration(milliseconds: 2000), vsync: this); - super.initState(); - } - - Future getData() async { - await Future.delayed(const Duration(milliseconds: 200)); - return true; - } - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.only(top: 8), - child: FutureBuilder( - future: getData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return const SizedBox(); - } else { - return GridView( - padding: const EdgeInsets.all(8), - physics: const BouncingScrollPhysics(), - scrollDirection: Axis.vertical, - children: List.generate( - Category.popularCourseList.length, - (int index) { - final int count = Category.popularCourseList.length; - final Animation animation = - Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: animationController, - curve: Interval((1 / count) * index, 1.0, - curve: Curves.fastOutSlowIn), - ), - ); - animationController.forward(); - return CategoryView( - callback: () { - widget.callBack(); - }, - category: Category.popularCourseList[index], - animation: animation, - animationController: animationController, - ); - }, - ), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: 32.0, - crossAxisSpacing: 32.0, - childAspectRatio: 0.8, - ), - ); - } - }, - ), - ); - } -} - -class CategoryView extends StatelessWidget { - const CategoryView( - {Key key, - this.category, - this.animationController, - this.animation, - this.callback}) - : super(key: key); - - final VoidCallback callback; - final Category category; - final AnimationController animationController; - final Animation animation; - - @override - Widget build(BuildContext context) { - return AnimatedBuilder( - animation: animationController, - builder: (BuildContext context, Widget child) { - return FadeTransition( - opacity: animation, - child: Transform( - transform: Matrix4.translationValues( - 0.0, 50 * (1.0 - animation.value), 0.0), - child: InkWell( - splashColor: Colors.transparent, - onTap: () { - callback(); - }, - child: SizedBox( - height: 280, - child: Stack( - alignment: AlignmentDirectional.bottomCenter, - children: [ - Container( - child: Column( - children: [ - Expanded( - child: Container( - decoration: BoxDecoration( - color: HexColor('#F8FAFB'), - borderRadius: const BorderRadius.all( - Radius.circular(16.0)), - // border: new Border.all( - // color: DesignCourseAppTheme.notWhite), - ), - child: Column( - children: [ - Expanded( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only( - top: 16, left: 16, right: 16), - child: Text( - category.title, - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16, - letterSpacing: 0.27, - color: DesignCourseAppTheme - .darkerText, - ), - ), - ), - Padding( - padding: const EdgeInsets.only( - top: 8, - left: 16, - right: 16, - bottom: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - '${category.lessonCount} lesson', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w200, - fontSize: 12, - letterSpacing: 0.27, - color: DesignCourseAppTheme - .grey, - ), - ), - Container( - child: Row( - children: [ - Text( - '${category.rating}', - textAlign: - TextAlign.left, - style: TextStyle( - fontWeight: - FontWeight.w200, - fontSize: 18, - letterSpacing: 0.27, - color: - DesignCourseAppTheme - .grey, - ), - ), - Icon( - Icons.star, - color: - DesignCourseAppTheme - .nearlyBlue, - size: 20, - ), - ], - ), - ) - ], - ), - ), - ], - ), - ), - ), - const SizedBox( - width: 48, - ), - ], - ), - ), - ), - const SizedBox( - height: 48, - ), - ], - ), - ), - Container( - child: Padding( - padding: - const EdgeInsets.only(top: 24, right: 16, left: 16), - child: Container( - decoration: BoxDecoration( - borderRadius: - const BorderRadius.all(Radius.circular(16.0)), - boxShadow: [ - BoxShadow( - color: DesignCourseAppTheme.grey - .withOpacity(0.2), - offset: const Offset(0.0, 0.0), - blurRadius: 6.0), - ], - ), - child: ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(16.0)), - child: AspectRatio( - aspectRatio: 1.28, - child: Image.asset(category.imagePath)), - ), - ), - ), - ), - ], - ), - ), - ), - ), - ); - }, - ); - } -} diff --git a/best_flutter_ui_templates/lib/feedback_screen.dart b/best_flutter_ui_templates/lib/feedback_screen.dart deleted file mode 100644 index 5c310def..00000000 --- a/best_flutter_ui_templates/lib/feedback_screen.dart +++ /dev/null @@ -1,147 +0,0 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:flutter/material.dart'; - -class FeedbackScreen extends StatefulWidget { - @override - _FeedbackScreenState createState() => _FeedbackScreenState(); -} - -class _FeedbackScreenState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: AppTheme.nearlyWhite, - child: SafeArea( - top: false, - child: Scaffold( - backgroundColor: AppTheme.nearlyWhite, - body: SingleChildScrollView( - child: SizedBox( - height: MediaQuery.of(context).size.height, - child: Column( - children: [ - Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).padding.top, - left: 16, - right: 16), - child: Image.asset('assets/images/feedbackImage.png'), - ), - Container( - padding: const EdgeInsets.only(top: 8), - child: Text( - 'Your FeedBack', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - padding: const EdgeInsets.only(top: 16), - child: const Text( - 'Give your best time for this moment.', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - ), - ), - ), - _buildComposer(), - Padding( - padding: const EdgeInsets.only(top: 16), - child: Center( - child: Container( - width: 120, - height: 40, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: - const BorderRadius.all(Radius.circular(4.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - offset: const Offset(4, 4), - blurRadius: 8.0), - ], - ), - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Text( - 'Send', - style: TextStyle( - fontWeight: FontWeight.w500, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ), - ), - ) - ], - ), - ), - ), - ), - ), - ); - } - - Widget _buildComposer() { - return Padding( - padding: const EdgeInsets.only(top: 16, left: 32, right: 32), - child: Container( - decoration: BoxDecoration( - color: AppTheme.white, - borderRadius: BorderRadius.circular(8), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.8), - offset: const Offset(4, 4), - blurRadius: 8), - ], - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(25), - child: Container( - padding: const EdgeInsets.all(4.0), - constraints: const BoxConstraints(minHeight: 80, maxHeight: 160), - color: AppTheme.white, - child: SingleChildScrollView( - padding: - const EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 0), - child: TextField( - maxLines: null, - onChanged: (String txt) {}, - style: TextStyle( - fontFamily: AppTheme.fontName, - fontSize: 16, - color: AppTheme.dark_grey, - ), - cursorColor: Colors.blue, - decoration: InputDecoration( - border: InputBorder.none, - hintText: 'Enter your feedback...'), - ), - ), - ), - ), - ), - ); - } -} diff --git a/best_flutter_ui_templates/lib/fitness_app/fitness_app_home_screen.dart b/best_flutter_ui_templates/lib/fitness_app/fitness_app_home_screen.dart deleted file mode 100644 index b9a8c9a2..00000000 --- a/best_flutter_ui_templates/lib/fitness_app/fitness_app_home_screen.dart +++ /dev/null @@ -1,108 +0,0 @@ -import 'package:best_flutter_ui_templates/fitness_app/models/tabIcon_data.dart'; -import 'package:best_flutter_ui_templates/fitness_app/traning/training_screen.dart'; -import 'package:flutter/material.dart'; -import 'bottom_navigation_view/bottom_bar_view.dart'; -import 'fintness_app_theme.dart'; -import 'my_diary/my_diary_screen.dart'; - -class FitnessAppHomeScreen extends StatefulWidget { - @override - _FitnessAppHomeScreenState createState() => _FitnessAppHomeScreenState(); -} - -class _FitnessAppHomeScreenState extends State - with TickerProviderStateMixin { - AnimationController animationController; - - List tabIconsList = TabIconData.tabIconsList; - - Widget tabBody = Container( - color: FintnessAppTheme.background, - ); - - @override - void initState() { - tabIconsList.forEach((TabIconData tab) { - tab.isSelected = false; - }); - tabIconsList[0].isSelected = true; - - animationController = AnimationController( - duration: const Duration(milliseconds: 600), vsync: this); - tabBody = MyDiaryScreen(animationController: animationController); - super.initState(); - } - - @override - void dispose() { - animationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: FintnessAppTheme.background, - child: Scaffold( - backgroundColor: Colors.transparent, - body: FutureBuilder( - future: getData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return const SizedBox(); - } else { - return Stack( - children: [ - tabBody, - bottomBar(), - ], - ); - } - }, - ), - ), - ); - } - - Future getData() async { - await Future.delayed(const Duration(milliseconds: 200)); - return true; - } - - Widget bottomBar() { - return Column( - children: [ - const Expanded( - child: SizedBox(), - ), - BottomBarView( - tabIconsList: tabIconsList, - addClick: () {}, - changeIndex: (int index) { - if (index == 0 || index == 2) { - animationController.reverse().then((data) { - if (!mounted) { - return; - } - setState(() { - tabBody = - MyDiaryScreen(animationController: animationController); - }); - }); - } else if (index == 1 || index == 3) { - animationController.reverse().then((data) { - if (!mounted) { - return; - } - setState(() { - tabBody = - TrainingScreen(animationController: animationController); - }); - }); - } - }, - ), - ], - ); - } -} diff --git a/best_flutter_ui_templates/lib/help_screen.dart b/best_flutter_ui_templates/lib/help_screen.dart deleted file mode 100644 index ebff259b..00000000 --- a/best_flutter_ui_templates/lib/help_screen.dart +++ /dev/null @@ -1,98 +0,0 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:flutter/material.dart'; - -class HelpScreen extends StatefulWidget { - @override - _HelpScreenState createState() => _HelpScreenState(); -} - -class _HelpScreenState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: AppTheme.nearlyWhite, - child: SafeArea( - top: false, - child: Scaffold( - backgroundColor: AppTheme.nearlyWhite, - body: Column( - children: [ - Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).padding.top, - left: 16, - right: 16), - child: Image.asset('assets/images/helpImage.png'), - ), - Container( - padding: const EdgeInsets.only(top: 8), - child: Text( - 'How can we help you?', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - padding: const EdgeInsets.only(top: 16), - child: const Text( - 'It looks like you are experiencing problems\nwith our sign up process. We are here to\nhelp so please get in touch with us', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - ), - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Container( - width: 140, - height: 40, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: - const BorderRadius.all(Radius.circular(4.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - offset: const Offset(4, 4), - blurRadius: 8.0), - ], - ), - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () {}, - child: Center( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Text( - 'Chat with Us', - style: TextStyle( - fontWeight: FontWeight.w500, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ), - ), - ), - ) - ], - ), - ), - ), - ); - } -} diff --git a/best_flutter_ui_templates/lib/home_screen.dart b/best_flutter_ui_templates/lib/home_screen.dart deleted file mode 100644 index 8e0a5a96..00000000 --- a/best_flutter_ui_templates/lib/home_screen.dart +++ /dev/null @@ -1,228 +0,0 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:flutter/material.dart'; -import 'model/homelist.dart'; - -class MyHomePage extends StatefulWidget { - const MyHomePage({Key key}) : super(key: key); - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State with TickerProviderStateMixin { - List homeList = HomeList.homeList; - AnimationController animationController; - bool multiple = true; - - @override - void initState() { - animationController = AnimationController( - duration: const Duration(milliseconds: 2000), vsync: this); - super.initState(); - } - - Future getData() async { - await Future.delayed(const Duration(milliseconds: 0)); - return true; - } - - @override - void dispose() { - animationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppTheme.white, - body: FutureBuilder( - future: getData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return const SizedBox(); - } else { - return Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - appBar(), - Expanded( - child: FutureBuilder( - future: getData(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return const SizedBox(); - } else { - return GridView( - padding: const EdgeInsets.only( - top: 0, left: 12, right: 12), - physics: const BouncingScrollPhysics(), - scrollDirection: Axis.vertical, - children: List.generate( - homeList.length, - (int index) { - final int count = homeList.length; - final Animation animation = - Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: animationController, - curve: Interval((1 / count) * index, 1.0, - curve: Curves.fastOutSlowIn), - ), - ); - animationController.forward(); - return HomeListView( - animation: animation, - animationController: animationController, - listData: homeList[index], - callBack: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - homeList[index].navigateScreen, - ), - ); - }, - ); - }, - ), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: multiple ? 2 : 1, - mainAxisSpacing: 12.0, - crossAxisSpacing: 12.0, - childAspectRatio: 1.5, - ), - ); - } - }, - ), - ), - ], - ), - ); - } - }, - ), - ); - } - - Widget appBar() { - return SizedBox( - height: AppBar().preferredSize.height, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.only(top: 8, left: 8), - child: Container( - width: AppBar().preferredSize.height - 8, - height: AppBar().preferredSize.height - 8, - ), - ), - Expanded( - child: Center( - child: Padding( - padding: const EdgeInsets.only(top: 4), - child: Text( - 'Flutter UI', - style: TextStyle( - fontSize: 22, - color: AppTheme.darkText, - fontWeight: FontWeight.w700, - ), - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 8, right: 8), - child: Container( - width: AppBar().preferredSize.height - 8, - height: AppBar().preferredSize.height - 8, - color: Colors.white, - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: - BorderRadius.circular(AppBar().preferredSize.height), - child: Icon( - multiple ? Icons.dashboard : Icons.view_agenda, - color: AppTheme.dark_grey, - ), - onTap: () { - setState(() { - multiple = !multiple; - }); - }, - ), - ), - ), - ), - ], - ), - ); - } -} - -class HomeListView extends StatelessWidget { - const HomeListView( - {Key key, - this.listData, - this.callBack, - this.animationController, - this.animation}) - : super(key: key); - - final HomeList listData; - final VoidCallback callBack; - final AnimationController animationController; - final Animation animation; - - @override - Widget build(BuildContext context) { - return AnimatedBuilder( - animation: animationController, - builder: (BuildContext context, Widget child) { - return FadeTransition( - opacity: animation, - child: Transform( - transform: Matrix4.translationValues( - 0.0, 50 * (1.0 - animation.value), 0.0), - child: AspectRatio( - aspectRatio: 1.5, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(4.0)), - child: Stack( - alignment: AlignmentDirectional.center, - children: [ - Image.asset( - listData.imagePath, - fit: BoxFit.cover, - ), - Material( - color: Colors.transparent, - child: InkWell( - splashColor: Colors.grey.withOpacity(0.2), - borderRadius: - const BorderRadius.all(Radius.circular(4.0)), - onTap: () { - callBack(); - }, - ), - ), - ], - ), - ), - ), - ), - ); - }, - ); - } -} diff --git a/best_flutter_ui_templates/lib/hotel_booking/calendar_popup_view.dart b/best_flutter_ui_templates/lib/hotel_booking/calendar_popup_view.dart deleted file mode 100644 index c8922f42..00000000 --- a/best_flutter_ui_templates/lib/hotel_booking/calendar_popup_view.dart +++ /dev/null @@ -1,249 +0,0 @@ -import 'dart:ui'; - -import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; - -import 'custom_calendar.dart'; - -class CalendarPopupView extends StatefulWidget { - const CalendarPopupView( - {Key key, - this.initialStartDate, - this.initialEndDate, - this.onApplyClick, - this.onCancelClick, - this.barrierDismissible = true, - this.minimumDate, - this.maximumDate}) - : super(key: key); - - final DateTime minimumDate; - final DateTime maximumDate; - final bool barrierDismissible; - final DateTime initialStartDate; - final DateTime initialEndDate; - final Function(DateTime, DateTime) onApplyClick; - - final Function onCancelClick; - @override - _CalendarPopupViewState createState() => _CalendarPopupViewState(); -} - -class _CalendarPopupViewState extends State - with TickerProviderStateMixin { - AnimationController animationController; - DateTime startDate; - DateTime endDate; - - @override - void initState() { - animationController = AnimationController( - duration: const Duration(milliseconds: 400), vsync: this); - if (widget.initialStartDate != null) { - startDate = widget.initialStartDate; - } - if (widget.initialEndDate != null) { - endDate = widget.initialEndDate; - } - animationController.forward(); - super.initState(); - } - - @override - void dispose() { - animationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Center( - child: Scaffold( - backgroundColor: Colors.transparent, - body: AnimatedBuilder( - animation: animationController, - builder: (BuildContext context, Widget child) { - return AnimatedOpacity( - duration: const Duration(milliseconds: 100), - opacity: animationController.value, - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent, - onTap: () { - if (widget.barrierDismissible) { - Navigator.pop(context); - } - }, - child: Center( - child: Padding( - padding: const EdgeInsets.all(24.0), - child: Container( - decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - offset: const Offset(4, 4), - blurRadius: 8.0), - ], - ), - child: InkWell( - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - onTap: () {}, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - 'From', - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 16, - color: - Colors.grey.withOpacity(0.8)), - ), - const SizedBox( - height: 4, - ), - Text( - startDate != null - ? DateFormat('EEE, dd MMM') - .format(startDate) - : '--/-- ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - ], - ), - ), - Container( - height: 74, - width: 1, - color: HotelAppTheme.buildLightTheme() - .dividerColor, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - 'To', - style: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 16, - color: - Colors.grey.withOpacity(0.8)), - ), - const SizedBox( - height: 4, - ), - Text( - endDate != null - ? DateFormat('EEE, dd MMM') - .format(endDate) - : '--/-- ', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16), - ), - ], - ), - ) - ], - ), - const Divider( - height: 1, - ), - CustomCalendarView( - minimumDate: widget.minimumDate, - maximumDate: widget.maximumDate, - initialEndDate: widget.initialEndDate, - initialStartDate: widget.initialStartDate, - startEndDateChange: (DateTime startDateData, - DateTime endDateData) { - setState(() { - startDate = startDateData; - endDate = endDateData; - }); - }, - ), - Padding( - padding: const EdgeInsets.only( - left: 16, right: 16, bottom: 16, top: 8), - child: Container( - height: 48, - decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme() - .primaryColor, - borderRadius: const BorderRadius.all( - Radius.circular(24.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - blurRadius: 8, - offset: const Offset(4, 4), - ), - ], - ), - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: const BorderRadius.all( - Radius.circular(24.0)), - highlightColor: Colors.transparent, - onTap: () { - try { - // animationController.reverse().then((f) { - - // }); - widget.onApplyClick(startDate, endDate); - Navigator.pop(context); - } catch (_) {} - }, - child: Center( - child: Text( - 'Apply', - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: 18, - color: Colors.white), - ), - ), - ), - ), - ), - ) - ], - ), - ), - ), - ), - ), - ), - ); - }, - ), - ), - ); - } -} diff --git a/best_flutter_ui_templates/lib/hotel_booking/custom_calendar.dart b/best_flutter_ui_templates/lib/hotel_booking/custom_calendar.dart deleted file mode 100644 index 6c2ac1ba..00000000 --- a/best_flutter_ui_templates/lib/hotel_booking/custom_calendar.dart +++ /dev/null @@ -1,455 +0,0 @@ -import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; - -class CustomCalendarView extends StatefulWidget { - const CustomCalendarView( - {Key key, - this.initialStartDate, - this.initialEndDate, - this.startEndDateChange, - this.minimumDate, - this.maximumDate}) - : super(key: key); - - final DateTime minimumDate; - final DateTime maximumDate; - final DateTime initialStartDate; - final DateTime initialEndDate; - - final Function(DateTime, DateTime) startEndDateChange; - - @override - _CustomCalendarViewState createState() => _CustomCalendarViewState(); -} - -class _CustomCalendarViewState extends State { - List dateList = []; - DateTime currentMonthDate = DateTime.now(); - DateTime startDate; - DateTime endDate; - - @override - void initState() { - setListOfDate(currentMonthDate); - if (widget.initialStartDate != null) { - startDate = widget.initialStartDate; - } - if (widget.initialEndDate != null) { - endDate = widget.initialEndDate; - } - super.initState(); - } - - @override - void dispose() { - super.dispose(); - } - - void setListOfDate(DateTime monthDate) { - dateList.clear(); - final DateTime newDate = DateTime(monthDate.year, monthDate.month, 0); - int previousMothDay = 0; - if (newDate.weekday < 7) { - previousMothDay = newDate.weekday; - for (int i = 1; i <= previousMothDay; i++) { - dateList.add(newDate.subtract(Duration(days: previousMothDay - i))); - } - } - for (int i = 0; i < (42 - previousMothDay); i++) { - dateList.add(newDate.add(Duration(days: i + 1))); - } - // if (dateList[dateList.length - 7].month != monthDate.month) { - // dateList.removeRange(dateList.length - 7, dateList.length); - // } - } - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - Padding( - padding: - const EdgeInsets.only(left: 8.0, right: 8.0, top: 4, bottom: 4), - child: Row( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 38, - width: 38, - decoration: BoxDecoration( - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - border: Border.all( - color: HotelAppTheme.buildLightTheme().dividerColor, - ), - ), - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - onTap: () { - setState(() { - currentMonthDate = DateTime(currentMonthDate.year, - currentMonthDate.month, 0); - setListOfDate(currentMonthDate); - }); - }, - child: Icon( - Icons.keyboard_arrow_left, - color: Colors.grey, - ), - ), - ), - ), - ), - Expanded( - child: Center( - child: Text( - DateFormat('MMMM, yyyy').format(currentMonthDate), - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: 20, - color: Colors.black), - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 38, - width: 38, - decoration: BoxDecoration( - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - border: Border.all( - color: HotelAppTheme.buildLightTheme().dividerColor, - ), - ), - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: - const BorderRadius.all(Radius.circular(24.0)), - onTap: () { - setState(() { - currentMonthDate = DateTime(currentMonthDate.year, - currentMonthDate.month + 2, 0); - setListOfDate(currentMonthDate); - }); - }, - child: Icon( - Icons.keyboard_arrow_right, - color: Colors.grey, - ), - ), - ), - ), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(right: 8, left: 8, bottom: 8), - child: Row( - children: getDaysNameUI(), - ), - ), - Padding( - padding: const EdgeInsets.only(right: 8, left: 8), - child: Column( - children: getDaysNoUI(), - ), - ), - ], - ), - ); - } - - List getDaysNameUI() { - final List listUI = []; - for (int i = 0; i < 7; i++) { - listUI.add( - Expanded( - child: Center( - child: Text( - DateFormat('EEE').format(dateList[i]), - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: HotelAppTheme.buildLightTheme().primaryColor), - ), - ), - ), - ); - } - return listUI; - } - - List getDaysNoUI() { - final List noList = []; - int count = 0; - for (int i = 0; i < dateList.length / 7; i++) { - final List listUI = []; - for (int i = 0; i < 7; i++) { - final DateTime date = dateList[count]; - listUI.add( - Expanded( - child: AspectRatio( - aspectRatio: 1.0, - child: Container( - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.only(top: 3, bottom: 3), - child: Material( - color: Colors.transparent, - child: Padding( - padding: EdgeInsets.only( - top: 2, - bottom: 2, - left: isStartDateRadius(date) ? 4 : 0, - right: isEndDateRadius(date) ? 4 : 0), - child: Container( - decoration: BoxDecoration( - color: startDate != null && endDate != null - ? getIsItStartAndEndDate(date) || - getIsInRange(date) - ? HotelAppTheme.buildLightTheme() - .primaryColor - .withOpacity(0.4) - : Colors.transparent - : Colors.transparent, - borderRadius: BorderRadius.only( - bottomLeft: isStartDateRadius(date) - ? const Radius.circular(24.0) - : const Radius.circular(0.0), - topLeft: isStartDateRadius(date) - ? const Radius.circular(24.0) - : const Radius.circular(0.0), - topRight: isEndDateRadius(date) - ? const Radius.circular(24.0) - : const Radius.circular(0.0), - bottomRight: isEndDateRadius(date) - ? const Radius.circular(24.0) - : const Radius.circular(0.0), - ), - ), - ), - ), - ), - ), - Material( - color: Colors.transparent, - child: InkWell( - borderRadius: - const BorderRadius.all(Radius.circular(32.0)), - onTap: () { - if (currentMonthDate.month == date.month) { - if (widget.minimumDate != null && - widget.maximumDate != null) { - final DateTime newminimumDate = DateTime( - widget.minimumDate.year, - widget.minimumDate.month, - widget.minimumDate.day - 1); - final DateTime newmaximumDate = DateTime( - widget.maximumDate.year, - widget.maximumDate.month, - widget.maximumDate.day + 1); - if (date.isAfter(newminimumDate) && - date.isBefore(newmaximumDate)) { - onDateClick(date); - } - } else if (widget.minimumDate != null) { - final DateTime newminimumDate = DateTime( - widget.minimumDate.year, - widget.minimumDate.month, - widget.minimumDate.day - 1); - if (date.isAfter(newminimumDate)) { - onDateClick(date); - } - } else if (widget.maximumDate != null) { - final DateTime newmaximumDate = DateTime( - widget.maximumDate.year, - widget.maximumDate.month, - widget.maximumDate.day + 1); - if (date.isBefore(newmaximumDate)) { - onDateClick(date); - } - } else { - onDateClick(date); - } - } - }, - child: Padding( - padding: const EdgeInsets.all(2), - child: Container( - decoration: BoxDecoration( - color: getIsItStartAndEndDate(date) - ? HotelAppTheme.buildLightTheme().primaryColor - : Colors.transparent, - borderRadius: - const BorderRadius.all(Radius.circular(32.0)), - border: Border.all( - color: getIsItStartAndEndDate(date) - ? Colors.white - : Colors.transparent, - width: 2, - ), - boxShadow: getIsItStartAndEndDate(date) - ? [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - blurRadius: 4, - offset: const Offset(0, 0)), - ] - : null, - ), - child: Center( - child: Text( - '${date.day}', - style: TextStyle( - color: getIsItStartAndEndDate(date) - ? Colors.white - : currentMonthDate.month == date.month - ? Colors.black - : Colors.grey.withOpacity(0.6), - fontSize: - MediaQuery.of(context).size.width > 360 - ? 18 - : 16, - fontWeight: getIsItStartAndEndDate(date) - ? FontWeight.bold - : FontWeight.normal), - ), - ), - ), - ), - ), - ), - Positioned( - bottom: 9, - right: 0, - left: 0, - child: Container( - height: 6, - width: 6, - decoration: BoxDecoration( - color: DateTime.now().day == date.day && - DateTime.now().month == date.month && - DateTime.now().year == date.year - ? getIsInRange(date) - ? Colors.white - : HotelAppTheme.buildLightTheme() - .primaryColor - : Colors.transparent, - shape: BoxShape.circle), - ), - ), - ], - ), - ), - ), - ), - ); - count += 1; - } - noList.add(Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: listUI, - )); - } - return noList; - } - - bool getIsInRange(DateTime date) { - if (startDate != null && endDate != null) { - if (date.isAfter(startDate) && date.isBefore(endDate)) { - return true; - } else { - return false; - } - } else { - return false; - } - } - - bool getIsItStartAndEndDate(DateTime date) { - if (startDate != null && - startDate.day == date.day && - startDate.month == date.month && - startDate.year == date.year) { - return true; - } else if (endDate != null && - endDate.day == date.day && - endDate.month == date.month && - endDate.year == date.year) { - return true; - } else { - return false; - } - } - - bool isStartDateRadius(DateTime date) { - if (startDate != null && - startDate.day == date.day && - startDate.month == date.month) { - return true; - } else if (date.weekday == 1) { - return true; - } else { - return false; - } - } - - bool isEndDateRadius(DateTime date) { - if (endDate != null && - endDate.day == date.day && - endDate.month == date.month) { - return true; - } else if (date.weekday == 7) { - return true; - } else { - return false; - } - } - - void onDateClick(DateTime date) { - if (startDate == null) { - startDate = date; - } else if (startDate != date && endDate == null) { - endDate = date; - } else if (startDate.day == date.day && startDate.month == date.month) { - startDate = null; - } else if (endDate.day == date.day && endDate.month == date.month) { - endDate = null; - } - if (startDate == null && endDate != null) { - startDate = endDate; - endDate = null; - } - if (startDate != null && endDate != null) { - if (!endDate.isAfter(startDate)) { - final DateTime d = startDate; - startDate = endDate; - endDate = d; - } - if (date.isBefore(startDate)) { - startDate = date; - } - if (date.isAfter(endDate)) { - endDate = date; - } - } - setState(() { - try { - widget.startEndDateChange(startDate, endDate); - } catch (_) {} - }); - } -} diff --git a/best_flutter_ui_templates/lib/hotel_booking/hotel_app_theme.dart b/best_flutter_ui_templates/lib/hotel_booking/hotel_app_theme.dart deleted file mode 100644 index 1dedb546..00000000 --- a/best_flutter_ui_templates/lib/hotel_booking/hotel_app_theme.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:best_flutter_ui_templates/main.dart'; -import 'package:flutter/material.dart'; - -class HotelAppTheme { - static TextTheme _buildTextTheme(TextTheme base) { - const String fontName = 'WorkSans'; - return base.copyWith( - headline1: base.headline1.copyWith(fontFamily: fontName), - headline2: base.headline2.copyWith(fontFamily: fontName), - headline3: base.headline3.copyWith(fontFamily: fontName), - headline4: base.headline4.copyWith(fontFamily: fontName), - headline5: base.headline5.copyWith(fontFamily: fontName), - headline6: base.headline6.copyWith(fontFamily: fontName), - button: base.button.copyWith(fontFamily: fontName), - caption: base.caption.copyWith(fontFamily: fontName), - bodyText1: base.bodyText1.copyWith(fontFamily: fontName), - bodyText2: base.bodyText2.copyWith(fontFamily: fontName), - subtitle1: base.subtitle1.copyWith(fontFamily: fontName), - subtitle2: base.subtitle2.copyWith(fontFamily: fontName), - overline: base.overline.copyWith(fontFamily: fontName), - ); - } - - static ThemeData buildLightTheme() { - final Color primaryColor = HexColor('#54D3C2'); - final Color secondaryColor = HexColor('#54D3C2'); - final ColorScheme colorScheme = const ColorScheme.light().copyWith( - primary: primaryColor, - secondary: secondaryColor, - ); - final ThemeData base = ThemeData.light(); - return base.copyWith( - colorScheme: colorScheme, - primaryColor: primaryColor, - buttonColor: primaryColor, - indicatorColor: Colors.white, - splashColor: Colors.white24, - splashFactory: InkRipple.splashFactory, - accentColor: secondaryColor, - canvasColor: Colors.white, - backgroundColor: const Color(0xFFFFFFFF), - scaffoldBackgroundColor: const Color(0xFFF6F6F6), - errorColor: const Color(0xFFB00020), - buttonTheme: ButtonThemeData( - colorScheme: colorScheme, - textTheme: ButtonTextTheme.primary, - ), - textTheme: _buildTextTheme(base.textTheme), - primaryTextTheme: _buildTextTheme(base.primaryTextTheme), - accentTextTheme: _buildTextTheme(base.accentTextTheme), - platform: TargetPlatform.iOS, - ); - } -} diff --git a/best_flutter_ui_templates/lib/hotel_booking/slider_view.dart b/best_flutter_ui_templates/lib/hotel_booking/slider_view.dart deleted file mode 100644 index 72b26d17..00000000 --- a/best_flutter_ui_templates/lib/hotel_booking/slider_view.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'hotel_app_theme.dart'; - -class SliderView extends StatefulWidget { - const SliderView({Key key, this.onChangedistValue, this.distValue}) - : super(key: key); - - final Function(double) onChangedistValue; - final double distValue; - - @override - _SliderViewState createState() => _SliderViewState(); -} - -class _SliderViewState extends State { - double distValue = 50.0; - - @override - void initState() { - distValue = widget.distValue; - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: distValue.round(), - child: const SizedBox(), - ), - Container( - width: 170, - child: Text( - 'Less than ${(distValue / 10).toStringAsFixed(1)} Km', - textAlign: TextAlign.center, - ), - ), - Expanded( - flex: 100 - distValue.round(), - child: const SizedBox(), - ), - ], - ), - SliderTheme( - data: SliderThemeData( - thumbShape: CustomThumbShape(), - ), - child: Slider( - onChanged: (double value) { - setState(() { - distValue = value; - }); - try { - widget.onChangedistValue(distValue); - } catch (_) {} - }, - min: 0, - max: 100, - activeColor: HotelAppTheme.buildLightTheme().primaryColor, - inactiveColor: Colors.grey.withOpacity(0.4), - divisions: 100, - value: distValue, - ), - ), - ], - ), - ); - } -} - -class CustomThumbShape extends SliderComponentShape { - static const double _thumbSize = 3.0; - static const double _disabledThumbSize = 3.0; - - @override - Size getPreferredSize(bool isEnabled, bool isDiscrete) { - return isEnabled - ? const Size.fromRadius(_thumbSize) - : const Size.fromRadius(_disabledThumbSize); - } - - static final Animatable sizeTween = Tween( - begin: _disabledThumbSize, - end: _thumbSize, - ); - - @override - void paint( - PaintingContext context, - Offset thumbCenter, { - Animation activationAnimation, - Animation enableAnimation, - bool isDiscrete, - TextPainter labelPainter, - RenderBox parentBox, - Size sizeWithOverflow, - SliderThemeData sliderTheme, - TextDirection textDirection, - double textScaleFactor, - double value, - }) { - final Canvas canvas = context.canvas; - final ColorTween colorTween = ColorTween( - begin: sliderTheme.disabledThumbColor, - end: sliderTheme.thumbColor, - ); - canvas.drawPath( - Path() - ..addOval(Rect.fromPoints( - Offset(thumbCenter.dx + 12, thumbCenter.dy + 12), - Offset(thumbCenter.dx - 12, thumbCenter.dy - 12))) - ..fillType = PathFillType.evenOdd, - Paint() - ..color = Colors.black.withOpacity(0.5) - ..maskFilter = - MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(8))); - - final Paint cPaint = Paint(); - cPaint..color = Colors.white; - cPaint..strokeWidth = 14 / 2; - canvas.drawCircle(Offset(thumbCenter.dx, thumbCenter.dy), 12, cPaint); - cPaint..color = colorTween.evaluate(enableAnimation); - canvas.drawCircle(Offset(thumbCenter.dx, thumbCenter.dy), 10, cPaint); - } - - double convertRadiusToSigma(double radius) { - return radius * 0.57735 + 0.5; - } -} diff --git a/best_flutter_ui_templates/lib/invite_friend_screen.dart b/best_flutter_ui_templates/lib/invite_friend_screen.dart deleted file mode 100644 index 5a1864bc..00000000 --- a/best_flutter_ui_templates/lib/invite_friend_screen.dart +++ /dev/null @@ -1,109 +0,0 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:flutter/material.dart'; - -class InviteFriend extends StatefulWidget { - @override - _InviteFriendState createState() => _InviteFriendState(); -} - -class _InviteFriendState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: AppTheme.nearlyWhite, - child: SafeArea( - top: false, - child: Scaffold( - backgroundColor: AppTheme.nearlyWhite, - body: Column( - children: [ - Container( - padding: EdgeInsets.only( - top: MediaQuery.of(context).padding.top, - left: 16, - right: 16), - child: Image.asset('assets/images/inviteImage.png'), - ), - Container( - padding: const EdgeInsets.only(top: 8), - child: Text( - 'Invite Your Friends', - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - padding: const EdgeInsets.only(top: 16), - child: const Text( - 'Are you one of those who makes everything\n at the last moment?', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - ), - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Container( - width: 120, - height: 40, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: - const BorderRadius.all(Radius.circular(4.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - offset: const Offset(4, 4), - blurRadius: 8.0), - ], - ), - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: () {}, - child: Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.share, - color: Colors.white, - size: 22, - ), - Padding( - padding: const EdgeInsets.all(4.0), - child: Text( - 'Share', - style: TextStyle( - fontWeight: FontWeight.w500, - color: Colors.white, - ), - ), - ), - ], - ), - ), - ), - ), - ), - ), - ), - ) - ], - ), - ), - ), - ); - } -} diff --git a/best_flutter_ui_templates/lib/model/homelist.dart b/best_flutter_ui_templates/lib/model/homelist.dart deleted file mode 100644 index 6e247fa0..00000000 --- a/best_flutter_ui_templates/lib/model/homelist.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:best_flutter_ui_templates/design_course/home_design_course.dart'; -import 'package:best_flutter_ui_templates/fitness_app/fitness_app_home_screen.dart'; -import 'package:best_flutter_ui_templates/hotel_booking/hotel_home_screen.dart'; -import 'package:flutter/widgets.dart'; - -class HomeList { - HomeList({ - this.navigateScreen, - this.imagePath = '', - }); - - Widget navigateScreen; - String imagePath; - - static List homeList = [ - HomeList( - imagePath: 'assets/hotel/hotel_booking.png', - navigateScreen: HotelHomeScreen(), - ), - HomeList( - imagePath: 'assets/fitness_app/fitness_app.png', - navigateScreen: FitnessAppHomeScreen(), - ), - HomeList( - imagePath: 'assets/design_course/design_course.png', - navigateScreen: DesignCourseHomeScreen(), - ), - ]; -} diff --git a/best_flutter_ui_templates/lib/navigation_home_screen.dart b/best_flutter_ui_templates/lib/navigation_home_screen.dart deleted file mode 100644 index 13770a0b..00000000 --- a/best_flutter_ui_templates/lib/navigation_home_screen.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:best_flutter_ui_templates/custom_drawer/drawer_user_controller.dart'; -import 'package:best_flutter_ui_templates/custom_drawer/home_drawer.dart'; -import 'package:best_flutter_ui_templates/feedback_screen.dart'; -import 'package:best_flutter_ui_templates/help_screen.dart'; -import 'package:best_flutter_ui_templates/home_screen.dart'; -import 'package:best_flutter_ui_templates/invite_friend_screen.dart'; -import 'package:flutter/material.dart'; - -class NavigationHomeScreen extends StatefulWidget { - @override - _NavigationHomeScreenState createState() => _NavigationHomeScreenState(); -} - -class _NavigationHomeScreenState extends State { - Widget screenView; - DrawerIndex drawerIndex; - - @override - void initState() { - drawerIndex = DrawerIndex.HOME; - screenView = const MyHomePage(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: AppTheme.nearlyWhite, - child: SafeArea( - top: false, - bottom: false, - child: Scaffold( - backgroundColor: AppTheme.nearlyWhite, - body: DrawerUserController( - screenIndex: drawerIndex, - drawerWidth: MediaQuery.of(context).size.width * 0.75, - onDrawerCall: (DrawerIndex drawerIndexdata) { - changeIndex(drawerIndexdata); - //callback from drawer for replace screen as user need with passing DrawerIndex(Enum index) - }, - screenView: screenView, - //we replace screen view as we need on navigate starting screens like MyHomePage, HelpScreen, FeedbackScreen, etc... - ), - ), - ), - ); - } - - void changeIndex(DrawerIndex drawerIndexdata) { - if (drawerIndex != drawerIndexdata) { - drawerIndex = drawerIndexdata; - if (drawerIndex == DrawerIndex.HOME) { - setState(() { - screenView = const MyHomePage(); - }); - } else if (drawerIndex == DrawerIndex.Help) { - setState(() { - screenView = HelpScreen(); - }); - } else if (drawerIndex == DrawerIndex.FeedBack) { - setState(() { - screenView = FeedbackScreen(); - }); - } else if (drawerIndex == DrawerIndex.Invite) { - setState(() { - screenView = InviteFriend(); - }); - } else { - //do in your way...... - } - } - } -} diff --git a/best_flutter_ui_templates/pubspec.lock b/best_flutter_ui_templates/pubspec.lock deleted file mode 100644 index 14e77652..00000000 --- a/best_flutter_ui_templates/pubspec.lock +++ /dev/null @@ -1,209 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.3" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.14.12" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - font_awesome_flutter: - dependency: "direct main" - description: - name: font_awesome_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "8.8.1" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" - intl: - dependency: "direct main" - description: - name: intl - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.1" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.6" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.8" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.4" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - smooth_star_rating: - dependency: "direct main" - description: - name: smooth_star_rating - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.3" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.15" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.6" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" -sdks: - dart: ">=2.7.0 <3.0.0" diff --git a/best_flutter_ui_templates/pubspec.yaml b/best_flutter_ui_templates/pubspec.yaml deleted file mode 100644 index aac71a95..00000000 --- a/best_flutter_ui_templates/pubspec.yaml +++ /dev/null @@ -1,86 +0,0 @@ -name: best_flutter_ui_templates -description: A new Flutter project. - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 - -environment: - sdk: ">=2.7.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.3 - font_awesome_flutter: ^8.8.1 - smooth_star_rating: ^1.1.1 - intl: ^0.16.0 - -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -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/ - - assets/design_course/ - - assets/fitness_app/ - - assets/hotel/ - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - fonts: - - family: WorkSans - fonts: - - asset: assets/fonts/WorkSans-Regular.ttf - - asset: assets/fonts/WorkSans-Medium.ttf - weight: 500 - - asset: assets/fonts/WorkSans-SemiBold.ttf - weight: 600 - - asset: assets/fonts/WorkSans-Bold.ttf - weight: 700 - - family: Roboto - fonts: - - asset: assets/fonts/Roboto-Bold.ttf - - asset: assets/fonts/Roboto-Regular.ttf - - asset: assets/fonts/Roboto-Medium.ttf - weight: 400 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/best_flutter_ui_templates/test/widget_test.dart b/best_flutter_ui_templates/test/widget_test.dart deleted file mode 100644 index 65726969..00000000 --- a/best_flutter_ui_templates/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:best_flutter_ui_templates/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/icon/adaptive.png b/icon/adaptive.png new file mode 100644 index 00000000..a75904f7 Binary files /dev/null and b/icon/adaptive.png differ diff --git a/icon/android.png b/icon/android.png new file mode 100644 index 00000000..d35fd32f Binary files /dev/null and b/icon/android.png differ diff --git a/icon/googleplay.png b/icon/googleplay.png new file mode 100644 index 00000000..68ed64f5 Binary files /dev/null and b/icon/googleplay.png differ diff --git a/icon/icon.afphoto b/icon/icon.afphoto new file mode 100644 index 00000000..b719556e Binary files /dev/null and b/icon/icon.afphoto differ diff --git a/icon/ios.png b/icon/ios.png new file mode 100644 index 00000000..daa1615f Binary files /dev/null and b/icon/ios.png differ diff --git a/images/07-05-2020.apk b/images/07-05-2020.apk deleted file mode 100644 index af856f66..00000000 Binary files a/images/07-05-2020.apk and /dev/null differ diff --git a/images/custom_drawer.gif b/images/custom_drawer.gif deleted file mode 100644 index 5ead2ada..00000000 Binary files a/images/custom_drawer.gif and /dev/null differ diff --git a/images/custom_drawer.png b/images/custom_drawer.png deleted file mode 100644 index d1d32881..00000000 Binary files a/images/custom_drawer.png and /dev/null differ diff --git a/images/design_course.gif b/images/design_course.gif deleted file mode 100644 index c6934a08..00000000 Binary files a/images/design_course.gif and /dev/null differ diff --git a/images/fitness_app.gif b/images/fitness_app.gif deleted file mode 100644 index 79a27e24..00000000 Binary files a/images/fitness_app.gif and /dev/null differ diff --git a/images/hotel_booking.gif b/images/hotel_booking.gif deleted file mode 100644 index 3eaea91e..00000000 Binary files a/images/hotel_booking.gif and /dev/null differ diff --git a/best_flutter_ui_templates/ios/.gitignore b/ios/.gitignore similarity index 95% rename from best_flutter_ui_templates/ios/.gitignore rename to ios/.gitignore index e96ef602..7a7f9873 100644 --- a/best_flutter_ui_templates/ios/.gitignore +++ b/ios/.gitignore @@ -1,3 +1,4 @@ +**/dgph *.mode1v3 *.mode2v3 *.moved-aside @@ -18,6 +19,7 @@ Flutter/App.framework Flutter/Flutter.framework Flutter/Flutter.podspec Flutter/Generated.xcconfig +Flutter/ephemeral/ Flutter/app.flx Flutter/app.zip Flutter/flutter_assets/ diff --git a/best_flutter_ui_templates/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist similarity index 91% rename from best_flutter_ui_templates/ios/Flutter/AppFrameworkInfo.plist rename to ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78..9625e105 100644 --- a/best_flutter_ui_templates/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 11.0 diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..b2f5fae9 --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..88c29144 --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1,3 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 00000000..2c068c40 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 00000000..43d0fda7 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Flutter (1.0.0) + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de + +PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 + +COCOAPODS: 1.11.3 diff --git a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj similarity index 78% rename from best_flutter_ui_templates/ios/Runner.xcodeproj/project.pbxproj rename to ios/Runner.xcodeproj/project.pbxproj index b522640b..52ad223e 100644 --- a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,12 +3,13 @@ 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 */; }; + 52B1DB98B00942DDB93F7C73 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAA6C7B5A9397A0C11B00BE1 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -32,6 +33,9 @@ 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 = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 5F28C4E1395FA7658B2930D4 /* 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 = ""; }; + 61CBF051404AAB2C07AF4735 /* 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 = ""; }; + 6C9687EB0ABD4421D88855D9 /* 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 = ""; }; 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 = ""; }; @@ -42,6 +46,8 @@ 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 = ""; }; + 98E2B7F828B15ACA00938B34 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + EAA6C7B5A9397A0C11B00BE1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +55,23 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 52B1DB98B00942DDB93F7C73 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4DAB0B301040CA3F0DD934C9 /* Pods */ = { + isa = PBXGroup; + children = ( + 5F28C4E1395FA7658B2930D4 /* Pods-Runner.debug.xcconfig */, + 61CBF051404AAB2C07AF4735 /* Pods-Runner.release.xcconfig */, + 6C9687EB0ABD4421D88855D9 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 4DAB0B301040CA3F0DD934C9 /* Pods */, + FC1DDB21A63D395C2CA63DC7 /* Frameworks */, ); sourceTree = ""; }; @@ -86,11 +105,11 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 98E2B7F828B15ACA00938B34 /* Runner.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, @@ -99,11 +118,12 @@ path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { + FC1DDB21A63D395C2CA63DC7 /* Frameworks */ = { isa = PBXGroup; children = ( + EAA6C7B5A9397A0C11B00BE1 /* Pods_Runner.framework */, ); - name = "Supporting Files"; + name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ @@ -113,12 +133,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 5CAFF5E2A8514188015E9D7D /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + AC52A0224720FEFA3CB02F82 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -135,7 +157,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -191,6 +213,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 5CAFF5E2A8514188015E9D7D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -205,6 +249,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + AC52A0224720FEFA3CB02F82 /* [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; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -241,7 +302,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -263,6 +323,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -281,7 +342,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -296,19 +357,15 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.bestFlutterUiTemplates; + PRODUCT_BUNDLE_IDENTIFIER = com.example.templates; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -318,7 +375,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -340,6 +396,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -364,7 +421,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -374,7 +431,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -396,6 +452,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -414,11 +471,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -430,19 +488,15 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.bestFlutterUiTemplates; + PRODUCT_BUNDLE_IDENTIFIER = com.example.templates; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -457,19 +511,15 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.bestFlutterUiTemplates; + PRODUCT_BUNDLE_IDENTIFIER = com.example.templates; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 71% rename from best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16..919434a6 100644 --- a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from best_flutter_ui_templates/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/best_flutter_ui_templates/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 95% rename from best_flutter_ui_templates/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cf..c87d15a3 100644 --- a/best_flutter_ui_templates/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - + + diff --git a/best_flutter_ui_templates/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from best_flutter_ui_templates/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/best_flutter_ui_templates/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from best_flutter_ui_templates/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/best_flutter_ui_templates/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift similarity index 100% rename from best_flutter_ui_templates/ios/Runner/AppDelegate.swift rename to ios/Runner/AppDelegate.swift diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..34f5fccf Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..bb4eef36 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..474734a7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..1f81c33c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..99f305b7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..8c15e4bf Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..03b8457f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..6d669fa0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..8c27b261 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..43b0654c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..43b0654c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..6e20536f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..9d0a5732 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..634d4492 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..f7936b98 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/best_flutter_ui_templates/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/best_flutter_ui_templates/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Base.lproj/Main.storyboard rename to ios/Runner/Base.lproj/Main.storyboard diff --git a/best_flutter_ui_templates/ios/Runner/Info.plist b/ios/Runner/Info.plist similarity index 88% rename from best_flutter_ui_templates/ios/Runner/Info.plist rename to ios/Runner/Info.plist index 2746d3d7..05d085c7 100644 --- a/best_flutter_ui_templates/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Templates CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -11,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - best_flutter_ui_templates + Templates CFBundlePackageType APPL CFBundleShortVersionString @@ -39,7 +41,11 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + ITSAppUsesNonExemptEncryption + UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/best_flutter_ui_templates/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h similarity index 100% rename from best_flutter_ui_templates/ios/Runner/Runner-Bridging-Header.h rename to ios/Runner/Runner-Bridging-Header.h diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/ios/Runner/Runner.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/lib/about_screen.dart b/lib/about_screen.dart new file mode 100644 index 00000000..25ad1f9e --- /dev/null +++ b/lib/about_screen.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class AboutScreen extends StatefulWidget { + const AboutScreen({super.key}); + + @override + State createState() => _AboutScreenState(); +} + +class _AboutScreenState extends State { + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'MIT License', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + const SizedBox(height: 16), + const Text( + 'Copyright © 2019 Mitesh Chodvadiya\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or modified copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16), + ), + const SizedBox(height: 30), + const Text( + 'The app is made from a fork of:', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16), + ), + const SizedBox(height: 16), + const Text( + 'Best Flutter UI Templates', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16), + ), + const SizedBox(height: 20), + GestureDetector( + onTap: () async { + final url = Uri( + scheme: 'https', + host: 'github.com', + path: '/nohli/flutter_templates', + ); + if (await canLaunchUrl(url)) launchUrl(url); + }, + child: const Text( + 'The code can be found here.', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.blue, + fontSize: 16, + decoration: TextDecoration.underline, + ), + ), + ), + ], + ), + ); + } +} diff --git a/best_flutter_ui_templates/lib/app_theme.dart b/lib/app_theme.dart similarity index 71% rename from best_flutter_ui_templates/lib/app_theme.dart rename to lib/app_theme.dart index 0946edc3..ce92709d 100644 --- a/best_flutter_ui_templates/lib/app_theme.dart +++ b/lib/app_theme.dart @@ -8,7 +8,7 @@ class AppTheme { static const Color white = Color(0xFFFFFFFF); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); - static const Color dark_grey = Color(0xFF313A44); + static const Color darkGrey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); @@ -20,16 +20,17 @@ class AppTheme { static const String fontName = 'WorkSans'; static const TextTheme textTheme = TextTheme( - headline4: display1, - headline5: headline, - headline6: title, - subtitle2: subtitle, - bodyText2: body2, - bodyText1: body1, - caption: caption, + headlineMedium: display1, + headlineSmall: headline, + titleLarge: title, + titleSmall: subtitle, + bodyMedium: body2, + bodyLarge: body1, + bodySmall: caption, ); - static const TextStyle display1 = TextStyle( // h4 -> display1 + static const TextStyle display1 = TextStyle( + // h4 -> display1 fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 36, @@ -38,7 +39,8 @@ class AppTheme { color: darkerText, ); - static const TextStyle headline = TextStyle( // h5 -> headline + static const TextStyle headline = TextStyle( + // h5 -> headline fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 24, @@ -46,7 +48,8 @@ class AppTheme { color: darkerText, ); - static const TextStyle title = TextStyle( // h6 -> title + static const TextStyle title = TextStyle( + // h6 -> title fontFamily: fontName, fontWeight: FontWeight.bold, fontSize: 16, @@ -54,7 +57,8 @@ class AppTheme { color: darkerText, ); - static const TextStyle subtitle = TextStyle( // subtitle2 -> subtitle + static const TextStyle subtitle = TextStyle( + // subtitle2 -> subtitle fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, @@ -62,7 +66,8 @@ class AppTheme { color: darkText, ); - static const TextStyle body2 = TextStyle( // body1 -> body2 + static const TextStyle body2 = TextStyle( + // body1 -> body2 fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 14, @@ -70,7 +75,8 @@ class AppTheme { color: darkText, ); - static const TextStyle body1 = TextStyle( // body2 -> body1 + static const TextStyle body1 = TextStyle( + // body2 -> body1 fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 16, @@ -78,12 +84,12 @@ class AppTheme { color: darkText, ); - static const TextStyle caption = TextStyle( // Caption -> caption + static const TextStyle caption = TextStyle( + // Caption -> caption fontFamily: fontName, fontWeight: FontWeight.w400, fontSize: 12, letterSpacing: 0.2, color: lightText, // was lightText ); - } diff --git a/best_flutter_ui_templates/lib/custom_drawer/drawer_user_controller.dart b/lib/custom_drawer/drawer_user_controller.dart similarity index 60% rename from best_flutter_ui_templates/lib/custom_drawer/drawer_user_controller.dart rename to lib/custom_drawer/drawer_user_controller.dart index 75fd369c..a19c31fe 100644 --- a/best_flutter_ui_templates/lib/custom_drawer/drawer_user_controller.dart +++ b/lib/custom_drawer/drawer_user_controller.dart @@ -1,73 +1,95 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; -import 'package:best_flutter_ui_templates/custom_drawer/home_drawer.dart'; import 'package:flutter/material.dart'; +import '../app_theme.dart'; +import '../custom_drawer/home_drawer.dart'; + class DrawerUserController extends StatefulWidget { const DrawerUserController({ - Key key, - this.drawerWidth = 250, - this.onDrawerCall, - this.screenView, - this.animatedIconData = AnimatedIcons.arrow_menu, + required this.onDrawerCall, + required this.screenView, this.menuView, this.drawerIsOpen, - this.screenIndex, - }) : super(key: key); + this.animatedIconData = AnimatedIcons.arrow_menu, + this.drawerWidth = 250, + this.screenIndex = DrawerIndex.home, + super.key, + }); final double drawerWidth; final Function(DrawerIndex) onDrawerCall; final Widget screenView; - final Function(bool) drawerIsOpen; + final Function(bool)? drawerIsOpen; final AnimatedIconData animatedIconData; - final Widget menuView; + final Widget? menuView; final DrawerIndex screenIndex; @override - _DrawerUserControllerState createState() => _DrawerUserControllerState(); + State createState() => _DrawerUserControllerState(); } -class _DrawerUserControllerState extends State with TickerProviderStateMixin { - ScrollController scrollController; - AnimationController iconAnimationController; - AnimationController animationController; - +class _DrawerUserControllerState extends State + with TickerProviderStateMixin { double scrolloffset = 0.0; + late final ScrollController scrollController; + late final AnimationController animationController; + late final AnimationController iconAnimationController; @override void initState() { - animationController = AnimationController(duration: const Duration(milliseconds: 2000), vsync: this); - iconAnimationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 0)); - iconAnimationController..animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); - scrollController = ScrollController(initialScrollOffset: widget.drawerWidth); - scrollController - ..addListener(() { - if (scrollController.offset <= 0) { - if (scrolloffset != 1.0) { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + iconAnimationController = + AnimationController(vsync: this, duration: const Duration()); + iconAnimationController.animateTo(1.0, + duration: const Duration(), curve: Curves.fastOutSlowIn); + scrollController = + ScrollController(initialScrollOffset: widget.drawerWidth); + scrollController.addListener(() { + if (scrollController.offset <= 0) { + if (scrolloffset != 1.0) { + if (mounted) { setState(() { scrolloffset = 1.0; try { - widget.drawerIsOpen(true); + final Function(bool)? function = widget.drawerIsOpen; + if (function != null) function(true); } catch (_) {} }); } - iconAnimationController.animateTo(0.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); - } else if (scrollController.offset > 0 && scrollController.offset < widget.drawerWidth.floor()) { - iconAnimationController.animateTo((scrollController.offset * 100 / (widget.drawerWidth)) / 100, - duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); - } else { - if (scrolloffset != 0.0) { + } + iconAnimationController.animateTo(0.0, + duration: const Duration(), curve: Curves.fastOutSlowIn); + } else if (scrollController.offset < widget.drawerWidth.floor()) { + iconAnimationController.animateTo( + (scrollController.offset * 100 / (widget.drawerWidth)) / 100, + duration: const Duration(), + curve: Curves.fastOutSlowIn); + } else { + if (scrolloffset != 0.0) { + if (mounted) { setState(() { scrolloffset = 0.0; try { - widget.drawerIsOpen(false); + final Function(bool)? function = widget.drawerIsOpen; + if (function != null) function(false); } catch (_) {} }); } - iconAnimationController.animateTo(1.0, duration: const Duration(milliseconds: 0), curve: Curves.fastOutSlowIn); } - }); + iconAnimationController.animateTo(1.0, + duration: const Duration(), curve: Curves.fastOutSlowIn); + } + }); WidgetsBinding.instance.addPostFrameCallback((_) => getInitState()); - super.initState(); + } + + @override + void dispose() { + scrollController.dispose(); + animationController.dispose(); + iconAnimationController.dispose(); + super.dispose(); } Future getInitState() async { @@ -79,9 +101,9 @@ class _DrawerUserControllerState extends State with Ticker @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppTheme.white, - body: SingleChildScrollView( + return Container( + color: AppTheme.white, + child: SingleChildScrollView( controller: scrollController, scrollDirection: Axis.horizontal, physics: const PageScrollPhysics(parent: ClampingScrollPhysics()), @@ -97,18 +119,21 @@ class _DrawerUserControllerState extends State with Ticker height: MediaQuery.of(context).size.height, child: AnimatedBuilder( animation: iconAnimationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return Transform( //transform we use for the stable drawer we, not need to move with scroll view - transform: Matrix4.translationValues(scrollController.offset, 0.0, 0.0), + transform: Matrix4.translationValues( + scrollController.offset, 0.0, 0.0), child: HomeDrawer( - screenIndex: widget.screenIndex == null ? DrawerIndex.HOME : widget.screenIndex, + screenIndex: widget.screenIndex, iconAnimationController: iconAnimationController, callBackIndex: (DrawerIndex indexType) { onDrawerClick(); try { widget.onDrawerCall(indexType); - } catch (e) {} + } catch (e) { + debugPrint('drawer_user_controller?.dart: $e'); + } }, ), ); @@ -123,7 +148,9 @@ class _DrawerUserControllerState extends State with Ticker decoration: BoxDecoration( color: AppTheme.white, boxShadow: [ - BoxShadow(color: AppTheme.grey.withOpacity(0.6), blurRadius: 24), + BoxShadow( + color: AppTheme.grey.withOpacity(0.6), + blurRadius: 24), ], ), child: Stack( @@ -135,33 +162,35 @@ class _DrawerUserControllerState extends State with Ticker ), //alternative touch(user Interface) for widget.screen, for example, drawer is close we need to tap on a few home screen area and close the drawer if (scrolloffset == 1.0) - InkWell( - onTap: () { - onDrawerClick(); - }, + GestureDetector( + onTap: () => onDrawerClick(), ), + // this just menu and arrow icon animation Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top + 8, left: 8), + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top + 8, + left: 8), child: SizedBox( width: AppBar().preferredSize.height - 8, height: AppBar().preferredSize.height - 8, child: Material( color: Colors.transparent, child: InkWell( - borderRadius: BorderRadius.circular(AppBar().preferredSize.height), + borderRadius: BorderRadius.circular( + AppBar().preferredSize.height), + onTap: () { + FocusScope.of(context) + .requestFocus(FocusNode()); + onDrawerClick(); + }, child: Center( // if you use your own menu view UI you add form initialization - child: widget.menuView != null - ? widget.menuView - : AnimatedIcon( - icon: widget.animatedIconData != null ? widget.animatedIconData : AnimatedIcons.arrow_menu, + child: widget.menuView ?? + AnimatedIcon( + icon: widget.animatedIconData, progress: iconAnimationController), ), - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - onDrawerClick(); - }, ), ), ), @@ -178,7 +207,7 @@ class _DrawerUserControllerState extends State with Ticker } void onDrawerClick() { - //if scrollcontroller.offset != 0.0 then we set to closed the drawer(with animation to offset zero position) if is not 1 then open the drawer + //if scrollcontroller?.offset != 0.0 then we set to closed the drawer(with animation to offset zero position) if is not 1 then open the drawer if (scrollController.offset != 0.0) { scrollController.animateTo( 0.0, diff --git a/best_flutter_ui_templates/lib/custom_drawer/home_drawer.dart b/lib/custom_drawer/home_drawer.dart similarity index 54% rename from best_flutter_ui_templates/lib/custom_drawer/home_drawer.dart rename to lib/custom_drawer/home_drawer.dart index 654d982f..d230c6f6 100644 --- a/best_flutter_ui_templates/lib/custom_drawer/home_drawer.dart +++ b/lib/custom_drawer/home_drawer.dart @@ -1,68 +1,68 @@ -import 'package:best_flutter_ui_templates/app_theme.dart'; import 'package:flutter/material.dart'; +import '../app_theme.dart'; + class HomeDrawer extends StatefulWidget { - const HomeDrawer({Key key, this.screenIndex, this.iconAnimationController, this.callBackIndex}) : super(key: key); + const HomeDrawer({ + required this.screenIndex, + required this.iconAnimationController, + required this.callBackIndex, + super.key, + }); final AnimationController iconAnimationController; final DrawerIndex screenIndex; final Function(DrawerIndex) callBackIndex; @override - _HomeDrawerState createState() => _HomeDrawerState(); + State createState() => _HomeDrawerState(); } class _HomeDrawerState extends State { - List drawerList; + late final List drawerList; @override void initState() { - setdDrawerListArray(); super.initState(); + setDrawerListArray(); } - void setdDrawerListArray() { + void setDrawerListArray() { drawerList = [ DrawerList( - index: DrawerIndex.HOME, + index: DrawerIndex.home, labelName: 'Home', - icon: Icon(Icons.home), + icon: const Icon(Icons.home), ), DrawerList( - index: DrawerIndex.Help, + index: DrawerIndex.help, labelName: 'Help', isAssetsImage: true, imageName: 'assets/images/supportIcon.png', ), DrawerList( - index: DrawerIndex.FeedBack, - labelName: 'FeedBack', - icon: Icon(Icons.help), + index: DrawerIndex.feedback, + labelName: 'Feedback', + icon: const Icon(Icons.help), ), DrawerList( - index: DrawerIndex.Invite, + index: DrawerIndex.invite, labelName: 'Invite Friend', - icon: Icon(Icons.group), - ), - DrawerList( - index: DrawerIndex.Share, - labelName: 'Rate the app', - icon: Icon(Icons.share), + icon: const Icon(Icons.group), ), DrawerList( - index: DrawerIndex.About, - labelName: 'About Us', - icon: Icon(Icons.info), + index: DrawerIndex.about, + labelName: 'About', + icon: const Icon(Icons.info), ), ]; } @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppTheme.notWhite.withOpacity(0.5), - body: Column( + return Container( + color: AppTheme.notWhite.withOpacity(0.5), + child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.start, children: [ Container( width: double.infinity, @@ -71,16 +71,19 @@ class _HomeDrawerState extends State { padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, children: [ AnimatedBuilder( animation: widget.iconAnimationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return ScaleTransition( - scale: AlwaysStoppedAnimation(1.0 - (widget.iconAnimationController.value) * 0.2), + scale: AlwaysStoppedAnimation( + 1.0 - (widget.iconAnimationController.value) * 0.2), child: RotationTransition( - turns: AlwaysStoppedAnimation(Tween(begin: 0.0, end: 24.0) - .animate(CurvedAnimation(parent: widget.iconAnimationController, curve: Curves.fastOutSlowIn)) + turns: AlwaysStoppedAnimation(Tween( + begin: 0.0, end: 24.0) + .animate(CurvedAnimation( + parent: widget.iconAnimationController, + curve: Curves.fastOutSlowIn)) .value / 360), child: Container( @@ -89,11 +92,15 @@ class _HomeDrawerState extends State { decoration: BoxDecoration( shape: BoxShape.circle, boxShadow: [ - BoxShadow(color: AppTheme.grey.withOpacity(0.6), offset: const Offset(2.0, 4.0), blurRadius: 8), + BoxShadow( + color: AppTheme.grey.withOpacity(0.6), + offset: const Offset(2.0, 4.0), + blurRadius: 8), ], ), child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(60.0)), + borderRadius: + const BorderRadius.all(Radius.circular(60.0)), child: Image.asset('assets/images/userImage.png'), ), ), @@ -101,10 +108,10 @@ class _HomeDrawerState extends State { ); }, ), - Padding( - padding: const EdgeInsets.only(top: 8, left: 4), + const Padding( + padding: EdgeInsets.only(top: 8, left: 4), child: Text( - 'Chris Hemsworth', + 'Shaquille Oatmeal', style: TextStyle( fontWeight: FontWeight.w600, color: AppTheme.grey, @@ -139,22 +146,27 @@ class _HomeDrawerState extends State { ), Column( children: [ - ListTile( - title: Text( - 'Sign Out', - style: TextStyle( - fontFamily: AppTheme.fontName, - fontWeight: FontWeight.w600, - fontSize: 16, - color: AppTheme.darkText, + Material( + color: Colors.transparent, + child: InkWell( + child: ListTile( + title: const Text( + 'Sign Out', + style: TextStyle( + fontFamily: AppTheme.fontName, + fontWeight: FontWeight.w600, + fontSize: 16, + color: AppTheme.darkText, + ), + textAlign: TextAlign.left, + ), + trailing: const Icon( + Icons.power_settings_new, + color: Colors.red, + ), + onTap: () {}, ), - textAlign: TextAlign.left, - ), - trailing: Icon( - Icons.power_settings_new, - color: Colors.red, ), - onTap: () {}, ), SizedBox( height: MediaQuery.of(context).padding.bottom, @@ -181,7 +193,7 @@ class _HomeDrawerState extends State { padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), child: Row( children: [ - Container( + const SizedBox( width: 6.0, height: 46.0, // decoration: BoxDecoration( @@ -199,13 +211,20 @@ class _HomeDrawerState extends State { const Padding( padding: EdgeInsets.all(4.0), ), - listData.isAssetsImage - ? Container( - width: 24, - height: 24, - child: Image.asset(listData.imageName, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack), - ) - : Icon(listData.icon.icon, color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack), + if (listData.isAssetsImage) + SizedBox( + width: 24, + height: 24, + child: Image.asset(listData.imageName, + color: widget.screenIndex == listData.index + ? Colors.blue + : AppTheme.nearlyBlack), + ) + else + Icon(listData.icon?.icon, + color: widget.screenIndex == listData.index + ? Colors.blue + : AppTheme.nearlyBlack), const Padding( padding: EdgeInsets.all(4.0), ), @@ -214,40 +233,44 @@ class _HomeDrawerState extends State { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16, - color: widget.screenIndex == listData.index ? Colors.blue : AppTheme.nearlyBlack, + color: widget.screenIndex == listData.index + ? Colors.blue + : AppTheme.nearlyBlack, ), textAlign: TextAlign.left, ), ], ), ), - widget.screenIndex == listData.index - ? AnimatedBuilder( - animation: widget.iconAnimationController, - builder: (BuildContext context, Widget child) { - return Transform( - transform: Matrix4.translationValues( - (MediaQuery.of(context).size.width * 0.75 - 64) * (1.0 - widget.iconAnimationController.value - 1.0), 0.0, 0.0), - child: Padding( - padding: EdgeInsets.only(top: 8, bottom: 8), - child: Container( - width: MediaQuery.of(context).size.width * 0.75 - 64, - height: 46, - decoration: BoxDecoration( - color: Colors.blue.withOpacity(0.2), - borderRadius: new BorderRadius.only( - topLeft: Radius.circular(0), - topRight: Radius.circular(28), - bottomLeft: Radius.circular(0), - bottomRight: Radius.circular(28), - ), - ), + if (widget.screenIndex == listData.index) + AnimatedBuilder( + animation: widget.iconAnimationController, + builder: (BuildContext context, _) { + return Transform( + transform: Matrix4.translationValues( + (MediaQuery.of(context).size.width * 0.75 - 64) * + (1.0 - widget.iconAnimationController.value - 1.0), + 0.0, + 0.0), + child: Padding( + padding: const EdgeInsets.only(top: 8, bottom: 8), + child: Container( + width: MediaQuery.of(context).size.width * 0.75 - 64, + height: 46, + decoration: BoxDecoration( + color: Colors.blue.withOpacity(0.2), + borderRadius: const BorderRadius.only( + topRight: Radius.circular(28), + bottomRight: Radius.circular(28), ), ), - ); - }, - ) - : const SizedBox() + ), + ), + ); + }, + ) + else + const SizedBox() ], ), ), @@ -259,27 +282,19 @@ class _HomeDrawerState extends State { } } -enum DrawerIndex { - HOME, - FeedBack, - Help, - Share, - About, - Invite, - Testing, -} +enum DrawerIndex { home, help, feedback, invite, about } class DrawerList { DrawerList({ + required this.index, + this.icon, this.isAssetsImage = false, this.labelName = '', - this.icon, - this.index, this.imageName = '', }); String labelName; - Icon icon; + Icon? icon; bool isAssetsImage; String imageName; DrawerIndex index; diff --git a/lib/design_course/category_list_view.dart b/lib/design_course/category_list_view.dart new file mode 100644 index 00000000..c9140f5e --- /dev/null +++ b/lib/design_course/category_list_view.dart @@ -0,0 +1,262 @@ +import 'package:flutter/material.dart'; + +import 'design_course_app_theme.dart'; +import 'models/category.dart'; + +class CategoryListView extends StatefulWidget { + const CategoryListView({required this.callBack, super.key}); + + final Function() callBack; + + @override + State createState() => _CategoryListViewState(); +} + +class _CategoryListViewState extends State + with TickerProviderStateMixin { + late final AnimationController animationController; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + Future getData() async { + await Future.delayed(const Duration(milliseconds: 50)); + return true; + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 16, bottom: 16), + child: SizedBox( + height: 134, + width: double.infinity, + child: FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return const SizedBox(); + } else { + return ListView.builder( + padding: const EdgeInsets.only(right: 16, left: 16), + itemCount: Category.categoryList.length, + scrollDirection: Axis.horizontal, + itemBuilder: (BuildContext context, int index) { + final int count = Category.categoryList.length > 10 + ? 10 + : Category.categoryList.length; + final Animation animation = + Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: Interval((1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn))); + animationController.forward(); + + return CategoryView( + category: Category.categoryList[index], + animation: animation, + animationController: animationController, + callback: () { + widget.callBack(); + }, + ); + }, + ); + } + }, + ), + ), + ); + } +} + +class CategoryView extends StatelessWidget { + const CategoryView({ + required this.category, + required this.animationController, + required this.animation, + required this.callback, + super.key, + }); + + final VoidCallback callback; + final Category category; + final AnimationController animationController; + final Animation animation; + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: animationController, + builder: (BuildContext context, _) { + return FadeTransition( + opacity: animation, + child: Transform( + transform: Matrix4.translationValues( + 100 * (1.0 - animation.value), 0.0, 0.0), + child: GestureDetector( + onTap: () => callback(), + child: SizedBox( + width: 280, + child: Stack( + children: [ + Row( + children: [ + const SizedBox(width: 48), + Expanded( + child: Container( + decoration: const BoxDecoration( + color: Color(0xFFF8FAFB), + borderRadius: + BorderRadius.all(Radius.circular(16.0)), + ), + child: Row( + children: [ + const SizedBox( + width: 48 + 24.0, + ), + Expanded( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.only(top: 16), + child: Text( + category.title, + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + letterSpacing: 0.27, + color: + DesignCourseAppTheme.darkerText, + ), + ), + ), + const Expanded( + child: SizedBox(), + ), + Padding( + padding: const EdgeInsets.only( + right: 16, bottom: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '${category.lessonCount} lesson', + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w200, + fontSize: 12, + letterSpacing: 0.27, + color: + DesignCourseAppTheme.grey, + ), + ), + Row( + children: [ + Text( + '${category.rating}', + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w200, + fontSize: 18, + letterSpacing: 0.27, + color: DesignCourseAppTheme + .grey, + ), + ), + const Icon( + Icons.star, + color: DesignCourseAppTheme + .nearlyBlue, + size: 20, + ), + ], + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only( + bottom: 16, right: 16), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + '\$${category.money}', + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 18, + letterSpacing: 0.27, + color: DesignCourseAppTheme + .nearlyBlue, + ), + ), + Container( + decoration: const BoxDecoration( + color: DesignCourseAppTheme + .nearlyBlue, + borderRadius: BorderRadius.all( + Radius.circular(8.0)), + ), + child: const Padding( + padding: EdgeInsets.all(4.0), + child: Icon( + Icons.add, + color: DesignCourseAppTheme + .nearlyWhite, + ), + ), + ) + ], + ), + ), + ], + ), + ), + ], + ), + ), + ) + ], + ), + Padding( + padding: + const EdgeInsets.only(top: 24, bottom: 24, left: 16), + child: Row( + children: [ + ClipRRect( + borderRadius: + const BorderRadius.all(Radius.circular(16.0)), + child: AspectRatio( + aspectRatio: 1.0, + child: Image.asset(category.imagePath)), + ) + ], + ), + ), + ], + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/design_course/course_info_screen.dart b/lib/design_course/course_info_screen.dart new file mode 100644 index 00000000..a4af63b0 --- /dev/null +++ b/lib/design_course/course_info_screen.dart @@ -0,0 +1,390 @@ +import 'package:flutter/material.dart'; + +import 'design_course_app_theme.dart'; + +class CourseInfoScreen extends StatefulWidget { + const CourseInfoScreen({super.key}); + + @override + State createState() => _CourseInfoScreenState(); +} + +class _CourseInfoScreenState extends State + with TickerProviderStateMixin { + final double infoHeight = 364.0; + double opacity1 = 0.0; + double opacity2 = 0.0; + double opacity3 = 0.0; + + late final AnimationController animationController; + late final Animation animation; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 1000), vsync: this); + animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( + parent: animationController, + curve: const Interval(0, 1.0, curve: Curves.fastOutSlowIn))); + setData(); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + Future setData() async { + animationController.forward(); + await Future.delayed(const Duration(milliseconds: 200)); + if (mounted) { + setState(() { + opacity1 = 1.0; + }); + } + await Future.delayed(const Duration(milliseconds: 200)); + if (mounted) { + setState(() { + opacity2 = 1.0; + }); + } + await Future.delayed(const Duration(milliseconds: 200)); + if (mounted) { + setState(() { + opacity3 = 1.0; + }); + } + } + + @override + Widget build(BuildContext context) { + final double tempHeight = MediaQuery.of(context).size.height - + (MediaQuery.of(context).size.width / 1.2) + + 24.0; + return Material( + color: DesignCourseAppTheme.nearlyWhite, + child: Stack( + children: [ + Column( + children: [ + AspectRatio( + aspectRatio: 1.2, + child: Image.asset('assets/design_course/webInterFace.png'), + ), + ], + ), + Positioned( + top: (MediaQuery.of(context).size.width / 1.2) - 24.0, + bottom: 0, + left: 0, + right: 0, + child: Container( + decoration: BoxDecoration( + color: DesignCourseAppTheme.nearlyWhite, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(32.0), + topRight: Radius.circular(32.0)), + boxShadow: [ + BoxShadow( + color: DesignCourseAppTheme.grey.withOpacity(0.2), + offset: const Offset(1.1, 1.1), + blurRadius: 10.0), + ], + ), + child: Padding( + padding: const EdgeInsets.only(left: 8, right: 8), + child: SingleChildScrollView( + child: Container( + constraints: BoxConstraints( + minHeight: infoHeight, + maxHeight: + tempHeight > infoHeight ? tempHeight : infoHeight), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Padding( + padding: + EdgeInsets.only(top: 32.0, left: 18, right: 16), + child: Text( + 'Web Design\nCourse', + textAlign: TextAlign.left, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 22, + letterSpacing: 0.27, + color: DesignCourseAppTheme.darkerText, + ), + ), + ), + const Padding( + padding: EdgeInsets.only( + left: 16, right: 16, bottom: 8, top: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '\$28.99', + textAlign: TextAlign.left, + style: TextStyle( + fontWeight: FontWeight.w200, + fontSize: 22, + letterSpacing: 0.27, + color: DesignCourseAppTheme.nearlyBlue, + ), + ), + Row( + children: [ + Text( + '4.3', + textAlign: TextAlign.left, + style: TextStyle( + fontWeight: FontWeight.w200, + fontSize: 22, + letterSpacing: 0.27, + color: DesignCourseAppTheme.grey, + ), + ), + Icon( + Icons.star, + color: DesignCourseAppTheme.nearlyBlue, + size: 24, + ), + ], + ), + ], + ), + ), + AnimatedOpacity( + duration: const Duration(milliseconds: 500), + opacity: opacity1, + child: Padding( + padding: const EdgeInsets.all(8), + child: Row( + children: [ + getTimeBoxUI('24', 'Classes'), + getTimeBoxUI('2hours', 'Time'), + getTimeBoxUI('24', 'Seat'), + ], + ), + ), + ), + Expanded( + child: AnimatedOpacity( + duration: const Duration(milliseconds: 500), + opacity: opacity2, + child: const Padding( + padding: EdgeInsets.only( + left: 16, right: 16, top: 8, bottom: 8), + child: Text( + 'Learn modern web design with gamification aspects. From your fundamentals all the way up to masterclass.', + textAlign: TextAlign.justify, + style: TextStyle( + fontWeight: FontWeight.w200, + fontSize: 14, + letterSpacing: 0.27, + color: DesignCourseAppTheme.grey, + ), + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), + ), + ), + ), + AnimatedOpacity( + duration: const Duration(milliseconds: 500), + opacity: opacity3, + child: Padding( + padding: const EdgeInsets.only( + left: 16, bottom: 16, right: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 62, + height: 48, + decoration: BoxDecoration( + color: DesignCourseAppTheme.nearlyWhite, + borderRadius: const BorderRadius.all( + Radius.circular(16.0)), + border: Border.all( + color: DesignCourseAppTheme.grey + .withOpacity(0.2)), + ), + child: TextButton( + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(16.0)), + ), + onPressed: () {}, + child: const Icon( + Icons.add, + color: DesignCourseAppTheme.nearlyBlue, + size: 28, + ), + ), + ), + const SizedBox(width: 16), + Expanded( + child: Container( + height: 48, + decoration: BoxDecoration( + color: DesignCourseAppTheme.nearlyBlue, + borderRadius: const BorderRadius.all( + Radius.circular(16.0), + ), + boxShadow: [ + BoxShadow( + color: DesignCourseAppTheme + .nearlyBlue + .withOpacity(0.5), + offset: const Offset(1.1, 1.1), + blurRadius: 10.0), + ], + ), + child: Center( + child: TextButton( + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(16.0), + ), + minimumSize: const Size(1000, 48), + ), + onPressed: () {}, + child: const Text( + 'Join Course', + textAlign: TextAlign.left, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 18, + letterSpacing: 0.0, + color: DesignCourseAppTheme + .nearlyWhite, + ), + ), + ), + ), + ), + ) + ], + ), + ), + ), + SizedBox( + height: MediaQuery.of(context).padding.bottom, + ) + ], + ), + ), + ), + ), + ), + ), + Positioned( + top: (MediaQuery.of(context).size.width / 1.2) - 24.0 - 35, + right: 35, + child: ScaleTransition( + scale: CurvedAnimation( + parent: animationController, curve: Curves.fastOutSlowIn), + child: Card( + color: DesignCourseAppTheme.nearlyBlue, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0)), + elevation: 10.0, + child: SizedBox( + width: 60, + height: 60, + child: Center( + child: TextButton( + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(50.0), + ), + minimumSize: const Size(60, 60), + ), + onPressed: () {}, + child: const Icon( + Icons.favorite, + color: DesignCourseAppTheme.nearlyWhite, + size: 28, + ), + ), + ), + ), + ), + ), + ), + Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: SizedBox( + width: AppBar().preferredSize.height, + height: AppBar().preferredSize.height, + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: + BorderRadius.circular(AppBar().preferredSize.height), + onTap: () => Navigator.pop(context), + child: const Icon( + Icons.arrow_back_ios, + color: DesignCourseAppTheme.nearlyBlack, + ), + ), + ), + ), + ) + ], + ), + ); + } + + Widget getTimeBoxUI(String text1, String txt2) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + color: DesignCourseAppTheme.nearlyWhite, + borderRadius: const BorderRadius.all(Radius.circular(16.0)), + boxShadow: [ + BoxShadow( + color: DesignCourseAppTheme.grey.withOpacity(0.2), + offset: const Offset(1.1, 1.1), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: const EdgeInsets.only( + left: 18.0, right: 18.0, top: 12.0, bottom: 12.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + text1, + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 14, + letterSpacing: 0.27, + color: DesignCourseAppTheme.nearlyBlue, + ), + ), + Text( + txt2, + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.w200, + fontSize: 14, + letterSpacing: 0.27, + color: DesignCourseAppTheme.grey, + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/best_flutter_ui_templates/lib/design_course/design_course_app_theme.dart b/lib/design_course/design_course_app_theme.dart similarity index 90% rename from best_flutter_ui_templates/lib/design_course/design_course_app_theme.dart rename to lib/design_course/design_course_app_theme.dart index 3604e505..8e478e77 100644 --- a/best_flutter_ui_templates/lib/design_course/design_course_app_theme.dart +++ b/lib/design_course/design_course_app_theme.dart @@ -8,7 +8,7 @@ class DesignCourseAppTheme { static const Color nearlyBlue = Color(0xFF00B6F0); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); - static const Color dark_grey = Color(0xFF313A44); + static const Color darkGrey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); @@ -19,13 +19,13 @@ class DesignCourseAppTheme { static const Color spacer = Color(0xFFF2F2F2); static const TextTheme textTheme = TextTheme( - headline4: display1, - headline5: headline, - headline6: title, - subtitle2: subtitle, - bodyText1: body2, - bodyText2: body1, - caption: caption, + headlineMedium: display1, + headlineSmall: headline, + titleLarge: title, + titleSmall: subtitle, + bodyLarge: body2, + bodyMedium: body1, + bodySmall: caption, ); static const TextStyle display1 = TextStyle( diff --git a/best_flutter_ui_templates/lib/design_course/home_design_course.dart b/lib/design_course/home_design_course.dart similarity index 76% rename from best_flutter_ui_templates/lib/design_course/home_design_course.dart rename to lib/design_course/home_design_course.dart index 7fd09c9d..a692f530 100644 --- a/best_flutter_ui_templates/lib/design_course/home_design_course.dart +++ b/lib/design_course/home_design_course.dart @@ -1,13 +1,15 @@ -import 'package:best_flutter_ui_templates/design_course/category_list_view.dart'; -import 'package:best_flutter_ui_templates/design_course/course_info_screen.dart'; -import 'package:best_flutter_ui_templates/design_course/popular_course_list_view.dart'; -import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; + +import 'category_list_view.dart'; +import 'course_info_screen.dart'; import 'design_course_app_theme.dart'; +import 'popular_course_list_view.dart'; class DesignCourseHomeScreen extends StatefulWidget { + const DesignCourseHomeScreen({super.key}); + @override - _DesignCourseHomeScreenState createState() => _DesignCourseHomeScreenState(); + State createState() => _DesignCourseHomeScreenState(); } class _DesignCourseHomeScreenState extends State { @@ -15,34 +17,31 @@ class _DesignCourseHomeScreenState extends State { @override Widget build(BuildContext context) { - return Container( + return Material( color: DesignCourseAppTheme.nearlyWhite, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - SizedBox( - height: MediaQuery.of(context).padding.top, - ), - getAppBarUI(), - Expanded( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height, - child: Column( - children: [ - getSearchBarUI(), - getCategoryUI(), - Flexible( - child: getPopularCourseUI(), - ), - ], - ), + child: Column( + children: [ + SizedBox( + height: MediaQuery.of(context).padding.top, + ), + getAppBarUI(), + Expanded( + child: SingleChildScrollView( + child: SizedBox( + height: MediaQuery.of(context).size.height, + child: Column( + children: [ + getSearchBarUI(), + getCategoryUI(), + Flexible( + child: getPopularCourseUI(), + ), + ], ), ), ), - ], - ), + ), + ], ), ); } @@ -52,8 +51,8 @@ class _DesignCourseHomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only(top: 8.0, left: 18, right: 16), + const Padding( + padding: EdgeInsets.only(top: 8.0, left: 18, right: 16), child: Text( 'Category', textAlign: TextAlign.left, @@ -72,17 +71,18 @@ class _DesignCourseHomeScreenState extends State { padding: const EdgeInsets.only(left: 16, right: 16), child: Row( children: [ - getButtonUI(CategoryType.ui, categoryType == CategoryType.ui), + getButtonUI(CategoryType.ui, + isSelected: categoryType == CategoryType.ui), const SizedBox( width: 16, ), - getButtonUI( - CategoryType.coding, categoryType == CategoryType.coding), + getButtonUI(CategoryType.coding, + isSelected: categoryType == CategoryType.coding), const SizedBox( width: 16, ), - getButtonUI( - CategoryType.basic, categoryType == CategoryType.basic), + getButtonUI(CategoryType.basic, + isSelected: categoryType == CategoryType.basic), ], ), ), @@ -105,7 +105,7 @@ class _DesignCourseHomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Popular Course', textAlign: TextAlign.left, style: TextStyle( @@ -131,12 +131,12 @@ class _DesignCourseHomeScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => CourseInfoScreen(), + builder: (BuildContext context) => const CourseInfoScreen(), ), ); } - Widget getButtonUI(CategoryType categoryTypeData, bool isSelected) { + Widget getButtonUI(CategoryType categoryTypeData, {bool isSelected = false}) { String txt = ''; if (CategoryType.ui == categoryTypeData) { txt = 'Ui/Ux'; @@ -159,9 +159,11 @@ class _DesignCourseHomeScreenState extends State { splashColor: Colors.white24, borderRadius: const BorderRadius.all(Radius.circular(24.0)), onTap: () { - setState(() { - categoryType = categoryTypeData; - }); + if (mounted) { + setState(() { + categoryType = categoryTypeData; + }); + } }, child: Padding( padding: const EdgeInsets.only( @@ -194,15 +196,15 @@ class _DesignCourseHomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( + SizedBox( width: MediaQuery.of(context).size.width * 0.75, height: 64, child: Padding( padding: const EdgeInsets.only(top: 8, bottom: 8), child: Container( - decoration: BoxDecoration( - color: HexColor('#F8FAFB'), - borderRadius: const BorderRadius.only( + decoration: const BoxDecoration( + color: Color(0xFFF8FAFB), + borderRadius: BorderRadius.only( bottomRight: Radius.circular(13.0), bottomLeft: Radius.circular(13.0), topLeft: Radius.circular(13.0), @@ -215,36 +217,35 @@ class _DesignCourseHomeScreenState extends State { child: Container( padding: const EdgeInsets.only(left: 16, right: 16), child: TextFormField( - style: TextStyle( + style: const TextStyle( fontFamily: 'WorkSans', fontWeight: FontWeight.bold, fontSize: 16, color: DesignCourseAppTheme.nearlyBlue, ), keyboardType: TextInputType.text, - decoration: InputDecoration( + decoration: const InputDecoration( labelText: 'Search for course', border: InputBorder.none, helperStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 16, - color: HexColor('#B9BABC'), + color: Color(0xFFB9BABC), ), labelStyle: TextStyle( fontWeight: FontWeight.w600, fontSize: 16, letterSpacing: 0.2, - color: HexColor('#B9BABC'), + color: Color(0xFFB9BABC), ), ), - onEditingComplete: () {}, ), ), ), - SizedBox( + const SizedBox( width: 60, height: 60, - child: Icon(Icons.search, color: HexColor('#B9BABC')), + child: Icon(Icons.search, color: Color(0xFFB9BABC)), ) ], ), @@ -264,7 +265,7 @@ class _DesignCourseHomeScreenState extends State { padding: const EdgeInsets.only(top: 8.0, left: 18, right: 18), child: Row( children: [ - Expanded( + const Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, @@ -292,7 +293,7 @@ class _DesignCourseHomeScreenState extends State { ], ), ), - Container( + SizedBox( width: 60, height: 60, child: Image.asset('assets/design_course/userImage.png'), diff --git a/best_flutter_ui_templates/lib/design_course/models/category.dart b/lib/design_course/models/category.dart similarity index 100% rename from best_flutter_ui_templates/lib/design_course/models/category.dart rename to lib/design_course/models/category.dart diff --git a/lib/design_course/popular_course_list_view.dart b/lib/design_course/popular_course_list_view.dart new file mode 100644 index 00000000..d662e809 --- /dev/null +++ b/lib/design_course/popular_course_list_view.dart @@ -0,0 +1,249 @@ +import 'package:flutter/material.dart'; + +import 'design_course_app_theme.dart'; +import 'models/category.dart'; + +class PopularCourseListView extends StatefulWidget { + const PopularCourseListView({ + required this.callBack, + super.key, + }); + + final Function() callBack; + + @override + State createState() => _PopularCourseListViewState(); +} + +class _PopularCourseListViewState extends State + with TickerProviderStateMixin { + late final AnimationController animationController; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + Future getData() async { + await Future.delayed(const Duration(milliseconds: 200)); + return true; + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(top: 8), + child: FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return const SizedBox(); + } else { + return GridView( + padding: const EdgeInsets.all(8), + physics: const BouncingScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisSpacing: 32.0, + crossAxisSpacing: 32.0, + childAspectRatio: 0.8, + ), + children: List.generate( + Category.popularCourseList.length, + (int index) { + final int count = Category.popularCourseList.length; + final Animation animation = + Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: Interval((1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn), + ), + ); + animationController.forward(); + return CategoryView( + callback: () { + widget.callBack(); + }, + category: Category.popularCourseList[index], + animation: animation, + animationController: animationController, + ); + }, + ), + ); + } + }, + ), + ); + } +} + +class CategoryView extends StatelessWidget { + const CategoryView({ + required this.category, + required this.animationController, + required this.animation, + required this.callback, + super.key, + }); + + final VoidCallback callback; + final Category category; + final AnimationController animationController; + final Animation animation; + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: animationController, + builder: (BuildContext context, _) { + return FadeTransition( + opacity: animation, + child: Transform( + transform: Matrix4.translationValues( + 0.0, 50 * (1.0 - animation.value), 0.0), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all(Radius.circular(16.0)), + onTap: () => callback(), + child: SizedBox( + height: 280, + child: Stack( + alignment: AlignmentDirectional.bottomCenter, + children: [ + Column( + children: [ + Expanded( + child: Ink( + decoration: const BoxDecoration( + color: Color(0xFFF8FAFB), + borderRadius: + BorderRadius.all(Radius.circular(16.0)), + // border: Border.all( + // color: DesignCourseAppTheme.notWhite), + ), + child: Column( + children: [ + Expanded( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.only( + top: 16, left: 16, right: 16), + child: Text( + category.title, + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + letterSpacing: 0.27, + color: DesignCourseAppTheme + .darkerText, + ), + ), + ), + Padding( + padding: const EdgeInsets.only( + top: 8, + left: 16, + right: 16, + bottom: 8), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '${category.lessonCount} lesson', + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w200, + fontSize: 12, + letterSpacing: 0.27, + color: + DesignCourseAppTheme.grey, + ), + ), + Row( + children: [ + Text( + '${category.rating}', + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: + FontWeight.w200, + fontSize: 18, + letterSpacing: 0.27, + color: + DesignCourseAppTheme + .grey, + ), + ), + const Icon( + Icons.star, + color: DesignCourseAppTheme + .nearlyBlue, + size: 20, + ), + ], + ), + ], + ), + ), + ], + ), + ), + const SizedBox( + width: 48, + ), + ], + ), + ), + ), + const SizedBox( + height: 48, + ), + ], + ), + Padding( + padding: + const EdgeInsets.only(top: 24, right: 16, left: 16), + child: Container( + decoration: BoxDecoration( + borderRadius: + const BorderRadius.all(Radius.circular(16.0)), + boxShadow: [ + BoxShadow( + color: DesignCourseAppTheme.grey + .withOpacity(0.2), + blurRadius: 6.0), + ], + ), + child: ClipRRect( + borderRadius: + const BorderRadius.all(Radius.circular(16.0)), + child: AspectRatio( + aspectRatio: 1.28, + child: Image.asset(category.imagePath)), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/feedback_screen.dart b/lib/feedback_screen.dart new file mode 100644 index 00000000..6a1fcf78 --- /dev/null +++ b/lib/feedback_screen.dart @@ -0,0 +1,135 @@ +import 'package:flutter/material.dart'; + +import 'app_theme.dart'; + +class FeedbackScreen extends StatefulWidget { + const FeedbackScreen({super.key}); + + @override + State createState() => _FeedbackScreenState(); +} + +class _FeedbackScreenState extends State { + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: SizedBox( + height: MediaQuery.of(context).size.height, + child: Column( + children: [ + Container( + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top, left: 16, right: 16), + child: Image.asset('assets/images/feedbackImage.png'), + ), + Container( + padding: const EdgeInsets.only(top: 8), + child: const Text( + 'Your Feedback', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + padding: const EdgeInsets.only(top: 16), + child: const Text( + 'Give your best time for this moment.', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + ), + ), + ), + _buildComposer(), + Expanded( + child: Padding( + padding: const EdgeInsets.only(top: 16), + child: Center( + child: Container( + width: 120, + height: 40, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: + const BorderRadius.all(Radius.circular(4.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + offset: const Offset(4, 4), + blurRadius: 8.0), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: () => + FocusScope.of(context).requestFocus(FocusNode()), + child: const Center( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Text( + 'Send', + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ), + ), + ), + ), + ), + ), + ), + ), + ) + ], + ), + ), + ); + } + + Widget _buildComposer() { + return Padding( + padding: const EdgeInsets.only(top: 16, left: 32, right: 32), + child: Container( + decoration: BoxDecoration( + color: AppTheme.white, + borderRadius: BorderRadius.circular(8), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.8), + offset: const Offset(4, 4), + blurRadius: 8), + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(25), + child: Container( + padding: const EdgeInsets.all(4.0), + constraints: const BoxConstraints(minHeight: 80, maxHeight: 160), + color: AppTheme.white, + child: SingleChildScrollView( + padding: const EdgeInsets.only(left: 10, right: 10), + child: TextField( + maxLines: null, + onChanged: (String txt) {}, + textInputAction: TextInputAction.done, + style: const TextStyle( + fontFamily: AppTheme.fontName, + fontSize: 16, + color: AppTheme.darkGrey, + ), + cursorColor: Colors.blue, + decoration: const InputDecoration( + border: InputBorder.none, + hintText: 'Enter your feedback...'), + ), + ), + ), + ), + ), + ); + } +} diff --git a/best_flutter_ui_templates/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart b/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart similarity index 79% rename from best_flutter_ui_templates/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart rename to lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart index db7db99a..c622a84a 100644 --- a/best_flutter_ui_templates/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart +++ b/lib/fitness_app/bottom_navigation_view/bottom_bar_view.dart @@ -1,36 +1,43 @@ import 'dart:math' as math; -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; -import 'package:best_flutter_ui_templates/fitness_app/models/tabIcon_data.dart'; -import 'package:best_flutter_ui_templates/main.dart'; + import 'package:flutter/material.dart'; -import '../../main.dart'; -import '../models/tabIcon_data.dart'; +import '../fitness_app_theme.dart'; +import '../models/tab_icon_data.dart'; class BottomBarView extends StatefulWidget { - const BottomBarView( - {Key key, this.tabIconsList, this.changeIndex, this.addClick}) - : super(key: key); + const BottomBarView({ + required this.tabIconsList, + required this.changeIndex, + required this.addClick, + super.key, + }); - final Function(int index) changeIndex; - final Function addClick; final List tabIconsList; + final Function(int index) changeIndex; + final Function() addClick; + @override - _BottomBarViewState createState() => _BottomBarViewState(); + State createState() => _BottomBarViewState(); } class _BottomBarViewState extends State with TickerProviderStateMixin { - AnimationController animationController; - + late final AnimationController animationController; @override void initState() { + super.initState(); animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 1000), ); animationController.forward(); - super.initState(); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); } @override @@ -40,11 +47,11 @@ class _BottomBarViewState extends State children: [ AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return Transform( transform: Matrix4.translationValues(0.0, 0.0, 0.0), child: PhysicalShape( - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, elevation: 16.0, clipper: TabClipper( radius: Tween(begin: 0.0, end: 1.0) @@ -134,7 +141,6 @@ class _BottomBarViewState extends State child: Padding( padding: const EdgeInsets.all(8.0), child: ScaleTransition( - alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: animationController, @@ -142,18 +148,18 @@ class _BottomBarViewState extends State child: Container( // alignment: Alignment.center,s decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue, - gradient: LinearGradient( - colors: [ - FintnessAppTheme.nearlyDarkBlue, - HexColor('#6A88E5'), + color: FitnessAppTheme.nearlyDarkBlue, + gradient: const LinearGradient( + colors: [ + FitnessAppTheme.nearlyDarkBlue, + Color(0xFF6A88E5), ], begin: Alignment.topLeft, end: Alignment.bottomRight), shape: BoxShape.circle, boxShadow: [ BoxShadow( - color: FintnessAppTheme.nearlyDarkBlue + color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.4), offset: const Offset(8.0, 16.0), blurRadius: 16.0), @@ -168,9 +174,9 @@ class _BottomBarViewState extends State onTap: () { widget.addClick(); }, - child: Icon( + child: const Icon( Icons.add, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, size: 32, ), ), @@ -188,45 +194,52 @@ class _BottomBarViewState extends State void setRemoveAllSelection(TabIconData tabIconData) { if (!mounted) return; - setState(() { - widget.tabIconsList.forEach((TabIconData tab) { - tab.isSelected = false; - if (tabIconData.index == tab.index) { - tab.isSelected = true; + if (mounted) { + setState(() { + for (final TabIconData tab in widget.tabIconsList) { + tab.isSelected = false; + if (tabIconData.index == tab.index) { + tab.isSelected = true; + } } }); - }); + } } } class TabIcons extends StatefulWidget { - const TabIcons({Key key, this.tabIconData, this.removeAllSelect}) - : super(key: key); + const TabIcons({ + required this.tabIconData, + required this.removeAllSelect, + super.key, + }); final TabIconData tabIconData; - final Function removeAllSelect; + final Function() removeAllSelect; + @override - _TabIconsState createState() => _TabIconsState(); + State createState() => _TabIconsState(); } class _TabIconsState extends State with TickerProviderStateMixin { + late final AnimationController animationController; @override void initState() { - widget.tabIconData.animationController = AnimationController( + animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 400), )..addStatusListener((AnimationStatus status) { if (status == AnimationStatus.completed) { if (!mounted) return; widget.removeAllSelect(); - widget.tabIconData.animationController.reverse(); + animationController.reverse(); } }); super.initState(); } void setAnimation() { - widget.tabIconData.animationController.forward(); + animationController.forward(); } @override @@ -249,12 +262,11 @@ class _TabIconsState extends State with TickerProviderStateMixin { alignment: AlignmentDirectional.center, children: [ ScaleTransition( - alignment: Alignment.center, scale: Tween(begin: 0.88, end: 1.0).animate( CurvedAnimation( - parent: widget.tabIconData.animationController, - curve: - Interval(0.1, 1.0, curve: Curves.fastOutSlowIn))), + parent: animationController, + curve: const Interval(0.1, 1.0, + curve: Curves.fastOutSlowIn))), child: Image.asset(widget.tabIconData.isSelected ? widget.tabIconData.selectedImagePath : widget.tabIconData.imagePath), @@ -264,17 +276,16 @@ class _TabIconsState extends State with TickerProviderStateMixin { left: 6, right: 0, child: ScaleTransition( - alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( - parent: widget.tabIconData.animationController, - curve: Interval(0.2, 1.0, + parent: animationController, + curve: const Interval(0.2, 1.0, curve: Curves.fastOutSlowIn))), child: Container( width: 8, height: 8, - decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue, + decoration: const BoxDecoration( + color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), @@ -285,17 +296,16 @@ class _TabIconsState extends State with TickerProviderStateMixin { left: 6, bottom: 8, child: ScaleTransition( - alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( - parent: widget.tabIconData.animationController, - curve: Interval(0.5, 0.8, + parent: animationController, + curve: const Interval(0.5, 0.8, curve: Curves.fastOutSlowIn))), child: Container( width: 4, height: 4, - decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue, + decoration: const BoxDecoration( + color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), @@ -306,17 +316,16 @@ class _TabIconsState extends State with TickerProviderStateMixin { right: 8, bottom: 0, child: ScaleTransition( - alignment: Alignment.center, scale: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( - parent: widget.tabIconData.animationController, - curve: Interval(0.5, 0.6, + parent: animationController, + curve: const Interval(0.5, 0.6, curve: Curves.fastOutSlowIn))), child: Container( width: 6, height: 6, - decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue, + decoration: const BoxDecoration( + color: FitnessAppTheme.nearlyDarkBlue, shape: BoxShape.circle, ), ), diff --git a/lib/fitness_app/fitness_app_home_screen.dart b/lib/fitness_app/fitness_app_home_screen.dart new file mode 100644 index 00000000..13151804 --- /dev/null +++ b/lib/fitness_app/fitness_app_home_screen.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; + +import 'bottom_navigation_view/bottom_bar_view.dart'; +import 'fitness_app_theme.dart'; +import 'models/tab_icon_data.dart'; +import 'my_diary/my_diary_screen.dart'; +import 'training/training_screen.dart'; + +class FitnessAppHomeScreen extends StatefulWidget { + const FitnessAppHomeScreen({super.key}); + + @override + State createState() => _FitnessAppHomeScreenState(); +} + +class _FitnessAppHomeScreenState extends State + with TickerProviderStateMixin { + List tabIconsList = TabIconData.tabIconsList; + + Widget tabBody = Container( + color: FitnessAppTheme.background, + ); + + late final AnimationController animationController; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 600), vsync: this); + for (final TabIconData tab in tabIconsList) { + tab.isSelected = false; + } + tabIconsList[0].isSelected = true; + tabBody = MyDiaryScreen(animationController: animationController); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Material( + color: FitnessAppTheme.background, + child: FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return const SizedBox(); + } else { + return Stack( + children: [ + tabBody, + bottomBar(), + ], + ); + } + }, + ), + ); + } + + Future getData() async { + await Future.delayed(const Duration(milliseconds: 200)); + return true; + } + + Widget bottomBar() { + return Column( + children: [ + const Expanded( + child: SizedBox(), + ), + BottomBarView( + tabIconsList: tabIconsList, + addClick: () {}, + changeIndex: (int index) { + if (index == 0 || index == 2) { + animationController.reverse().then((_) { + if (mounted) { + setState(() { + tabBody = + MyDiaryScreen(animationController: animationController); + }); + } + return; + }); + } else if (index == 1 || index == 3) { + animationController.reverse().then((_) { + if (mounted) { + setState(() { + tabBody = TrainingScreen( + animationController: animationController); + }); + } + return; + }); + } + }, + ), + ], + ); + } +} diff --git a/best_flutter_ui_templates/lib/fitness_app/fintness_app_theme.dart b/lib/fitness_app/fitness_app_theme.dart similarity index 88% rename from best_flutter_ui_templates/lib/fitness_app/fintness_app_theme.dart rename to lib/fitness_app/fitness_app_theme.dart index 437cb91e..085fddac 100644 --- a/best_flutter_ui_templates/lib/fitness_app/fintness_app_theme.dart +++ b/lib/fitness_app/fitness_app_theme.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -class FintnessAppTheme { - FintnessAppTheme._(); +class FitnessAppTheme { + FitnessAppTheme._(); static const Color nearlyWhite = Color(0xFFFAFAFA); static const Color white = Color(0xFFFFFFFF); static const Color background = Color(0xFFF2F3F8); @@ -10,7 +10,7 @@ class FintnessAppTheme { static const Color nearlyBlue = Color(0xFF00B6F0); static const Color nearlyBlack = Color(0xFF213333); static const Color grey = Color(0xFF3A5160); - static const Color dark_grey = Color(0xFF313A44); + static const Color darkGrey = Color(0xFF313A44); static const Color darkText = Color(0xFF253840); static const Color darkerText = Color(0xFF17262A); @@ -21,13 +21,13 @@ class FintnessAppTheme { static const String fontName = 'Roboto'; static const TextTheme textTheme = TextTheme( - headline4: display1, - headline5: headline, - headline6: title, - subtitle2: subtitle, - bodyText2: body2, - bodyText1: body1, - caption: caption, + headlineMedium: display1, + headlineSmall: headline, + titleLarge: title, + titleSmall: subtitle, + bodyMedium: body2, + bodyLarge: body1, + bodySmall: caption, ); static const TextStyle display1 = TextStyle( diff --git a/best_flutter_ui_templates/lib/fitness_app/models/meals_list_data.dart b/lib/fitness_app/models/meals_list_data.dart similarity index 59% rename from best_flutter_ui_templates/lib/fitness_app/models/meals_list_data.dart rename to lib/fitness_app/models/meals_list_data.dart index faef4d92..db12a11b 100644 --- a/best_flutter_ui_templates/lib/fitness_app/models/meals_list_data.dart +++ b/lib/fitness_app/models/meals_list_data.dart @@ -1,52 +1,52 @@ +import 'package:flutter/material.dart'; + class MealsListData { MealsListData({ + required this.meals, this.imagePath = '', this.titleTxt = '', - this.startColor = '', - this.endColor = '', - this.meals, - this.kacl = 0, + this.startColor = Colors.grey, + this.endColor = Colors.grey, + this.kcal = 0, }); String imagePath; String titleTxt; - String startColor; - String endColor; + Color startColor; + Color endColor; List meals; - int kacl; + int kcal; static List tabIconsList = [ MealsListData( imagePath: 'assets/fitness_app/breakfast.png', titleTxt: 'Breakfast', - kacl: 525, + kcal: 525, meals: ['Bread,', 'Peanut butter,', 'Apple'], - startColor: '#FA7D82', - endColor: '#FFB295', + startColor: const Color(0xFFFA7D82), + endColor: const Color(0xFFFFB295), ), MealsListData( imagePath: 'assets/fitness_app/lunch.png', titleTxt: 'Lunch', - kacl: 602, + kcal: 602, meals: ['Salmon,', 'Mixed veggies,', 'Avocado'], - startColor: '#738AE6', - endColor: '#5C5EDD', + startColor: const Color(0xFF738AE6), + endColor: const Color(0xFF5C5EDD), ), MealsListData( imagePath: 'assets/fitness_app/snack.png', titleTxt: 'Snack', - kacl: 0, meals: ['Recommend:', '800 kcal'], - startColor: '#FE95B6', - endColor: '#FF5287', + startColor: const Color(0xFFFE95B6), + endColor: const Color(0xFFFF5287), ), MealsListData( imagePath: 'assets/fitness_app/dinner.png', titleTxt: 'Dinner', - kacl: 0, meals: ['Recommend:', '703 kcal'], - startColor: '#6F72CA', - endColor: '#1E1466', + startColor: const Color(0xFF6F72CA), + endColor: const Color(0xFF1E1466), ), ]; } diff --git a/best_flutter_ui_templates/lib/fitness_app/models/tabIcon_data.dart b/lib/fitness_app/models/tab_icon_data.dart similarity index 72% rename from best_flutter_ui_templates/lib/fitness_app/models/tabIcon_data.dart rename to lib/fitness_app/models/tab_icon_data.dart index ddd3be75..d24c551e 100644 --- a/best_flutter_ui_templates/lib/fitness_app/models/tabIcon_data.dart +++ b/lib/fitness_app/models/tab_icon_data.dart @@ -1,12 +1,9 @@ -import 'package:flutter/material.dart'; - class TabIconData { TabIconData({ this.imagePath = '', this.index = 0, this.selectedImagePath = '', this.isSelected = false, - this.animationController, }); String imagePath; @@ -14,36 +11,26 @@ class TabIconData { bool isSelected; int index; - AnimationController animationController; - static List tabIconsList = [ TabIconData( imagePath: 'assets/fitness_app/tab_1.png', selectedImagePath: 'assets/fitness_app/tab_1s.png', - index: 0, isSelected: true, - animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_2.png', selectedImagePath: 'assets/fitness_app/tab_2s.png', index: 1, - isSelected: false, - animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_3.png', selectedImagePath: 'assets/fitness_app/tab_3s.png', index: 2, - isSelected: false, - animationController: null, ), TabIconData( imagePath: 'assets/fitness_app/tab_4.png', selectedImagePath: 'assets/fitness_app/tab_4s.png', index: 3, - isSelected: false, - animationController: null, ), ]; } diff --git a/best_flutter_ui_templates/lib/fitness_app/my_diary/meals_list_view.dart b/lib/fitness_app/my_diary/meals_list_view.dart similarity index 58% rename from best_flutter_ui_templates/lib/fitness_app/my_diary/meals_list_view.dart rename to lib/fitness_app/my_diary/meals_list_view.dart index 6fe3c8d5..a934e73f 100644 --- a/best_flutter_ui_templates/lib/fitness_app/my_diary/meals_list_view.dart +++ b/lib/fitness_app/my_diary/meals_list_view.dart @@ -1,32 +1,32 @@ -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; -import 'package:best_flutter_ui_templates/fitness_app/models/meals_list_data.dart'; -import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; -import '../../main.dart'; +import '../fitness_app_theme.dart'; +import '../models/meals_list_data.dart'; class MealsListView extends StatefulWidget { - const MealsListView( - {Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) - : super(key: key); + const MealsListView({ + required this.mainScreenAnimationController, + required this.mainScreenAnimation, + super.key, + }); final AnimationController mainScreenAnimationController; - final Animation mainScreenAnimation; + final Animation mainScreenAnimation; @override - _MealsListViewState createState() => _MealsListViewState(); + State createState() => _MealsListViewState(); } class _MealsListViewState extends State with TickerProviderStateMixin { - AnimationController animationController; List mealsListData = MealsListData.tabIconsList; + late final AnimationController animationController; @override void initState() { + super.initState(); animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); - super.initState(); } Future getData() async { @@ -44,18 +44,17 @@ class _MealsListViewState extends State Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( transform: Matrix4.translationValues( 0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), - child: Container( + child: SizedBox( height: 216, width: double.infinity, child: ListView.builder( - padding: const EdgeInsets.only( - top: 0, bottom: 0, right: 16, left: 16), + padding: const EdgeInsets.only(right: 16, left: 16), itemCount: mealsListData.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { @@ -85,19 +84,22 @@ class _MealsListViewState extends State } class MealsView extends StatelessWidget { - const MealsView( - {Key key, this.mealsListData, this.animationController, this.animation}) - : super(key: key); + const MealsView({ + required this.mealsListData, + required this.animationController, + required this.animation, + super.key, + }); final MealsListData mealsListData; final AnimationController animationController; - final Animation animation; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (_, __) { return FadeTransition( opacity: animation, child: Transform( @@ -114,15 +116,14 @@ class MealsView extends StatelessWidget { decoration: BoxDecoration( boxShadow: [ BoxShadow( - color: HexColor(mealsListData.endColor) - .withOpacity(0.6), + color: mealsListData.endColor.withOpacity(0.6), offset: const Offset(1.1, 4.0), blurRadius: 8.0), ], gradient: LinearGradient( - colors: [ - HexColor(mealsListData.startColor), - HexColor(mealsListData.endColor), + colors: [ + mealsListData.startColor, + mealsListData.endColor ], begin: Alignment.topLeft, end: Alignment.bottomRight, @@ -144,12 +145,12 @@ class MealsView extends StatelessWidget { Text( mealsListData.titleTxt, textAlign: TextAlign.center, - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.bold, fontSize: 16, letterSpacing: 0.2, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), Expanded( @@ -157,77 +158,75 @@ class MealsView extends StatelessWidget { padding: const EdgeInsets.only(top: 8, bottom: 8), child: Row( - mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( mealsListData.meals.join('\n'), - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 10, letterSpacing: 0.2, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), ], ), ), ), - mealsListData.kacl != 0 - ? Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - mealsListData.kacl.toString(), - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, - fontWeight: FontWeight.w500, - fontSize: 24, - letterSpacing: 0.2, - color: FintnessAppTheme.white, - ), - ), - Padding( - padding: const EdgeInsets.only( - left: 4, bottom: 3), - child: Text( - 'kcal', - style: TextStyle( - fontFamily: - FintnessAppTheme.fontName, - fontWeight: FontWeight.w500, - fontSize: 10, - letterSpacing: 0.2, - color: FintnessAppTheme.white, - ), - ), - ), - ], - ) - : Container( - decoration: BoxDecoration( - color: FintnessAppTheme.nearlyWhite, - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - color: FintnessAppTheme.nearlyBlack - .withOpacity(0.4), - offset: Offset(8.0, 8.0), - blurRadius: 8.0), - ], + if (mealsListData.kcal != 0) + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + mealsListData.kcal.toString(), + textAlign: TextAlign.center, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, + fontWeight: FontWeight.w500, + fontSize: 24, + letterSpacing: 0.2, + color: FitnessAppTheme.white, ), - child: Padding( - padding: const EdgeInsets.all(6.0), - child: Icon( - Icons.add, - color: HexColor(mealsListData.endColor), - size: 24, + ), + const Padding( + padding: + EdgeInsets.only(left: 4, bottom: 3), + child: Text( + 'kcal', + style: TextStyle( + fontFamily: FitnessAppTheme.fontName, + fontWeight: FontWeight.w500, + fontSize: 10, + letterSpacing: 0.2, + color: FitnessAppTheme.white, ), ), ), + ], + ) + else + Container( + decoration: BoxDecoration( + color: FitnessAppTheme.nearlyWhite, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: FitnessAppTheme.nearlyBlack + .withOpacity(0.4), + offset: const Offset(8.0, 8.0), + blurRadius: 8.0), + ], + ), + child: Padding( + padding: const EdgeInsets.all(6.0), + child: Icon( + Icons.add, + color: mealsListData.endColor, + size: 24, + ), + ), + ), ], ), ), @@ -240,7 +239,7 @@ class MealsView extends StatelessWidget { width: 84, height: 84, decoration: BoxDecoration( - color: FintnessAppTheme.nearlyWhite.withOpacity(0.2), + color: FitnessAppTheme.nearlyWhite.withOpacity(0.2), shape: BoxShape.circle, ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/my_diary/my_diary_screen.dart b/lib/fitness_app/my_diary/my_diary_screen.dart similarity index 74% rename from best_flutter_ui_templates/lib/fitness_app/my_diary/my_diary_screen.dart rename to lib/fitness_app/my_diary/my_diary_screen.dart index ad4d0e16..24b1a0e4 100644 --- a/best_flutter_ui_templates/lib/fitness_app/my_diary/my_diary_screen.dart +++ b/lib/fitness_app/my_diary/my_diary_screen.dart @@ -1,59 +1,75 @@ -import 'package:best_flutter_ui_templates/fitness_app/ui_view/body_measurement.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/glass_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/mediterranesn_diet_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/title_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; -import 'package:best_flutter_ui_templates/fitness_app/my_diary/meals_list_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/my_diary/water_view.dart'; import 'package:flutter/material.dart'; +import '../fitness_app_theme.dart'; +import '../ui_view/body_measurement.dart'; +import '../ui_view/glass_view.dart'; +import '../ui_view/mediterranesn_diet_view.dart'; +import '../ui_view/title_view.dart'; +import 'meals_list_view.dart'; +import 'water_view.dart'; + class MyDiaryScreen extends StatefulWidget { - const MyDiaryScreen({Key key, this.animationController}) : super(key: key); + const MyDiaryScreen({ + required this.animationController, + super.key, + }); final AnimationController animationController; + @override - _MyDiaryScreenState createState() => _MyDiaryScreenState(); + State createState() => _MyDiaryScreenState(); } class _MyDiaryScreenState extends State with TickerProviderStateMixin { - Animation topBarAnimation; - List listViews = []; - final ScrollController scrollController = ScrollController(); double topBarOpacity = 0.0; + late final ScrollController scrollController; + late final Animation topBarAnimation; @override void initState() { + super.initState(); + scrollController = ScrollController(); topBarAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval(0, 0.5, curve: Curves.fastOutSlowIn))); + curve: const Interval(0, 0.5, curve: Curves.fastOutSlowIn))); addAllListData(); - scrollController.addListener(() { if (scrollController.offset >= 24) { if (topBarOpacity != 1.0) { - setState(() { - topBarOpacity = 1.0; - }); + if (mounted) { + setState(() { + topBarOpacity = 1.0; + }); + } } } else if (scrollController.offset <= 24 && scrollController.offset >= 0) { if (topBarOpacity != scrollController.offset / 24) { - setState(() { - topBarOpacity = scrollController.offset / 24; - }); + if (mounted) { + setState(() { + topBarOpacity = scrollController.offset / 24; + }); + } } } else if (scrollController.offset <= 0) { if (topBarOpacity != 0.0) { - setState(() { - topBarOpacity = 0.0; - }); + if (mounted) { + setState(() { + topBarOpacity = 0.0; + }); + } } } }); - super.initState(); + } + + @override + void dispose() { + scrollController.dispose(); + super.dispose(); } void addAllListData() { @@ -65,28 +81,30 @@ class _MyDiaryScreenState extends State subTxt: 'Details', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 0, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 0, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); + listViews.add( MediterranesnDietView( animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 1, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 1, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); + listViews.add( TitleView( titleTxt: 'Meals today', subTxt: 'Customize', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 2, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 2, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -96,7 +114,7 @@ class _MyDiaryScreenState extends State mainScreenAnimation: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval((1 / count) * 3, 1.0, + curve: const Interval((1 / count) * 3, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), @@ -108,8 +126,8 @@ class _MyDiaryScreenState extends State subTxt: 'Today', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 4, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 4, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -118,19 +136,20 @@ class _MyDiaryScreenState extends State BodyMeasurementView( animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 5, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 5, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); + listViews.add( TitleView( titleTxt: 'Water', subTxt: 'Aqua SmartBottle', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 6, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 6, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -140,17 +159,18 @@ class _MyDiaryScreenState extends State mainScreenAnimation: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval((1 / count) * 7, 1.0, + curve: const Interval((1 / count) * 7, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), ); + listViews.add( GlassView( animation: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval((1 / count) * 8, 1.0, + curve: const Interval((1 / count) * 8, 1.0, curve: Curves.fastOutSlowIn))), animationController: widget.animationController), ); @@ -163,19 +183,16 @@ class _MyDiaryScreenState extends State @override Widget build(BuildContext context) { - return Container( - color: FintnessAppTheme.background, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Stack( - children: [ - getMainListViewUI(), - getAppBarUI(), - SizedBox( - height: MediaQuery.of(context).padding.bottom, - ) - ], - ), + return Material( + color: FitnessAppTheme.background, + child: Stack( + children: [ + getMainListViewUI(), + getAppBarUI(), + SizedBox( + height: MediaQuery.of(context).padding.bottom, + ) + ], ), ); } @@ -196,7 +213,6 @@ class _MyDiaryScreenState extends State bottom: 62 + MediaQuery.of(context).padding.bottom, ), itemCount: listViews.length, - scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { widget.animationController.forward(); return listViews[index]; @@ -212,7 +228,7 @@ class _MyDiaryScreenState extends State children: [ AnimatedBuilder( animation: widget.animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: topBarAnimation, child: Transform( @@ -220,13 +236,13 @@ class _MyDiaryScreenState extends State 0.0, 30 * (1.0 - topBarAnimation.value), 0.0), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(topBarOpacity), + color: FitnessAppTheme.white.withOpacity(topBarOpacity), borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(32.0), ), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.4 * topBarOpacity), offset: const Offset(1.1, 1.1), blurRadius: 10.0), @@ -253,11 +269,11 @@ class _MyDiaryScreenState extends State 'My Diary', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w700, fontSize: 22 + 6 - 6 * topBarOpacity, letterSpacing: 1.2, - color: FintnessAppTheme.darkerText, + color: FitnessAppTheme.darkerText, ), ), ), @@ -270,26 +286,26 @@ class _MyDiaryScreenState extends State borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, - child: Center( + child: const Center( child: Icon( Icons.keyboard_arrow_left, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, ), ), ), ), - Padding( - padding: const EdgeInsets.only( + const Padding( + padding: EdgeInsets.only( left: 8, right: 8, ), child: Row( children: [ Padding( - padding: const EdgeInsets.only(right: 8), + padding: EdgeInsets.only(right: 8), child: Icon( Icons.calendar_today, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, size: 18, ), ), @@ -297,11 +313,11 @@ class _MyDiaryScreenState extends State '15 May', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 18, letterSpacing: -0.2, - color: FintnessAppTheme.darkerText, + color: FitnessAppTheme.darkerText, ), ), ], @@ -315,10 +331,10 @@ class _MyDiaryScreenState extends State borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, - child: Center( + child: const Center( child: Icon( Icons.keyboard_arrow_right, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, ), ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/my_diary/water_view.dart b/lib/fitness_app/my_diary/water_view.dart similarity index 65% rename from best_flutter_ui_templates/lib/fitness_app/my_diary/water_view.dart rename to lib/fitness_app/my_diary/water_view.dart index 417881ad..91f5f382 100644 --- a/best_flutter_ui_templates/lib/fitness_app/my_diary/water_view.dart +++ b/lib/fitness_app/my_diary/water_view.dart @@ -1,16 +1,20 @@ -import 'package:best_flutter_ui_templates/fitness_app/ui_view/wave_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; -import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; +import '../fitness_app_theme.dart'; +import '../ui_view/wave_view.dart'; + class WaterView extends StatefulWidget { - const WaterView({Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) : super(key: key); + const WaterView({ + required this.mainScreenAnimationController, + required this.mainScreenAnimation, + super.key, + }); final AnimationController mainScreenAnimationController; - final Animation mainScreenAnimation; + final Animation mainScreenAnimation; @override - _WaterViewState createState() => _WaterViewState(); + State createState() => _WaterViewState(); } class _WaterViewState extends State with TickerProviderStateMixin { @@ -23,92 +27,102 @@ class _WaterViewState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( - transform: Matrix4.translationValues(0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), + transform: Matrix4.translationValues( + 0.0, 30 * (1.0 - widget.mainScreenAnimation.value), 0.0), child: Padding( - padding: const EdgeInsets.only(left: 24, right: 24, top: 16, bottom: 18), + padding: const EdgeInsets.only( + left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: [ - BoxShadow(color: FintnessAppTheme.grey.withOpacity(0.2), offset: const Offset(1.1, 1.1), blurRadius: 10.0), + BoxShadow( + color: FitnessAppTheme.grey.withOpacity(0.2), + offset: const Offset(1.1, 1.1), + blurRadius: 10.0), ], ), child: Padding( - padding: const EdgeInsets.only(top: 16, left: 16, right: 16, bottom: 16), + padding: const EdgeInsets.only( + top: 16, left: 16, right: 16, bottom: 16), child: Row( children: [ Expanded( child: Column( children: [ - Column( + const Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(left: 4, bottom: 3), + padding: + EdgeInsets.only(left: 4, bottom: 3), child: Text( '2100', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 32, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), ), Padding( - padding: const EdgeInsets.only(left: 8, bottom: 8), + padding: + EdgeInsets.only(left: 8, bottom: 8), child: Text( 'ml', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: -0.2, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), ), ], ), Padding( - padding: const EdgeInsets.only(left: 4, top: 2, bottom: 14), + padding: EdgeInsets.only( + left: 4, top: 2, bottom: 14), child: Text( 'of daily goal 3.5L', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), ), ], ), Padding( - padding: const EdgeInsets.only(left: 4, right: 4, top: 8, bottom: 16), + padding: const EdgeInsets.only( + left: 4, right: 4, top: 8, bottom: 16), child: Container( height: 2, - decoration: BoxDecoration( - color: FintnessAppTheme.background, - borderRadius: const BorderRadius.all(Radius.circular(4.0)), + decoration: const BoxDecoration( + color: FitnessAppTheme.background, + borderRadius: + BorderRadius.all(Radius.circular(4.0)), ), ), ), @@ -119,28 +133,30 @@ class _WaterViewState extends State with TickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.end, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.only(left: 4), child: Icon( Icons.access_time, - color: FintnessAppTheme.grey.withOpacity(0.5), + color: FitnessAppTheme.grey + .withOpacity(0.5), size: 16, ), ), Padding( - padding: const EdgeInsets.only(left: 4.0), + padding: + const EdgeInsets.only(left: 4.0), child: Text( 'Last drink 8:26 AM', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.grey.withOpacity(0.5), + color: FitnessAppTheme.grey + .withOpacity(0.5), ), ), ), @@ -149,24 +165,24 @@ class _WaterViewState extends State with TickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 4), child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( width: 24, height: 24, - child: Image.asset('assets/fitness_app/bell.png'), + child: Image.asset( + 'assets/fitness_app/bell.png'), ), - Flexible( + const Flexible( child: Text( 'Your bottle is empty, refill it!.', textAlign: TextAlign.start, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 12, letterSpacing: 0.0, - color: HexColor('#F65283'), + color: Color(0xFFF65283), ), ), ), @@ -183,21 +199,24 @@ class _WaterViewState extends State with TickerProviderStateMixin { width: 34, child: Column( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( decoration: BoxDecoration( - color: FintnessAppTheme.nearlyWhite, + color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: [ - BoxShadow(color: FintnessAppTheme.nearlyDarkBlue.withOpacity(0.4), offset: const Offset(4.0, 4.0), blurRadius: 8.0), + BoxShadow( + color: FitnessAppTheme.nearlyDarkBlue + .withOpacity(0.4), + offset: const Offset(4.0, 4.0), + blurRadius: 8.0), ], ), - child: Padding( - padding: const EdgeInsets.all(6.0), + child: const Padding( + padding: EdgeInsets.all(6.0), child: Icon( Icons.add, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, size: 24, ), ), @@ -207,17 +226,21 @@ class _WaterViewState extends State with TickerProviderStateMixin { ), Container( decoration: BoxDecoration( - color: FintnessAppTheme.nearlyWhite, + color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: [ - BoxShadow(color: FintnessAppTheme.nearlyDarkBlue.withOpacity(0.4), offset: const Offset(4.0, 4.0), blurRadius: 8.0), + BoxShadow( + color: FitnessAppTheme.nearlyDarkBlue + .withOpacity(0.4), + offset: const Offset(4.0, 4.0), + blurRadius: 8.0), ], ), - child: Padding( - padding: const EdgeInsets.all(6.0), + child: const Padding( + padding: EdgeInsets.all(6.0), child: Icon( Icons.remove, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, size: 24, ), ), @@ -226,22 +249,26 @@ class _WaterViewState extends State with TickerProviderStateMixin { ), ), Padding( - padding: const EdgeInsets.only(left: 16, right: 8, top: 16), + padding: + const EdgeInsets.only(left: 16, right: 8, top: 16), child: Container( width: 60, height: 160, decoration: BoxDecoration( - color: HexColor('#E8EDFE'), + color: const Color(0xFFE8EDFE), borderRadius: const BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), boxShadow: [ - BoxShadow(color: FintnessAppTheme.grey.withOpacity(0.4), offset: const Offset(2, 2), blurRadius: 4), + BoxShadow( + color: FitnessAppTheme.grey.withOpacity(0.4), + offset: const Offset(2, 2), + blurRadius: 4), ], ), - child: WaveView( + child: const WaveView( percentageValue: 60.0, ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/traning/training_screen.dart b/lib/fitness_app/training/training_screen.dart similarity index 75% rename from best_flutter_ui_templates/lib/fitness_app/traning/training_screen.dart rename to lib/fitness_app/training/training_screen.dart index e7f5c50e..700ae1cc 100644 --- a/best_flutter_ui_templates/lib/fitness_app/traning/training_screen.dart +++ b/lib/fitness_app/training/training_screen.dart @@ -1,58 +1,73 @@ -import 'package:best_flutter_ui_templates/fitness_app/ui_view/area_list_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/running_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/title_view.dart'; -import 'package:best_flutter_ui_templates/fitness_app/ui_view/workout_view.dart'; import 'package:flutter/material.dart'; -import '../fintness_app_theme.dart'; +import '../fitness_app_theme.dart'; +import '../ui_view/area_list_view.dart'; +import '../ui_view/running_view.dart'; +import '../ui_view/title_view.dart'; +import '../ui_view/workout_view.dart'; class TrainingScreen extends StatefulWidget { - const TrainingScreen({Key key, this.animationController}) : super(key: key); + const TrainingScreen({ + required this.animationController, + super.key, + }); final AnimationController animationController; + @override - _TrainingScreenState createState() => _TrainingScreenState(); + State createState() => _TrainingScreenState(); } class _TrainingScreenState extends State with TickerProviderStateMixin { - Animation topBarAnimation; - List listViews = []; - final ScrollController scrollController = ScrollController(); double topBarOpacity = 0.0; + late final ScrollController scrollController; + late final Animation topBarAnimation; @override void initState() { + super.initState(); + scrollController = ScrollController(); topBarAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval(0, 0.5, curve: Curves.fastOutSlowIn))); + curve: const Interval(0, 0.5, curve: Curves.fastOutSlowIn))); addAllListData(); - scrollController.addListener(() { if (scrollController.offset >= 24) { if (topBarOpacity != 1.0) { - setState(() { - topBarOpacity = 1.0; - }); + if (mounted) { + setState(() { + topBarOpacity = 1.0; + }); + } } } else if (scrollController.offset <= 24 && scrollController.offset >= 0) { if (topBarOpacity != scrollController.offset / 24) { - setState(() { - topBarOpacity = scrollController.offset / 24; - }); + if (mounted) { + setState(() { + topBarOpacity = scrollController.offset / 24; + }); + } } } else if (scrollController.offset <= 0) { if (topBarOpacity != 0.0) { - setState(() { - topBarOpacity = 0.0; - }); + if (mounted) { + setState(() { + topBarOpacity = 0.0; + }); + } } } }); - super.initState(); + } + + @override + void dispose() { + scrollController.dispose(); + super.dispose(); } void addAllListData() { @@ -64,8 +79,8 @@ class _TrainingScreenState extends State subTxt: 'Details', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 0, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 0, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -74,17 +89,18 @@ class _TrainingScreenState extends State WorkoutView( animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 2, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 2, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); + listViews.add( RunningView( animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 3, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 3, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -95,8 +111,8 @@ class _TrainingScreenState extends State subTxt: 'more', animation: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( parent: widget.animationController, - curve: - Interval((1 / count) * 4, 1.0, curve: Curves.fastOutSlowIn))), + curve: const Interval((1 / count) * 4, 1.0, + curve: Curves.fastOutSlowIn))), animationController: widget.animationController, ), ); @@ -106,7 +122,7 @@ class _TrainingScreenState extends State mainScreenAnimation: Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( parent: widget.animationController, - curve: Interval((1 / count) * 5, 1.0, + curve: const Interval((1 / count) * 5, 1.0, curve: Curves.fastOutSlowIn))), mainScreenAnimationController: widget.animationController, ), @@ -120,19 +136,16 @@ class _TrainingScreenState extends State @override Widget build(BuildContext context) { - return Container( - color: FintnessAppTheme.background, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Stack( - children: [ - getMainListViewUI(), - getAppBarUI(), - SizedBox( - height: MediaQuery.of(context).padding.bottom, - ) - ], - ), + return Material( + color: FitnessAppTheme.background, + child: Stack( + children: [ + getMainListViewUI(), + getAppBarUI(), + SizedBox( + height: MediaQuery.of(context).padding.bottom, + ) + ], ), ); } @@ -153,7 +166,6 @@ class _TrainingScreenState extends State bottom: 62 + MediaQuery.of(context).padding.bottom, ), itemCount: listViews.length, - scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { widget.animationController.forward(); return listViews[index]; @@ -169,7 +181,7 @@ class _TrainingScreenState extends State children: [ AnimatedBuilder( animation: widget.animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: topBarAnimation, child: Transform( @@ -177,13 +189,13 @@ class _TrainingScreenState extends State 0.0, 30 * (1.0 - topBarAnimation.value), 0.0), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(topBarOpacity), + color: FitnessAppTheme.white.withOpacity(topBarOpacity), borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(32.0), ), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.4 * topBarOpacity), offset: const Offset(1.1, 1.1), blurRadius: 10.0), @@ -210,11 +222,11 @@ class _TrainingScreenState extends State 'Training', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w700, fontSize: 22 + 6 - 6 * topBarOpacity, letterSpacing: 1.2, - color: FintnessAppTheme.darkerText, + color: FitnessAppTheme.darkerText, ), ), ), @@ -227,26 +239,26 @@ class _TrainingScreenState extends State borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, - child: Center( + child: const Center( child: Icon( Icons.keyboard_arrow_left, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, ), ), ), ), - Padding( - padding: const EdgeInsets.only( + const Padding( + padding: EdgeInsets.only( left: 8, right: 8, ), child: Row( children: [ Padding( - padding: const EdgeInsets.only(right: 8), + padding: EdgeInsets.only(right: 8), child: Icon( Icons.calendar_today, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, size: 18, ), ), @@ -254,11 +266,11 @@ class _TrainingScreenState extends State '15 May', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 18, letterSpacing: -0.2, - color: FintnessAppTheme.darkerText, + color: FitnessAppTheme.darkerText, ), ), ], @@ -272,10 +284,10 @@ class _TrainingScreenState extends State borderRadius: const BorderRadius.all( Radius.circular(32.0)), onTap: () {}, - child: Center( + child: const Center( child: Icon( Icons.keyboard_arrow_right, - color: FintnessAppTheme.grey, + color: FitnessAppTheme.grey, ), ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/area_list_view.dart b/lib/fitness_app/ui_view/area_list_view.dart similarity index 83% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/area_list_view.dart rename to lib/fitness_app/ui_view/area_list_view.dart index e2d4b458..2832b926 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/area_list_view.dart +++ b/lib/fitness_app/ui_view/area_list_view.dart @@ -1,21 +1,22 @@ import 'package:flutter/material.dart'; -import '../fintness_app_theme.dart'; +import '../fitness_app_theme.dart'; class AreaListView extends StatefulWidget { - const AreaListView( - {Key key, this.mainScreenAnimationController, this.mainScreenAnimation}) - : super(key: key); + const AreaListView({ + required this.mainScreenAnimationController, + required this.mainScreenAnimation, + super.key, + }); final AnimationController mainScreenAnimationController; - final Animation mainScreenAnimation; + final Animation mainScreenAnimation; @override - _AreaListViewState createState() => _AreaListViewState(); + State createState() => _AreaListViewState(); } class _AreaListViewState extends State with TickerProviderStateMixin { - AnimationController animationController; List areaListData = [ 'assets/fitness_app/area1.png', 'assets/fitness_app/area2.png', @@ -23,11 +24,12 @@ class _AreaListViewState extends State 'assets/fitness_app/area1.png', ]; + late final AnimationController animationController; @override void initState() { + super.initState(); animationController = AnimationController( duration: const Duration(milliseconds: 2000), vsync: this); - super.initState(); } @override @@ -40,7 +42,7 @@ class _AreaListViewState extends State Widget build(BuildContext context) { return AnimatedBuilder( animation: widget.mainScreenAnimationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: widget.mainScreenAnimation, child: Transform( @@ -54,7 +56,11 @@ class _AreaListViewState extends State padding: const EdgeInsets.only( left: 16, right: 16, top: 16, bottom: 16), physics: const BouncingScrollPhysics(), - scrollDirection: Axis.vertical, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisSpacing: 24.0, + crossAxisSpacing: 24.0, + ), children: List.generate( areaListData.length, (int index) { @@ -75,12 +81,6 @@ class _AreaListViewState extends State ); }, ), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: 24.0, - crossAxisSpacing: 24.0, - childAspectRatio: 1.0, - ), ), ), ), @@ -93,21 +93,21 @@ class _AreaListViewState extends State class AreaView extends StatelessWidget { const AreaView({ - Key key, - this.imagepath, - this.animationController, - this.animation, - }) : super(key: key); + required this.imagepath, + required this.animationController, + required this.animation, + super.key, + }); final String imagepath; final AnimationController animationController; - final Animation animation; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, child: Transform( @@ -115,7 +115,7 @@ class AreaView extends StatelessWidget { 0.0, 50 * (1.0 - animation.value), 0.0), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), @@ -123,7 +123,7 @@ class AreaView extends StatelessWidget { topRight: Radius.circular(8.0)), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey.withOpacity(0.4), + color: FitnessAppTheme.grey.withOpacity(0.4), offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], @@ -135,7 +135,7 @@ class AreaView extends StatelessWidget { highlightColor: Colors.transparent, hoverColor: Colors.transparent, borderRadius: const BorderRadius.all(Radius.circular(8.0)), - splashColor: FintnessAppTheme.nearlyDarkBlue.withOpacity(0.2), + splashColor: FitnessAppTheme.nearlyDarkBlue.withOpacity(0.2), onTap: () {}, child: Column( children: [ diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/body_measurement.dart b/lib/fitness_app/ui_view/body_measurement.dart similarity index 75% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/body_measurement.dart rename to lib/fitness_app/ui_view/body_measurement.dart index 924e48f8..ccabd3b4 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/body_measurement.dart +++ b/lib/fitness_app/ui_view/body_measurement.dart @@ -1,38 +1,42 @@ -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:flutter/material.dart'; +import '../fitness_app_theme.dart'; + class BodyMeasurementView extends StatelessWidget { - final AnimationController animationController; - final Animation animation; + const BodyMeasurementView({ + required this.animationController, + required this.animation, + super.key, + }); - const BodyMeasurementView({Key key, this.animationController, this.animation}) - : super(key: key); + final AnimationController animationController; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( + child: Transform( + transform: Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white, - borderRadius: BorderRadius.only( + color: FitnessAppTheme.white, + borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey.withOpacity(0.2), - offset: Offset(1.1, 1.1), + color: FitnessAppTheme.grey.withOpacity(0.2), + offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), @@ -45,54 +49,53 @@ class BodyMeasurementView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only( - left: 4, bottom: 8, top: 16), + const Padding( + padding: + EdgeInsets.only(left: 4, bottom: 8, top: 16), child: Text( 'Weight', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, - color: FintnessAppTheme.darkText), + color: FitnessAppTheme.darkText), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only( - left: 4, bottom: 3), + padding: + EdgeInsets.only(left: 4, bottom: 3), child: Text( '206.8', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 32, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), ), Padding( - padding: const EdgeInsets.only( - left: 8, bottom: 8), + padding: + EdgeInsets.only(left: 8, bottom: 8), child: Text( 'Ibs', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: -0.2, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), ), @@ -107,7 +110,7 @@ class BodyMeasurementView extends StatelessWidget { children: [ Icon( Icons.access_time, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), size: 16, ), @@ -119,29 +122,29 @@ class BodyMeasurementView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), ), ], ), - Padding( - padding: const EdgeInsets.only( - top: 4, bottom: 14), + const Padding( + padding: + EdgeInsets.only(top: 4, bottom: 14), child: Text( 'InBody SmartScale', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 12, letterSpacing: 0.0, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), ), @@ -157,8 +160,8 @@ class BodyMeasurementView extends StatelessWidget { left: 24, right: 24, top: 8, bottom: 8), child: Container( height: 2, - decoration: BoxDecoration( - color: FintnessAppTheme.background, + decoration: const BoxDecoration( + color: FitnessAppTheme.background, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), ), @@ -173,15 +176,15 @@ class BodyMeasurementView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( '185 cm', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( @@ -190,11 +193,11 @@ class BodyMeasurementView extends StatelessWidget { 'Height', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey - .withOpacity(0.5), + color: + FitnessAppTheme.grey.withOpacity(0.5), ), ), ), @@ -204,21 +207,19 @@ class BodyMeasurementView extends StatelessWidget { Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( + const Text( '27.3 BMI', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( @@ -227,10 +228,10 @@ class BodyMeasurementView extends StatelessWidget { 'Overweight', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -243,20 +244,19 @@ class BodyMeasurementView extends StatelessWidget { Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text( + const Text( '20%', style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( @@ -265,10 +265,10 @@ class BodyMeasurementView extends StatelessWidget { 'Body fat', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/glass_view.dart b/lib/fitness_app/ui_view/glass_view.dart similarity index 76% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/glass_view.dart rename to lib/fitness_app/ui_view/glass_view.dart index 06cc8bbe..86234d91 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/glass_view.dart +++ b/lib/fitness_app/ui_view/glass_view.dart @@ -1,37 +1,40 @@ -import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; -import '../fintness_app_theme.dart'; +import '../fitness_app_theme.dart'; class GlassView extends StatelessWidget { + const GlassView({ + required this.animationController, + required this.animation, + super.key, + }); + final AnimationController animationController; - final Animation animation; + final Animation animation; - const GlassView({Key key, this.animationController, this.animation}) - : super(key: key); @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( + child: Transform( + transform: Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Column( children: [ Padding( - padding: const EdgeInsets.only( - left: 24, right: 24, top: 0, bottom: 24), + padding: + const EdgeInsets.only(left: 24, right: 24, bottom: 24), child: Stack( - overflow: Overflow.visible, + clipBehavior: Clip.antiAlias, children: [ Padding( padding: const EdgeInsets.only(top: 16), child: Container( - decoration: BoxDecoration( - color: HexColor("#D7E0F9"), + decoration: const BoxDecoration( + color: Color(0xFFD7E0F9), borderRadius: BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), @@ -53,11 +56,11 @@ class GlassView extends StatelessWidget { 'Prepare your stomach for lunch with one or two glass of water', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.nearlyDarkBlue + color: FitnessAppTheme.nearlyDarkBlue .withOpacity(0.6), ), ), @@ -72,7 +75,7 @@ class GlassView extends StatelessWidget { child: SizedBox( width: 80, height: 80, - child: Image.asset("assets/fitness_app/glass.png"), + child: Image.asset('assets/fitness_app/glass.png'), ), ) ], diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/mediterranesn_diet_view.dart b/lib/fitness_app/ui_view/mediterranesn_diet_view.dart similarity index 76% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/mediterranesn_diet_view.dart rename to lib/fitness_app/ui_view/mediterranesn_diet_view.dart index de60e0a1..e154ca28 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/mediterranesn_diet_view.dart +++ b/lib/fitness_app/ui_view/mediterranesn_diet_view.dart @@ -1,41 +1,44 @@ -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; -import 'package:best_flutter_ui_templates/main.dart'; -import 'package:flutter/material.dart'; import 'dart:math' as math; +import 'package:flutter/material.dart'; + +import '../fitness_app_theme.dart'; + class MediterranesnDietView extends StatelessWidget { - final AnimationController animationController; - final Animation animation; + const MediterranesnDietView({ + required this.animationController, + required this.animation, + super.key, + }); - const MediterranesnDietView( - {Key key, this.animationController, this.animation}) - : super(key: key); + final AnimationController animationController; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( + child: Transform( + transform: Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white, - borderRadius: BorderRadius.only( + color: FitnessAppTheme.white, + borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey.withOpacity(0.2), - offset: Offset(1.1, 1.1), + color: FitnessAppTheme.grey.withOpacity(0.2), + offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), @@ -58,9 +61,9 @@ class MediterranesnDietView extends StatelessWidget { height: 48, width: 2, decoration: BoxDecoration( - color: HexColor('#87A0E5') + color: const Color(0xFF87A0E5) .withOpacity(0.5), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), ), @@ -80,11 +83,11 @@ class MediterranesnDietView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -99,7 +102,7 @@ class MediterranesnDietView extends StatelessWidget { width: 28, height: 28, child: Image.asset( - "assets/fitness_app/eaten.png"), + 'assets/fitness_app/eaten.png'), ), Padding( padding: @@ -108,14 +111,14 @@ class MediterranesnDietView extends StatelessWidget { child: Text( '${(1127 * animation.value).toInt()}', textAlign: TextAlign.center, - style: TextStyle( + style: const TextStyle( fontFamily: - FintnessAppTheme + FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 16, - color: FintnessAppTheme + color: FitnessAppTheme .darkerText, ), ), @@ -129,13 +132,13 @@ class MediterranesnDietView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme + FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.2, - color: FintnessAppTheme + color: FitnessAppTheme .grey .withOpacity(0.5), ), @@ -148,7 +151,7 @@ class MediterranesnDietView extends StatelessWidget { ) ], ), - SizedBox( + const SizedBox( height: 8, ), Row( @@ -157,9 +160,9 @@ class MediterranesnDietView extends StatelessWidget { height: 48, width: 2, decoration: BoxDecoration( - color: HexColor('#F56E98') + color: const Color(0xFFF56E98) .withOpacity(0.5), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), ), @@ -179,11 +182,11 @@ class MediterranesnDietView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.1, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -198,7 +201,7 @@ class MediterranesnDietView extends StatelessWidget { width: 28, height: 28, child: Image.asset( - "assets/fitness_app/burned.png"), + 'assets/fitness_app/burned.png'), ), Padding( padding: @@ -207,14 +210,14 @@ class MediterranesnDietView extends StatelessWidget { child: Text( '${(102 * animation.value).toInt()}', textAlign: TextAlign.center, - style: TextStyle( + style: const TextStyle( fontFamily: - FintnessAppTheme + FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 16, - color: FintnessAppTheme + color: FitnessAppTheme .darkerText, ), ), @@ -228,13 +231,13 @@ class MediterranesnDietView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme + FitnessAppTheme .fontName, fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.2, - color: FintnessAppTheme + color: FitnessAppTheme .grey .withOpacity(0.5), ), @@ -255,7 +258,7 @@ class MediterranesnDietView extends StatelessWidget { padding: const EdgeInsets.only(right: 16), child: Center( child: Stack( - overflow: Overflow.visible, + clipBehavior: Clip.antiAlias, children: [ Padding( padding: const EdgeInsets.all(8.0), @@ -263,32 +266,30 @@ class MediterranesnDietView extends StatelessWidget { width: 100, height: 100, decoration: BoxDecoration( - color: FintnessAppTheme.white, - borderRadius: BorderRadius.all( + color: FitnessAppTheme.white, + borderRadius: const BorderRadius.all( Radius.circular(100.0), ), - border: new Border.all( + border: Border.all( width: 4, - color: FintnessAppTheme + color: FitnessAppTheme .nearlyDarkBlue .withOpacity(0.2)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, children: [ Text( '${(1503 * animation.value).toInt()}', textAlign: TextAlign.center, - style: TextStyle( + style: const TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 24, letterSpacing: 0.0, - color: FintnessAppTheme + color: FitnessAppTheme .nearlyDarkBlue, ), ), @@ -297,11 +298,11 @@ class MediterranesnDietView extends StatelessWidget { textAlign: TextAlign.center, style: TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.bold, fontSize: 12, letterSpacing: 0.0, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -313,15 +314,15 @@ class MediterranesnDietView extends StatelessWidget { padding: const EdgeInsets.all(4.0), child: CustomPaint( painter: CurvePainter( - colors: [ - FintnessAppTheme.nearlyDarkBlue, - HexColor("#8A98E8"), - HexColor("#8A98E8") + colors: [ + FitnessAppTheme.nearlyDarkBlue, + const Color(0xFF8A98E8), + const Color(0xFF8A98E8) ], angle: 140 + (360 - 140) * (1.0 - animation.value)), - child: SizedBox( + child: const SizedBox( width: 108, height: 108, ), @@ -339,8 +340,8 @@ class MediterranesnDietView extends StatelessWidget { left: 24, right: 24, top: 8, bottom: 8), child: Container( height: 2, - decoration: BoxDecoration( - color: FintnessAppTheme.background, + decoration: const BoxDecoration( + color: FitnessAppTheme.background, borderRadius: BorderRadius.all(Radius.circular(4.0)), ), ), @@ -355,15 +356,15 @@ class MediterranesnDietView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Carbs', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( @@ -372,24 +373,26 @@ class MediterranesnDietView extends StatelessWidget { height: 4, width: 70, decoration: BoxDecoration( - color: - HexColor('#87A0E5').withOpacity(0.2), - borderRadius: BorderRadius.all( + color: const Color(0xFF87A0E5) + .withOpacity(0.2), + borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: [ Container( - width: ((70 / 1.2) * animation.value), + width: (70 / 1.2) * animation.value, height: 4, decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - HexColor('#87A0E5'), - HexColor('#87A0E5') + gradient: + LinearGradient(colors: [ + const Color(0xFF87A0E5), + const Color(0xFF87A0E5) .withOpacity(0.5), ]), - borderRadius: BorderRadius.all( - Radius.circular(4.0)), + borderRadius: + const BorderRadius.all( + Radius.circular(4.0)), ), ) ], @@ -402,11 +405,11 @@ class MediterranesnDietView extends StatelessWidget { '12g left', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey - .withOpacity(0.5), + color: + FitnessAppTheme.grey.withOpacity(0.5), ), ), ), @@ -416,21 +419,20 @@ class MediterranesnDietView extends StatelessWidget { Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Protein', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( @@ -439,26 +441,27 @@ class MediterranesnDietView extends StatelessWidget { height: 4, width: 70, decoration: BoxDecoration( - color: HexColor('#F56E98') + color: const Color(0xFFF56E98) .withOpacity(0.2), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: [ Container( - width: ((70 / 2) * - animationController.value), + width: (70 / 2) * + animationController.value, height: 4, decoration: BoxDecoration( - gradient: - LinearGradient(colors: [ - HexColor('#F56E98') - .withOpacity(0.1), - HexColor('#F56E98'), - ]), - borderRadius: BorderRadius.all( - Radius.circular(4.0)), + gradient: LinearGradient( + colors: [ + const Color(0xFFF56E98) + .withOpacity(0.1), + const Color(0xFFF56E98), + ]), + borderRadius: + const BorderRadius.all( + Radius.circular(4.0)), ), ), ], @@ -471,10 +474,10 @@ class MediterranesnDietView extends StatelessWidget { '30g left', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -487,49 +490,48 @@ class MediterranesnDietView extends StatelessWidget { Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Fat', style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 16, letterSpacing: -0.2, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, ), ), Padding( - padding: const EdgeInsets.only( - right: 0, top: 4), + padding: const EdgeInsets.only(top: 4), child: Container( height: 4, width: 70, decoration: BoxDecoration( - color: HexColor('#F1B440') + color: const Color(0xFFF1B440) .withOpacity(0.2), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(4.0)), ), child: Row( children: [ Container( - width: ((70 / 2.5) * - animationController.value), + width: (70 / 2.5) * + animationController.value, height: 4, decoration: BoxDecoration( - gradient: - LinearGradient(colors: [ - HexColor('#F1B440') - .withOpacity(0.1), - HexColor('#F1B440'), - ]), - borderRadius: BorderRadius.all( - Radius.circular(4.0)), + gradient: LinearGradient( + colors: [ + const Color(0xFFF1B440) + .withOpacity(0.1), + const Color(0xFFF1B440), + ]), + borderRadius: + const BorderRadius.all( + Radius.circular(4.0)), ), ), ], @@ -542,10 +544,10 @@ class MediterranesnDietView extends StatelessWidget { '10g left', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w600, fontSize: 12, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -570,30 +572,23 @@ class MediterranesnDietView extends StatelessWidget { } class CurvePainter extends CustomPainter { + CurvePainter({required this.colors, this.angle = 140}); + final double angle; final List colors; - CurvePainter({this.colors, this.angle = 140}); - @override void paint(Canvas canvas, Size size) { - List colorsList = List(); - if (colors != null) { - colorsList = colors; - } else { - colorsList.addAll([Colors.white, Colors.white]); - } - - final shdowPaint = new Paint() + final Paint shdowPaint = Paint() ..color = Colors.black.withOpacity(0.4) ..strokeCap = StrokeCap.round ..style = PaintingStyle.stroke ..strokeWidth = 14; - final shdowPaintCenter = new Offset(size.width / 2, size.height / 2); - final shdowPaintRadius = + final Offset shdowPaintCenter = Offset(size.width / 2, size.height / 2); + final double shdowPaintRadius = math.min(size.width / 2, size.height / 2) - (14 / 2); canvas.drawArc( - new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), + Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, @@ -602,7 +597,7 @@ class CurvePainter extends CustomPainter { shdowPaint.color = Colors.grey.withOpacity(0.3); shdowPaint.strokeWidth = 16; canvas.drawArc( - new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), + Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, @@ -611,7 +606,7 @@ class CurvePainter extends CustomPainter { shdowPaint.color = Colors.grey.withOpacity(0.2); shdowPaint.strokeWidth = 20; canvas.drawArc( - new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), + Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, @@ -620,46 +615,46 @@ class CurvePainter extends CustomPainter { shdowPaint.color = Colors.grey.withOpacity(0.1); shdowPaint.strokeWidth = 22; canvas.drawArc( - new Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), + Rect.fromCircle(center: shdowPaintCenter, radius: shdowPaintRadius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, shdowPaint); - final rect = new Rect.fromLTWH(0.0, 0.0, size.width, size.width); - final gradient = new SweepGradient( + final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.width); + final SweepGradient gradient = SweepGradient( startAngle: degreeToRadians(268), endAngle: degreeToRadians(270.0 + 360), tileMode: TileMode.repeated, - colors: colorsList, + colors: colors, ); - final paint = new Paint() + final Paint paint = Paint() ..shader = gradient.createShader(rect) ..strokeCap = StrokeCap.round // StrokeCap.round is not recommended. ..style = PaintingStyle.stroke ..strokeWidth = 14; - final center = new Offset(size.width / 2, size.height / 2); - final radius = math.min(size.width / 2, size.height / 2) - (14 / 2); + final Offset center = Offset(size.width / 2, size.height / 2); + final double radius = math.min(size.width / 2, size.height / 2) - (14 / 2); canvas.drawArc( - new Rect.fromCircle(center: center, radius: radius), + Rect.fromCircle(center: center, radius: radius), degreeToRadians(278), degreeToRadians(360 - (365 - angle)), false, paint); - final gradient1 = new SweepGradient( + const SweepGradient gradient1 = SweepGradient( tileMode: TileMode.repeated, - colors: [Colors.white, Colors.white], + colors: [Colors.white, Colors.white], ); - var cPaint = new Paint(); - cPaint..shader = gradient1.createShader(rect); - cPaint..color = Colors.white; - cPaint..strokeWidth = 14 / 2; + final Paint cPaint = Paint(); + cPaint.shader = gradient1.createShader(rect); + cPaint.color = Colors.white; + cPaint.strokeWidth = 14 / 2; canvas.save(); - final centerToCircle = size.width / 2; + final double centerToCircle = size.width / 2; canvas.save(); canvas.translate(centerToCircle, centerToCircle); @@ -667,7 +662,7 @@ class CurvePainter extends CustomPainter { canvas.save(); canvas.translate(0.0, -centerToCircle + 14 / 2); - canvas.drawCircle(new Offset(0, 0), 14 / 5, cPaint); + canvas.drawCircle(const Offset(0, 0), 14 / 5, cPaint); canvas.restore(); canvas.restore(); @@ -680,7 +675,7 @@ class CurvePainter extends CustomPainter { } double degreeToRadians(double degree) { - var redian = (math.pi / 180) * degree; - return redian; + final double radian = (math.pi / 180) * degree; + return radian; } } diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/running_view.dart b/lib/fitness_app/ui_view/running_view.dart similarity index 74% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/running_view.dart rename to lib/fitness_app/ui_view/running_view.dart index 8a9a3e1d..4f54d7d2 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/running_view.dart +++ b/lib/fitness_app/ui_view/running_view.dart @@ -1,45 +1,48 @@ import 'package:flutter/material.dart'; -import '../fintness_app_theme.dart'; + +import '../fitness_app_theme.dart'; class RunningView extends StatelessWidget { - final AnimationController animationController; - final Animation animation; + const RunningView({ + required this.animationController, + required this.animation, + super.key, + }); - const RunningView({Key key, this.animationController, this.animation}) - : super(key: key); + final AnimationController animationController; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( + child: Transform( + transform: Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Column( children: [ Padding( - padding: const EdgeInsets.only( - left: 24, right: 24, top: 0, bottom: 0), + padding: const EdgeInsets.only(left: 24, right: 24), child: Stack( - overflow: Overflow.visible, + clipBehavior: Clip.antiAlias, children: [ Padding( padding: const EdgeInsets.only(top: 16, bottom: 16), child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.white, - borderRadius: BorderRadius.only( + color: FitnessAppTheme.white, + borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(8.0)), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey.withOpacity(0.4), - offset: Offset(1.1, 1.1), + color: FitnessAppTheme.grey.withOpacity(0.4), + offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), @@ -47,24 +50,24 @@ class RunningView extends StatelessWidget { alignment: Alignment.topLeft, children: [ ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(8.0)), + borderRadius: const BorderRadius.all( + Radius.circular(8.0)), child: SizedBox( height: 74, child: AspectRatio( aspectRatio: 1.714, child: Image.asset( - "assets/fitness_app/back.png"), + 'assets/fitness_app/back.png'), ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( + const Row( children: [ Padding( - padding: const EdgeInsets.only( + padding: EdgeInsets.only( left: 100, right: 16, top: 16, @@ -74,12 +77,12 @@ class RunningView extends StatelessWidget { textAlign: TextAlign.left, style: TextStyle( fontFamily: - FintnessAppTheme.fontName, + FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, color: - FintnessAppTheme.nearlyDarkBlue, + FitnessAppTheme.nearlyDarkBlue, ), ), ), @@ -93,14 +96,14 @@ class RunningView extends StatelessWidget { right: 16, ), child: Text( - "Keep it up\nand stick to your plan!", + 'Keep it up\nand stick to your plan!', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 10, letterSpacing: 0.0, - color: FintnessAppTheme.grey + color: FitnessAppTheme.grey .withOpacity(0.5), ), ), @@ -117,7 +120,7 @@ class RunningView extends StatelessWidget { child: SizedBox( width: 110, height: 110, - child: Image.asset("assets/fitness_app/runner.png"), + child: Image.asset('assets/fitness_app/runner.png'), ), ) ], diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/title_view.dart b/lib/fitness_app/ui_view/title_view.dart similarity index 63% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/title_view.dart rename to lib/fitness_app/ui_view/title_view.dart index b49ab396..03b93a84 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/title_view.dart +++ b/lib/fitness_app/ui_view/title_view.dart @@ -1,31 +1,33 @@ -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; import 'package:flutter/material.dart'; +import '../fitness_app_theme.dart'; + class TitleView extends StatelessWidget { + const TitleView({ + required this.animationController, + required this.animation, + this.titleTxt = '', + this.subTxt = '', + super.key, + }); + final String titleTxt; final String subTxt; final AnimationController animationController; - final Animation animation; - - const TitleView( - {Key key, - this.titleTxt: "", - this.subTxt: "", - this.animationController, - this.animation}) - : super(key: key); + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { - return FadeTransition( - opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( - 0.0, 30 * (1.0 - animation.value), 0.0), - child: Container( + builder: (BuildContext context, _) { + return Material( + color: FitnessAppTheme.background, + child: FadeTransition( + opacity: animation, + child: Transform( + transform: Matrix4.translationValues( + 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only(left: 24, right: 24), child: Row( @@ -34,18 +36,19 @@ class TitleView extends StatelessWidget { child: Text( titleTxt, textAlign: TextAlign.left, - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 18, letterSpacing: 0.5, - color: FintnessAppTheme.lightText, + color: FitnessAppTheme.lightText, ), ), ), InkWell( highlightColor: Colors.transparent, - borderRadius: BorderRadius.all(Radius.circular(4.0)), + borderRadius: + const BorderRadius.all(Radius.circular(4.0)), onTap: () {}, child: Padding( padding: const EdgeInsets.only(left: 8), @@ -54,20 +57,20 @@ class TitleView extends StatelessWidget { Text( subTxt, textAlign: TextAlign.left, - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 16, letterSpacing: 0.5, - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, ), ), - SizedBox( + const SizedBox( height: 38, width: 26, child: Icon( Icons.arrow_forward, - color: FintnessAppTheme.darkText, + color: FitnessAppTheme.darkText, size: 18, ), ), diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/wave_view.dart b/lib/fitness_app/ui_view/wave_view.dart similarity index 53% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/wave_view.dart rename to lib/fitness_app/ui_view/wave_view.dart index 7b47e48e..f7d50946 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/wave_view.dart +++ b/lib/fitness_app/ui_view/wave_view.dart @@ -1,59 +1,74 @@ import 'dart:math' as math; -import 'package:best_flutter_ui_templates/fitness_app/fintness_app_theme.dart'; + import 'package:flutter/material.dart'; import 'package:vector_math/vector_math.dart' as vector; +import '../fitness_app_theme.dart'; + class WaveView extends StatefulWidget { + const WaveView({ + super.key, + this.percentageValue = 100.0, + }); + final double percentageValue; - const WaveView({Key key, this.percentageValue = 100.0}) : super(key: key); @override - _WaveViewState createState() => _WaveViewState(); + State createState() => _WaveViewState(); } class _WaveViewState extends State with TickerProviderStateMixin { - AnimationController animationController; - AnimationController waveAnimationController; - Offset bottleOffset1 = Offset(0, 0); - List animList1 = []; - Offset bottleOffset2 = Offset(60, 0); - List animList2 = []; + Offset bottleOffset1 = const Offset(0, 0); + List animList1 = []; + Offset bottleOffset2 = const Offset(60, 0); + List animList2 = []; + late final AnimationController animationController; + late final AnimationController waveAnimationController; @override void initState() { - animationController = AnimationController(duration: Duration(milliseconds: 2000), vsync: this); - waveAnimationController = AnimationController(duration: Duration(milliseconds: 2000), vsync: this); - animationController - ..addStatusListener((status) { - if (status == AnimationStatus.completed) { - animationController.reverse(); - } else if (status == AnimationStatus.dismissed) { - animationController.forward(); - } - }); + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + waveAnimationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + animationController.addStatusListener((AnimationStatus status) { + if (status == AnimationStatus.completed) { + animationController.reverse(); + } else if (status == AnimationStatus.dismissed) { + animationController.forward(); + } + }); waveAnimationController.addListener(() { animList1.clear(); for (int i = -2 - bottleOffset1.dx.toInt(); i <= 60 + 2; i++) { animList1.add( - new Offset( + Offset( i.toDouble() + bottleOffset1.dx.toInt(), - math.sin((waveAnimationController.value * 360 - i) % 360 * vector.degrees2Radians) * 4 + (((100 - widget.percentageValue) * 160 / 100)), + math.sin((waveAnimationController.value) % + 360 * + vector.degrees2Radians) * + 4 + + ((100 - widget.percentageValue) * 160 / 100), ), ); } animList2.clear(); for (int i = -2 - bottleOffset2.dx.toInt(); i <= 60 + 2; i++) { animList2.add( - new Offset( + Offset( i.toDouble() + bottleOffset2.dx.toInt(), - math.sin((waveAnimationController.value * 360 - i) % 360 * vector.degrees2Radians) * 4 + (((100 - widget.percentageValue) * 160 / 100)), + math.sin((waveAnimationController.value) % + 360 * + vector.degrees2Radians) * + 4 + + ((100 - widget.percentageValue) * 160 / 100), ), ); } }); waveAnimationController.repeat(); animationController.forward(); - super.initState(); } @override @@ -67,48 +82,54 @@ class _WaveViewState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { return Container( alignment: Alignment.center, - child: new AnimatedBuilder( - animation: new CurvedAnimation( + child: AnimatedBuilder( + animation: CurvedAnimation( parent: animationController, curve: Curves.easeInOut, ), - builder: (context, child) => new Stack( + builder: (_, __) => Stack( children: [ - new ClipPath( - child: new Container( + ClipPath( + clipper: WaveClipper(animationController.value, animList1), + child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue.withOpacity(0.5), - borderRadius: BorderRadius.only( + color: FitnessAppTheme.nearlyDarkBlue.withOpacity(0.5), + borderRadius: const BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), gradient: LinearGradient( - colors: [FintnessAppTheme.nearlyDarkBlue.withOpacity(0.2), FintnessAppTheme.nearlyDarkBlue.withOpacity(0.5)], + colors: [ + FitnessAppTheme.nearlyDarkBlue.withOpacity(0.2), + FitnessAppTheme.nearlyDarkBlue.withOpacity(0.5) + ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), ), ), - clipper: new WaveClipper(animationController.value, animList1), ), - new ClipPath( - child: new Container( + ClipPath( + clipper: WaveClipper(animationController.value, animList2), + child: Container( decoration: BoxDecoration( - color: FintnessAppTheme.nearlyDarkBlue, + color: FitnessAppTheme.nearlyDarkBlue, gradient: LinearGradient( - colors: [FintnessAppTheme.nearlyDarkBlue.withOpacity(0.4), FintnessAppTheme.nearlyDarkBlue], + colors: [ + FitnessAppTheme.nearlyDarkBlue.withOpacity(0.4), + FitnessAppTheme.nearlyDarkBlue + ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(80.0), bottomLeft: Radius.circular(80.0), bottomRight: Radius.circular(80.0), topRight: Radius.circular(80.0)), ), ), - clipper: new WaveClipper(animationController.value, animList2), ), Padding( padding: const EdgeInsets.only(top: 48), @@ -120,25 +141,25 @@ class _WaveViewState extends State with TickerProviderStateMixin { Text( widget.percentageValue.round().toString(), textAlign: TextAlign.center, - style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + style: const TextStyle( + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 24, letterSpacing: 0.0, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), - Padding( - padding: const EdgeInsets.only(top: 3.0), + const Padding( + padding: EdgeInsets.only(top: 3.0), child: Text( '%', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), ), @@ -150,15 +171,17 @@ class _WaveViewState extends State with TickerProviderStateMixin { top: 0, left: 6, bottom: 8, - child: new ScaleTransition( - alignment: Alignment.center, - scale: Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: animationController, curve: Interval(0.0, 1.0, curve: Curves.fastOutSlowIn))), + child: ScaleTransition( + scale: Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: const Interval(0.0, 1.0, + curve: Curves.fastOutSlowIn))), child: Container( width: 2, height: 2, decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(0.4), + color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), @@ -168,15 +191,17 @@ class _WaveViewState extends State with TickerProviderStateMixin { left: 24, right: 0, bottom: 16, - child: new ScaleTransition( - alignment: Alignment.center, - scale: Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: animationController, curve: Interval(0.4, 1.0, curve: Curves.fastOutSlowIn))), + child: ScaleTransition( + scale: Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: const Interval(0.4, 1.0, + curve: Curves.fastOutSlowIn))), child: Container( width: 4, height: 4, decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(0.4), + color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), @@ -186,15 +211,17 @@ class _WaveViewState extends State with TickerProviderStateMixin { left: 0, right: 24, bottom: 32, - child: new ScaleTransition( - alignment: Alignment.center, - scale: Tween(begin: 0.0, end: 1.0) - .animate(CurvedAnimation(parent: animationController, curve: Interval(0.6, 0.8, curve: Curves.fastOutSlowIn))), + child: ScaleTransition( + scale: Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: const Interval(0.6, 0.8, + curve: Curves.fastOutSlowIn))), child: Container( width: 3, height: 3, decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(0.4), + color: FitnessAppTheme.white.withOpacity(0.4), shape: BoxShape.circle, ), ), @@ -204,13 +231,17 @@ class _WaveViewState extends State with TickerProviderStateMixin { top: 0, right: 20, bottom: 0, - child: new Transform( - transform: new Matrix4.translationValues(0.0, 16 * (1.0 - animationController.value), 0.0), + child: Transform( + transform: Matrix4.translationValues( + 0.0, 16 * (1.0 - animationController.value), 0.0), child: Container( width: 4, height: 4, decoration: BoxDecoration( - color: FintnessAppTheme.white.withOpacity(animationController.status == AnimationStatus.reverse ? 0.0 : 0.4), + color: FitnessAppTheme.white.withOpacity( + animationController.status == AnimationStatus.reverse + ? 0.0 + : 0.4), shape: BoxShape.circle, ), ), @@ -220,7 +251,7 @@ class _WaveViewState extends State with TickerProviderStateMixin { children: [ AspectRatio( aspectRatio: 1, - child: Image.asset("assets/fitness_app/bottle.png"), + child: Image.asset('assets/fitness_app/bottle.png'), ), ], ) @@ -232,15 +263,15 @@ class _WaveViewState extends State with TickerProviderStateMixin { } class WaveClipper extends CustomClipper { - final double animation; + WaveClipper(this.animation, this.waveList1); - List waveList1 = []; + final double animation; - WaveClipper(this.animation, this.waveList1); + List waveList1 = []; @override Path getClip(Size size) { - Path path = new Path(); + final Path path = Path(); path.addPolygon(waveList1, false); @@ -251,5 +282,6 @@ class WaveClipper extends CustomClipper { } @override - bool shouldReclip(WaveClipper oldClipper) => animation != oldClipper.animation; + bool shouldReclip(WaveClipper oldClipper) => + animation != oldClipper.animation; } diff --git a/best_flutter_ui_templates/lib/fitness_app/ui_view/workout_view.dart b/lib/fitness_app/ui_view/workout_view.dart similarity index 65% rename from best_flutter_ui_templates/lib/fitness_app/ui_view/workout_view.dart rename to lib/fitness_app/ui_view/workout_view.dart index 4c004ccd..6181d7ea 100644 --- a/best_flutter_ui_templates/lib/fitness_app/ui_view/workout_view.dart +++ b/lib/fitness_app/ui_view/workout_view.dart @@ -1,42 +1,45 @@ -import 'package:best_flutter_ui_templates/main.dart'; import 'package:flutter/material.dart'; -import '../fintness_app_theme.dart'; + +import '../fitness_app_theme.dart'; class WorkoutView extends StatelessWidget { - final AnimationController animationController; - final Animation animation; + const WorkoutView({ + required this.animationController, + required this.animation, + super.key, + }); - const WorkoutView({Key key, this.animationController, this.animation}) - : super(key: key); + final AnimationController animationController; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (_, __) { return FadeTransition( opacity: animation, - child: new Transform( - transform: new Matrix4.translationValues( + child: Transform( + transform: Matrix4.translationValues( 0.0, 30 * (1.0 - animation.value), 0.0), child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 16, bottom: 18), child: Container( decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - FintnessAppTheme.nearlyDarkBlue, - HexColor("#6F56E8") + gradient: const LinearGradient(colors: [ + FitnessAppTheme.nearlyDarkBlue, + Color(0xFF6F56E8) ], begin: Alignment.topLeft, end: Alignment.bottomRight), - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(8.0), bottomLeft: Radius.circular(8.0), bottomRight: Radius.circular(8.0), topRight: Radius.circular(68.0)), boxShadow: [ BoxShadow( - color: FintnessAppTheme.grey.withOpacity(0.6), - offset: Offset(1.1, 1.1), + color: FitnessAppTheme.grey.withOpacity(0.6), + offset: const Offset(1.1, 1.1), blurRadius: 10.0), ], ), @@ -46,82 +49,78 @@ class WorkoutView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + const Text( 'Next workout', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), - Padding( - padding: const EdgeInsets.only(top: 8.0), + const Padding( + padding: EdgeInsets.only(top: 8.0), child: Text( 'Legs Toning and\nGlutes Workout at Home', textAlign: TextAlign.left, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.normal, fontSize: 20, letterSpacing: 0.0, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), ), - SizedBox( - height: 32, - ), + const SizedBox(height: 32), Padding( padding: const EdgeInsets.only(right: 4), child: Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.only(left: 4), + const Padding( + padding: EdgeInsets.only(left: 4), child: Icon( Icons.timer, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, size: 16, ), ), - Padding( - padding: const EdgeInsets.only(left: 4.0), + const Padding( + padding: EdgeInsets.only(left: 4.0), child: Text( '68 min', textAlign: TextAlign.center, style: TextStyle( - fontFamily: FintnessAppTheme.fontName, + fontFamily: FitnessAppTheme.fontName, fontWeight: FontWeight.w500, fontSize: 14, letterSpacing: 0.0, - color: FintnessAppTheme.white, + color: FitnessAppTheme.white, ), ), ), - Expanded( - child: SizedBox(), - ), + const Expanded(child: SizedBox()), Container( decoration: BoxDecoration( - color: FintnessAppTheme.nearlyWhite, + color: FitnessAppTheme.nearlyWhite, shape: BoxShape.circle, boxShadow: [ BoxShadow( - color: FintnessAppTheme.nearlyBlack + color: FitnessAppTheme.nearlyBlack .withOpacity(0.4), - offset: Offset(8.0, 8.0), + offset: const Offset(8.0, 8.0), blurRadius: 8.0), ], ), - child: Padding( - padding: const EdgeInsets.all(0.0), + child: const Padding( + padding: EdgeInsets.all(0.0), child: Icon( Icons.arrow_right, - color: HexColor("#6F56E8"), + color: Color(0xFF6F56E8), size: 44, ), ), diff --git a/lib/help_screen.dart b/lib/help_screen.dart new file mode 100644 index 00000000..f8c8116e --- /dev/null +++ b/lib/help_screen.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; + +class HelpScreen extends StatefulWidget { + const HelpScreen({super.key}); + + @override + State createState() => _HelpScreenState(); +} + +class _HelpScreenState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top, left: 16, right: 16), + child: Image.asset('assets/images/helpImage.png'), + ), + Container( + padding: const EdgeInsets.only(top: 8), + child: const Text( + 'How can we help you?', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + padding: const EdgeInsets.only(top: 16), + child: const Text( + 'It looks like you are experiencing problems\nwith our sign up process. We are here to\nhelp so please get in touch with us', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Container( + width: 140, + height: 40, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: const BorderRadius.all(Radius.circular(4.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + offset: const Offset(4, 4), + blurRadius: 8.0), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: () {}, + child: const Center( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Text( + 'Chat with Us', + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ), + ), + ), + ), + ), + ), + ), + ), + ) + ], + ); + } +} diff --git a/lib/home_screen.dart b/lib/home_screen.dart new file mode 100644 index 00000000..4a6f8679 --- /dev/null +++ b/lib/home_screen.dart @@ -0,0 +1,213 @@ +import 'package:flutter/material.dart'; + +import 'app_theme.dart'; +import 'model/homelist.dart'; + +class MyHomePage extends StatefulWidget { + const MyHomePage({super.key}); + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State with TickerProviderStateMixin { + List homeList = HomeList.homeList; + bool multiple = true; + + late final AnimationController animationController; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + } + + Future getData() async { + await Future.delayed(const Duration()); + return true; + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return const SizedBox(); + } else { + return Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + appBar(), + Expanded( + child: GridView( + padding: const EdgeInsets.only(left: 12, right: 12), + physics: const BouncingScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: multiple ? 2 : 1, + mainAxisSpacing: 12.0, + crossAxisSpacing: 12.0, + childAspectRatio: 1.5, + ), + children: List.generate( + homeList.length, + (int index) { + final int count = homeList.length; + final Animation animation = + Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: Interval((1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn), + ), + ); + animationController.forward(); + return HomeListView( + animation: animation, + animationController: animationController, + listData: homeList[index], + callBack: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + homeList[index].navigateScreen, + ), + ); + }, + ); + }, + ), + ), + ), + ], + ), + ); + } + }, + ); + } + + Widget appBar() { + return SizedBox( + height: AppBar().preferredSize.height, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(top: 8, left: 8), + child: SizedBox( + width: AppBar().preferredSize.height - 8, + height: AppBar().preferredSize.height - 8, + ), + ), + const Expanded( + child: Center( + child: Padding( + padding: EdgeInsets.only(top: 4), + child: Text( + 'Flutter UI', + style: TextStyle( + fontSize: 22, + color: AppTheme.darkText, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 8, right: 8), + child: Container( + width: AppBar().preferredSize.height - 8, + height: AppBar().preferredSize.height - 8, + color: Colors.white, + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: + BorderRadius.circular(AppBar().preferredSize.height), + onTap: () { + if (mounted) { + setState(() { + multiple = !multiple; + }); + } + }, + child: Icon( + multiple ? Icons.dashboard : Icons.view_agenda, + color: AppTheme.darkGrey, + ), + ), + ), + ), + ), + ], + ), + ); + } +} + +class HomeListView extends StatelessWidget { + const HomeListView({ + required this.listData, + required this.callBack, + required this.animationController, + required this.animation, + super.key, + }); + + final HomeList listData; + final VoidCallback callBack; + final AnimationController animationController; + final Animation animation; + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: animationController, + builder: (BuildContext context, _) { + return FadeTransition( + opacity: animation, + child: Transform( + transform: Matrix4.translationValues( + 0.0, 50 * (1.0 - animation.value), 0.0), + child: AspectRatio( + aspectRatio: 1.5, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(4.0)), + child: Stack( + alignment: AlignmentDirectional.center, + children: [ + Image.asset( + listData.imagePath, + fit: BoxFit.cover, + ), + Material( + color: Colors.transparent, + child: InkWell( + splashColor: Colors.grey.withOpacity(0.2), + borderRadius: + const BorderRadius.all(Radius.circular(4.0)), + onTap: () => callBack(), + ), + ), + ], + ), + ), + ), + ), + ); + }, + ); + } +} diff --git a/lib/hotel_booking/calendar_popup_view.dart b/lib/hotel_booking/calendar_popup_view.dart new file mode 100644 index 00000000..13f695b0 --- /dev/null +++ b/lib/hotel_booking/calendar_popup_view.dart @@ -0,0 +1,224 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +import 'custom_calendar.dart'; +import 'hotel_app_theme.dart'; + +class CalendarPopupView extends StatefulWidget { + const CalendarPopupView({ + required this.initialStartDate, + required this.initialEndDate, + required this.onApplyClick, + required this.onCancelClick, + this.minimumDate, + this.maximumDate, + this.barrierDismissible = true, + super.key, + }); + + final DateTime? minimumDate; + final DateTime? maximumDate; + final bool barrierDismissible; + final DateTime initialStartDate; + final DateTime initialEndDate; + final Function(DateTime, DateTime) onApplyClick; + + final Function onCancelClick; + @override + State createState() => _CalendarPopupViewState(); +} + +class _CalendarPopupViewState extends State + with TickerProviderStateMixin { + late final DateTime startDate; + late final DateTime endDate; + late final AnimationController animationController; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: const Duration(milliseconds: 400), vsync: this); + startDate = widget.initialStartDate; + endDate = widget.initialEndDate; + animationController.forward(); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.transparent, + insetPadding: EdgeInsets.zero, + child: AnimatedBuilder( + animation: animationController, + builder: (BuildContext context, _) { + return AnimatedOpacity( + duration: const Duration(milliseconds: 100), + opacity: animationController.value, + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + onTap: () { + if (widget.barrierDismissible) { + Navigator.pop(context); + } + }, + child: Center( + child: Padding( + padding: const EdgeInsets.all(24.0), + child: Container( + decoration: BoxDecoration( + color: HotelAppTheme.buildLightTheme() + .colorScheme + .background, + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + offset: const Offset(4, 4), + blurRadius: 8.0), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'From', + textAlign: TextAlign.left, + style: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 16, + color: Colors.grey.withOpacity(0.8)), + ), + const SizedBox( + height: 4, + ), + Text( + DateFormat('EEE, dd MMM').format(startDate), + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + ], + ), + ), + Container( + height: 74, + width: 1, + color: + HotelAppTheme.buildLightTheme().dividerColor, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'To', + style: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 16, + color: Colors.grey.withOpacity(0.8)), + ), + const SizedBox(height: 4), + Text( + DateFormat('EEE, dd MMM').format(endDate), + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16), + ), + ], + ), + ) + ], + ), + const Divider(height: 1), + CustomCalendarView( + minimumDate: widget.minimumDate, + maximumDate: widget.maximumDate, + initialEndDate: widget.initialEndDate, + initialStartDate: widget.initialStartDate, + startEndDateChange: + (DateTime startDateData, DateTime endDateData) { + if (mounted) { + setState(() { + startDate = startDateData; + endDate = endDateData; + }); + } + }, + ), + Padding( + padding: const EdgeInsets.only( + left: 16, right: 16, bottom: 16, top: 8), + child: Container( + height: 48, + decoration: BoxDecoration( + color: + HotelAppTheme.buildLightTheme().primaryColor, + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + blurRadius: 8, + offset: const Offset(4, 4), + ), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(24.0)), + highlightColor: Colors.transparent, + onTap: () { + try { + // animationController?.reverse().then((f) { + + // }); + widget.onApplyClick(startDate, endDate); + Navigator.pop(context); + } catch (_) {} + }, + child: const Center( + child: Text( + 'Apply', + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + color: Colors.white), + ), + ), + ), + ), + ), + ) + ], + ), + ), + ), + ), + ), + ); + }, + ), + ); + } +} diff --git a/lib/hotel_booking/custom_calendar.dart b/lib/hotel_booking/custom_calendar.dart new file mode 100644 index 00000000..1988026c --- /dev/null +++ b/lib/hotel_booking/custom_calendar.dart @@ -0,0 +1,443 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +import 'hotel_app_theme.dart'; + +class CustomCalendarView extends StatefulWidget { + const CustomCalendarView({ + required this.initialStartDate, + required this.initialEndDate, + required this.startEndDateChange, + this.minimumDate, + this.maximumDate, + super.key, + }); + + final DateTime? minimumDate; + final DateTime? maximumDate; + final DateTime initialStartDate; + final DateTime initialEndDate; + + final Function(DateTime, DateTime) startEndDateChange; + + @override + State createState() => _CustomCalendarViewState(); +} + +class _CustomCalendarViewState extends State { + List dateList = []; + DateTime currentMonthDate = DateTime.now(); + DateTime? startDate; + DateTime? endDate; + + @override + void initState() { + super.initState(); + setListOfDate(currentMonthDate); + startDate = widget.initialStartDate; + endDate = widget.initialEndDate; + } + + @override + void dispose() { + super.dispose(); + } + + void setListOfDate(DateTime monthDate) { + dateList.clear(); + final DateTime newDate = DateTime(monthDate.year, monthDate.month, 0); + int previousMothDay = 0; + if (newDate.weekday < 7) { + previousMothDay = newDate.weekday; + for (int i = 1; i <= previousMothDay; i++) { + dateList.add(newDate.subtract(Duration(days: previousMothDay - i))); + } + } + for (int i = 0; i < (42 - previousMothDay); i++) { + dateList.add(newDate.add(Duration(days: i + 1))); + } + // if (dateList[dateList.length - 7].month != monthDate.month) { + // dateList.removeRange(dateList.length - 7, dateList.length); + // } + } + + @override + Widget build(BuildContext context) { + return Material( + child: Column( + children: [ + Padding( + padding: + const EdgeInsets.only(left: 8.0, right: 8.0, top: 4, bottom: 4), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 38, + width: 38, + decoration: BoxDecoration( + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + border: Border.all( + color: HotelAppTheme.buildLightTheme().dividerColor, + ), + ), + child: InkWell( + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + onTap: () { + if (mounted) { + setState(() { + currentMonthDate = DateTime(currentMonthDate.year, + currentMonthDate.month, 0); + setListOfDate(currentMonthDate); + }); + } + }, + child: const Icon( + Icons.keyboard_arrow_left, + color: Colors.grey, + ), + ), + ), + ), + Expanded( + child: Center( + child: Text( + DateFormat('MMMM, yyyy').format(currentMonthDate), + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 20, + color: Colors.black), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 38, + width: 38, + decoration: BoxDecoration( + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + border: Border.all( + color: HotelAppTheme.buildLightTheme().dividerColor, + ), + ), + child: InkWell( + borderRadius: + const BorderRadius.all(Radius.circular(24.0)), + onTap: () { + if (mounted) { + setState(() { + currentMonthDate = DateTime(currentMonthDate.year, + currentMonthDate.month + 2, 0); + setListOfDate(currentMonthDate); + }); + } + }, + child: const Icon( + Icons.keyboard_arrow_right, + color: Colors.grey, + ), + ), + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only(right: 8, left: 8, bottom: 8), + child: Row( + children: getDaysNameUI(), + ), + ), + Padding( + padding: const EdgeInsets.only(right: 8, left: 8), + child: Column( + children: getDaysNoUI(), + ), + ), + ], + ), + ); + } + + List getDaysNameUI() { + final List listUI = []; + for (int i = 0; i < 7; i++) { + listUI.add( + Expanded( + child: Center( + child: Text( + DateFormat('EEE').format(dateList[i]), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + color: HotelAppTheme.buildLightTheme().primaryColor), + ), + ), + ), + ); + } + return listUI; + } + + List getDaysNoUI() { + final List noList = []; + int count = 0; + for (int i = 0; i < dateList.length / 7; i++) { + final List listUI = []; + for (int i = 0; i < 7; i++) { + final DateTime date = dateList[count]; + listUI.add( + Expanded( + child: AspectRatio( + aspectRatio: 1.0, + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.only(top: 3, bottom: 3), + child: Padding( + padding: EdgeInsets.only( + top: 2, + bottom: 2, + left: isStartDateRadius(date) ? 4 : 0, + right: isEndDateRadius(date) ? 4 : 0), + child: Container( + decoration: BoxDecoration( + color: startDate != null && endDate != null + ? getIsItStartAndEndDate(date) || + getIsInRange(date) + ? HotelAppTheme.buildLightTheme() + .primaryColor + .withOpacity(0.4) + : Colors.transparent + : Colors.transparent, + borderRadius: BorderRadius.only( + bottomLeft: isStartDateRadius(date) + ? const Radius.circular(24.0) + : const Radius.circular(0.0), + topLeft: isStartDateRadius(date) + ? const Radius.circular(24.0) + : const Radius.circular(0.0), + topRight: isEndDateRadius(date) + ? const Radius.circular(24.0) + : const Radius.circular(0.0), + bottomRight: isEndDateRadius(date) + ? const Radius.circular(24.0) + : const Radius.circular(0.0), + ), + ), + ), + ), + ), + InkWell( + borderRadius: const BorderRadius.all(Radius.circular(32.0)), + onTap: () { + if (currentMonthDate.month == date.month) { + final DateTime? minimumDate = widget.minimumDate; + final DateTime? maximumDate = widget.maximumDate; + if (minimumDate != null && maximumDate != null) { + final DateTime newminimumDate = DateTime( + minimumDate.year, + minimumDate.month, + minimumDate.day - 1); + final DateTime newmaximumDate = DateTime( + maximumDate.year, + maximumDate.month, + maximumDate.day + 1); + if (date.isAfter(newminimumDate) && + date.isBefore(newmaximumDate)) { + onDateClick(date); + } + } else if (minimumDate != null) { + final DateTime newminimumDate = DateTime( + minimumDate.year, + minimumDate.month, + minimumDate.day - 1); + if (date.isAfter(newminimumDate)) { + onDateClick(date); + } + } else if (maximumDate != null) { + final DateTime newmaximumDate = DateTime( + maximumDate.year, + maximumDate.month, + maximumDate.day + 1); + if (date.isBefore(newmaximumDate)) { + onDateClick(date); + } + } else { + onDateClick(date); + } + } + }, + child: Padding( + padding: const EdgeInsets.all(2), + child: Container( + decoration: BoxDecoration( + color: getIsItStartAndEndDate(date) + ? HotelAppTheme.buildLightTheme().primaryColor + : Colors.transparent, + borderRadius: + const BorderRadius.all(Radius.circular(32.0)), + border: Border.all( + color: getIsItStartAndEndDate(date) + ? Colors.white + : Colors.transparent, + width: 2, + ), + boxShadow: getIsItStartAndEndDate(date) + ? [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + blurRadius: 4), + ] + : null, + ), + child: Center( + child: Text( + '${date.day}', + style: TextStyle( + color: getIsItStartAndEndDate(date) + ? Colors.white + : currentMonthDate.month == date.month + ? Colors.black + : Colors.grey.withOpacity(0.6), + fontSize: + MediaQuery.of(context).size.width > 360 + ? 18 + : 16, + fontWeight: getIsItStartAndEndDate(date) + ? FontWeight.bold + : FontWeight.normal), + ), + ), + ), + ), + ), + Positioned( + bottom: 9, + right: 0, + left: 0, + child: Container( + height: 6, + width: 6, + decoration: BoxDecoration( + color: DateTime.now().day == date.day && + DateTime.now().month == date.month && + DateTime.now().year == date.year + ? getIsInRange(date) + ? Colors.white + : HotelAppTheme.buildLightTheme().primaryColor + : Colors.transparent, + shape: BoxShape.circle), + ), + ), + ], + ), + ), + ), + ); + count += 1; + } + noList.add(Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: listUI, + )); + } + return noList; + } + + bool getIsInRange(DateTime date) { + if (startDate != null && endDate != null) { + if (date.isAfter(startDate!) && date.isBefore(endDate!)) { + return true; + } + } + return false; + } + + bool getIsItStartAndEndDate(DateTime date) { + if ((startDate != null && + startDate!.day == date.day && + startDate!.month == date.month && + startDate!.year == date.year) || + (endDate != null && + endDate!.day == date.day && + endDate!.month == date.month && + endDate!.year == date.year)) return true; + return false; + } + + bool isStartDateRadius(DateTime date) { + if (startDate != null && + startDate!.day == date.day && + startDate!.month == date.month) { + return true; + } else if (date.weekday == 1) { + return true; + } else { + return false; + } + } + + bool isEndDateRadius(DateTime date) { + if (endDate != null && + endDate!.day == date.day && + endDate!.month == date.month) { + return true; + } else if (date.weekday == 7) { + return true; + } else { + return false; + } + } + + void onDateClick(DateTime date) { + if (startDate == null) { + startDate = date; + } else if (startDate != date && endDate == null) { + endDate = date; + } else if (startDate!.day == date.day && startDate!.month == date.month) { + startDate = null; + } else if (endDate != null && + endDate!.day == date.day && + endDate!.month == date.month) { + endDate = null; + } + if (startDate == null && endDate != null) { + startDate = endDate; + endDate = null; + } + if (startDate != null && endDate != null) { + if (!endDate!.isAfter(startDate!)) { + final DateTime d = startDate!; + startDate = endDate; + endDate = d; + } + if (date.isBefore(startDate!)) { + startDate = date; + } else if (date.isAfter(endDate!)) { + endDate = date; + } else { + final int daysToStartDate = startDate!.difference(date).inDays.abs(); + final int daysToEndDate = endDate!.difference(date).inDays.abs(); + daysToStartDate > daysToEndDate ? endDate = date : startDate = date; + } + } + if (mounted) { + setState( + () { + if (startDate != null && endDate != null) { + try { + widget.startEndDateChange(startDate!, endDate!); + } catch (_) {} + } + }, + ); + } + } +} diff --git a/best_flutter_ui_templates/lib/hotel_booking/filters_screen.dart b/lib/hotel_booking/filters_screen.dart similarity index 63% rename from best_flutter_ui_templates/lib/hotel_booking/filters_screen.dart rename to lib/hotel_booking/filters_screen.dart index f1a33ade..e93c2222 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/filters_screen.dart +++ b/lib/hotel_booking/filters_screen.dart @@ -1,13 +1,16 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'range_slider_view.dart'; -import 'slider_view.dart'; + import 'hotel_app_theme.dart'; import 'model/popular_filter_list.dart'; +import 'range_slider_view.dart'; +import 'slider_view.dart'; class FiltersScreen extends StatefulWidget { + const FiltersScreen({super.key}); + @override - _FiltersScreenState createState() => _FiltersScreenState(); + State createState() => _FiltersScreenState(); } class _FiltersScreenState extends State { @@ -21,76 +24,71 @@ class _FiltersScreenState extends State { @override Widget build(BuildContext context) { - return Container( - color: HotelAppTheme.buildLightTheme().backgroundColor, - child: Scaffold( - backgroundColor: Colors.transparent, - body: Column( - children: [ - getAppBarUI(), - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - priceBarFilter(), - const Divider( - height: 1, - ), - popularFilter(), - const Divider( - height: 1, - ), - distanceViewUI(), - const Divider( - height: 1, - ), - allAccommodationUI() - ], - ), + return Material( + color: HotelAppTheme.buildLightTheme().colorScheme.background, + child: Column( + children: [ + getAppBarUI(), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + priceBarFilter(), + const Divider( + height: 1, + ), + popularFilter(), + const Divider( + height: 1, + ), + distanceViewUI(), + const Divider( + height: 1, + ), + allAccommodationUI() + ], ), ), - const Divider( - height: 1, - ), - Padding( - padding: const EdgeInsets.only( - left: 16, right: 16, bottom: 16, top: 8), - child: Container( - height: 48, - decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().primaryColor, + ), + const Divider( + height: 1, + ), + Padding( + padding: + const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8), + child: Container( + height: 48, + decoration: BoxDecoration( + color: HotelAppTheme.buildLightTheme().primaryColor, + borderRadius: const BorderRadius.all(Radius.circular(24.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + blurRadius: 8, + offset: const Offset(4, 4), + ), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( borderRadius: const BorderRadius.all(Radius.circular(24.0)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.6), - blurRadius: 8, - offset: const Offset(4, 4), - ), - ], - ), - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: const BorderRadius.all(Radius.circular(24.0)), - highlightColor: Colors.transparent, - onTap: () { - Navigator.pop(context); - }, - child: Center( - child: Text( - 'Apply', - style: TextStyle( - fontWeight: FontWeight.w500, - fontSize: 18, - color: Colors.white), - ), + highlightColor: Colors.transparent, + onTap: () => Navigator.pop(context), + child: const Center( + child: Text( + 'Apply', + style: TextStyle( + fontWeight: FontWeight.w500, + fontSize: 18, + color: Colors.white), ), ), ), ), - ) - ], - ), + ), + ) + ], ), ); } @@ -130,38 +128,39 @@ class _FiltersScreenState extends State { for (int i = 0; i < accomodationListData.length; i++) { final PopularFilterListData date = accomodationListData[i]; noList.add( - Material( - color: Colors.transparent, - child: InkWell( - borderRadius: const BorderRadius.all(Radius.circular(4.0)), - onTap: () { + InkWell( + borderRadius: const BorderRadius.all(Radius.circular(4.0)), + onTap: () { + if (mounted) { setState(() { checkAppPosition(i); }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Expanded( - child: Text( - date.titleTxt, - style: TextStyle(color: Colors.black), - ), + } + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Expanded( + child: Text( + date.titleTxt, + style: const TextStyle(color: Colors.black), ), - CupertinoSwitch( - activeColor: date.isSelected - ? HotelAppTheme.buildLightTheme().primaryColor - : Colors.grey.withOpacity(0.6), - onChanged: (bool value) { + ), + CupertinoSwitch( + activeColor: date.isSelected + ? HotelAppTheme.buildLightTheme().primaryColor + : Colors.grey.withOpacity(0.6), + onChanged: (bool value) { + if (mounted) { setState(() { checkAppPosition(i); }); - }, - value: date.isSelected, - ), - ], - ), + } + }, + value: date.isSelected, + ), + ], ), ), ), @@ -178,13 +177,13 @@ class _FiltersScreenState extends State { void checkAppPosition(int index) { if (index == 0) { if (accomodationListData[0].isSelected) { - accomodationListData.forEach((d) { - d.isSelected = false; - }); + for (final PopularFilterListData data in accomodationListData) { + data.isSelected = false; + } } else { - accomodationListData.forEach((d) { - d.isSelected = true; - }); + for (final PopularFilterListData data in accomodationListData) { + data.isSelected = true; + } } } else { accomodationListData[index].isSelected = @@ -280,35 +279,34 @@ class _FiltersScreenState extends State { listUI.add(Expanded( child: Row( children: [ - Material( - color: Colors.transparent, - child: InkWell( - borderRadius: const BorderRadius.all(Radius.circular(4.0)), - onTap: () { + InkWell( + borderRadius: const BorderRadius.all(Radius.circular(4.0)), + onTap: () { + if (mounted) { setState(() { date.isSelected = !date.isSelected; }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - date.isSelected - ? Icons.check_box - : Icons.check_box_outline_blank, - color: date.isSelected - ? HotelAppTheme.buildLightTheme().primaryColor - : Colors.grey.withOpacity(0.6), - ), - const SizedBox( - width: 4, - ), - Text( - date.titleTxt, - ), - ], - ), + } + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + date.isSelected + ? Icons.check_box + : Icons.check_box_outline_blank, + color: date.isSelected + ? HotelAppTheme.buildLightTheme().primaryColor + : Colors.grey.withOpacity(0.6), + ), + const SizedBox( + width: 4, + ), + Text( + date.titleTxt, + ), + ], ), ), ), @@ -321,12 +319,11 @@ class _FiltersScreenState extends State { break; } } catch (e) { - print(e); + debugPrint('filters_screen.dart: $e'); } } noList.add(Row( mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: listUI, )); @@ -366,7 +363,7 @@ class _FiltersScreenState extends State { Widget getAppBarUI() { return Container( decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), @@ -383,23 +380,20 @@ class _FiltersScreenState extends State { alignment: Alignment.centerLeft, width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, - child: Material( - color: Colors.transparent, - child: InkWell( - borderRadius: const BorderRadius.all( - Radius.circular(32.0), - ), - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Icon(Icons.close), - ), + child: InkWell( + borderRadius: const BorderRadius.all( + Radius.circular(32.0), + ), + onTap: () { + Navigator.pop(context); + }, + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.close), ), ), ), - Expanded( + const Expanded( child: Center( child: Text( 'Filters', @@ -410,7 +404,7 @@ class _FiltersScreenState extends State { ), ), ), - Container( + SizedBox( width: AppBar().preferredSize.height + 40, height: AppBar().preferredSize.height, ) diff --git a/lib/hotel_booking/hotel_app_theme.dart b/lib/hotel_booking/hotel_app_theme.dart new file mode 100644 index 00000000..35b6329b --- /dev/null +++ b/lib/hotel_booking/hotel_app_theme.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; + +class HotelAppTheme { + static TextTheme _buildTextTheme(TextTheme base) { + const String fontName = 'WorkSans'; + return base.copyWith( + displayLarge: base.displayLarge?.copyWith(fontFamily: fontName), + displayMedium: base.displayMedium?.copyWith(fontFamily: fontName), + displaySmall: base.displaySmall?.copyWith(fontFamily: fontName), + headlineMedium: base.headlineMedium?.copyWith(fontFamily: fontName), + headlineSmall: base.headlineSmall?.copyWith(fontFamily: fontName), + titleLarge: base.titleLarge?.copyWith(fontFamily: fontName), + labelLarge: base.labelLarge?.copyWith(fontFamily: fontName), + bodySmall: base.bodySmall?.copyWith(fontFamily: fontName), + bodyLarge: base.bodyLarge?.copyWith(fontFamily: fontName), + bodyMedium: base.bodyMedium?.copyWith(fontFamily: fontName), + titleMedium: base.titleMedium?.copyWith(fontFamily: fontName), + titleSmall: base.titleSmall?.copyWith(fontFamily: fontName), + labelSmall: base.labelSmall?.copyWith(fontFamily: fontName), + ); + } + + static ThemeData buildLightTheme() { + const Color primaryColor = Color(0xFF54D3C2); + const Color secondaryColor = Color(0xFF54D3C2); + final ColorScheme colorScheme = const ColorScheme.light().copyWith( + primary: primaryColor, + secondary: secondaryColor, + ); + final ThemeData base = ThemeData.light(); + return base.copyWith( + primaryColor: primaryColor, + indicatorColor: Colors.white, + splashColor: Colors.white24, + splashFactory: InkRipple.splashFactory, + canvasColor: Colors.white, + scaffoldBackgroundColor: const Color(0xFFF6F6F6), + buttonTheme: ButtonThemeData( + colorScheme: colorScheme, + textTheme: ButtonTextTheme.primary, + ), + textTheme: _buildTextTheme(base.textTheme), + primaryTextTheme: _buildTextTheme(base.primaryTextTheme), + platform: TargetPlatform.iOS, + colorScheme: colorScheme + .copyWith(background: const Color(0xFFFFFFFF)) + .copyWith(error: const Color(0xFFB00020)), + ); + } +} diff --git a/best_flutter_ui_templates/lib/hotel_booking/hotel_home_screen.dart b/lib/hotel_booking/hotel_home_screen.dart similarity index 57% rename from best_flutter_ui_templates/lib/hotel_booking/hotel_home_screen.dart rename to lib/hotel_booking/hotel_home_screen.dart index 660ae338..1feb5307 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/hotel_home_screen.dart +++ b/lib/hotel_booking/hotel_home_screen.dart @@ -1,37 +1,34 @@ -import 'dart:ui'; -import 'package:best_flutter_ui_templates/hotel_booking/calendar_popup_view.dart'; -import 'package:best_flutter_ui_templates/hotel_booking/hotel_list_view.dart'; -import 'package:best_flutter_ui_templates/hotel_booking/model/hotel_list_data.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; + +import 'calendar_popup_view.dart'; import 'filters_screen.dart'; import 'hotel_app_theme.dart'; +import 'hotel_list_view.dart'; +import 'model/hotel_list_data.dart'; class HotelHomeScreen extends StatefulWidget { + const HotelHomeScreen({super.key}); + @override - _HotelHomeScreenState createState() => _HotelHomeScreenState(); + State createState() => _HotelHomeScreenState(); } class _HotelHomeScreenState extends State with TickerProviderStateMixin { - AnimationController animationController; List hotelList = HotelListData.hotelList; final ScrollController _scrollController = ScrollController(); DateTime startDate = DateTime.now(); DateTime endDate = DateTime.now().add(const Duration(days: 5)); + late final AnimationController animationController; @override void initState() { + super.initState(); animationController = AnimationController( duration: const Duration(milliseconds: 1000), vsync: this); - super.initState(); - } - - Future getData() async { - await Future.delayed(const Duration(milliseconds: 200)); - return true; } @override @@ -40,85 +37,88 @@ class _HotelHomeScreenState extends State super.dispose(); } + Future getData() async { + await Future.delayed(const Duration(milliseconds: 200)); + return true; + } + @override Widget build(BuildContext context) { - return Theme( - data: HotelAppTheme.buildLightTheme(), - child: Container( - child: Scaffold( - body: Stack( - children: [ - InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent, - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: Column( - children: [ - getAppBarUI(), - Expanded( - child: NestedScrollView( - controller: _scrollController, - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return Column( - children: [ - getSearchBarUI(), - getTimeDateUI(), - ], - ); - }, childCount: 1), - ), - SliverPersistentHeader( - pinned: true, - floating: true, - delegate: ContestTabHeader( - getFilterBarUI(), - ), - ), - ]; - }, - body: Container( - color: - HotelAppTheme.buildLightTheme().backgroundColor, - child: ListView.builder( - itemCount: hotelList.length, - padding: const EdgeInsets.only(top: 8), - scrollDirection: Axis.vertical, - itemBuilder: (BuildContext context, int index) { - final int count = - hotelList.length > 10 ? 10 : hotelList.length; - final Animation animation = - Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: animationController, - curve: Interval( - (1 / count) * index, 1.0, - curve: Curves.fastOutSlowIn))); - animationController.forward(); - return HotelListView( - callback: () {}, - hotelData: hotelList[index], - animation: animation, - animationController: animationController, + return Material( + child: Theme( + data: HotelAppTheme.buildLightTheme(), + child: Stack( + children: [ + InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Column( + children: [ + getAppBarUI(), + Expanded( + child: NestedScrollView( + controller: _scrollController, + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + return Column( + children: [ + getSearchBarUI(), + getTimeDateUI(), + ], ); - }, + }, childCount: 1), + ), + SliverPersistentHeader( + pinned: true, + floating: true, + delegate: ContestTabHeader( + getFilterBarUI(), + ), ), + ]; + }, + body: Container( + color: HotelAppTheme.buildLightTheme() + .colorScheme + .background, + child: ListView.builder( + itemCount: hotelList.length, + padding: const EdgeInsets.only(top: 8), + itemBuilder: (BuildContext context, int index) { + final int count = + hotelList.length > 10 ? 10 : hotelList.length; + final Animation animation = + Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation( + parent: animationController, + curve: Interval( + (1 / count) * index, 1.0, + curve: Curves.fastOutSlowIn))); + animationController.forward(); + return HotelListView( + callback: () {}, + hotelData: hotelList[index], + animation: animation, + animationController: animationController, + ); + }, ), ), - ) - ], - ), + ), + ) + ], ), - ], - ), + ), + ], ), ), ); @@ -127,7 +127,7 @@ class _HotelHomeScreenState extends State Widget getListUI() { return Container( decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), @@ -137,7 +137,7 @@ class _HotelHomeScreenState extends State ), child: Column( children: [ - Container( + SizedBox( height: MediaQuery.of(context).size.height - 156 - 50, child: FutureBuilder( future: getData(), @@ -147,7 +147,6 @@ class _HotelHomeScreenState extends State } else { return ListView.builder( itemCount: hotelList.length, - scrollDirection: Axis.vertical, itemBuilder: (BuildContext context, int index) { final int count = hotelList.length > 10 ? 10 : hotelList.length; @@ -210,49 +209,48 @@ class _HotelHomeScreenState extends State Expanded( child: Row( children: [ - Material( - color: Colors.transparent, - child: InkWell( - focusColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent, - splashColor: Colors.grey.withOpacity(0.2), - borderRadius: const BorderRadius.all( - Radius.circular(4.0), - ), - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - // setState(() { - // isDatePopupOpen = true; - // }); - showDemoDialog(context: context); - }, - child: Padding( - padding: const EdgeInsets.only( - left: 8, right: 8, top: 4, bottom: 4), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Choose date', - style: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 16, - color: Colors.grey.withOpacity(0.8)), - ), - const SizedBox( - height: 8, - ), - Text( - '${DateFormat("dd, MMM").format(startDate)} - ${DateFormat("dd, MMM").format(endDate)}', - style: TextStyle( + InkWell( + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + splashColor: Colors.grey.withOpacity(0.2), + borderRadius: const BorderRadius.all( + Radius.circular(4.0), + ), + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + // if (mounted) { + // setState(() { + // isDatePopupOpen = true; + // }); + // } + showDemoDialog(context); + }, + child: Padding( + padding: const EdgeInsets.only( + left: 8, right: 8, top: 4, bottom: 4), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Choose date', + style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, - ), + color: Colors.grey.withOpacity(0.8)), + ), + const SizedBox( + height: 8, + ), + Text( + '${DateFormat('dd, MMM').format(startDate)} - ${DateFormat('dd, MMM').format(endDate)}', + style: const TextStyle( + fontWeight: FontWeight.w100, + fontSize: 16, ), - ], - ), + ), + ], ), ), ), @@ -270,45 +268,42 @@ class _HotelHomeScreenState extends State Expanded( child: Row( children: [ - Material( - color: Colors.transparent, - child: InkWell( - focusColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent, - splashColor: Colors.grey.withOpacity(0.2), - borderRadius: const BorderRadius.all( - Radius.circular(4.0), - ), - onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); - }, - child: Padding( - padding: const EdgeInsets.only( - left: 8, right: 8, top: 4, bottom: 4), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Number of Rooms', - style: TextStyle( - fontWeight: FontWeight.w100, - fontSize: 16, - color: Colors.grey.withOpacity(0.8)), - ), - const SizedBox( - height: 8, - ), - Text( - '1 Room - 2 Adults', - style: TextStyle( + InkWell( + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + hoverColor: Colors.transparent, + splashColor: Colors.grey.withOpacity(0.2), + borderRadius: const BorderRadius.all( + Radius.circular(4.0), + ), + onTap: () { + FocusScope.of(context).requestFocus(FocusNode()); + }, + child: Padding( + padding: const EdgeInsets.only( + left: 8, right: 8, top: 4, bottom: 4), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Number of Rooms', + style: TextStyle( fontWeight: FontWeight.w100, fontSize: 16, - ), + color: Colors.grey.withOpacity(0.8)), + ), + const SizedBox( + height: 8, + ), + const Text( + '1 Room - 2 Adults', + style: TextStyle( + fontWeight: FontWeight.w100, + fontSize: 16, ), - ], - ), + ), + ], ), ), ), @@ -330,7 +325,7 @@ class _HotelHomeScreenState extends State padding: const EdgeInsets.only(right: 16, top: 8, bottom: 8), child: Container( decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, borderRadius: const BorderRadius.all( Radius.circular(38.0), ), @@ -350,7 +345,7 @@ class _HotelHomeScreenState extends State fontSize: 18, ), cursorColor: HotelAppTheme.buildLightTheme().primaryColor, - decoration: InputDecoration( + decoration: const InputDecoration( border: InputBorder.none, hintText: 'London...', ), @@ -383,9 +378,12 @@ class _HotelHomeScreenState extends State }, child: Padding( padding: const EdgeInsets.all(16.0), - child: Icon(FontAwesomeIcons.search, - size: 20, - color: HotelAppTheme.buildLightTheme().backgroundColor), + child: Icon( + FontAwesomeIcons.magnifyingGlass, + size: 20, + color: + HotelAppTheme.buildLightTheme().colorScheme.background, + ), ), ), ), @@ -405,7 +403,7 @@ class _HotelHomeScreenState extends State child: Container( height: 24, decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), @@ -416,15 +414,15 @@ class _HotelHomeScreenState extends State ), ), Container( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, child: Padding( padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 4), child: Row( children: [ - Expanded( + const Expanded( child: Padding( - padding: const EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Text( '530 hotels found', style: TextStyle( @@ -449,7 +447,8 @@ class _HotelHomeScreenState extends State Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => FiltersScreen(), + builder: (BuildContext context) => + const FiltersScreen(), fullscreenDialog: true), ); }, @@ -457,7 +456,7 @@ class _HotelHomeScreenState extends State padding: const EdgeInsets.only(left: 8), child: Row( children: [ - Text( + const Text( 'Filter', style: TextStyle( fontWeight: FontWeight.w100, @@ -491,22 +490,21 @@ class _HotelHomeScreenState extends State ); } - void showDemoDialog({BuildContext context}) { + void showDemoDialog(BuildContext context) { showDialog( context: context, builder: (BuildContext context) => CalendarPopupView( - barrierDismissible: true, minimumDate: DateTime.now(), // maximumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 10), initialEndDate: endDate, initialStartDate: startDate, onApplyClick: (DateTime startData, DateTime endData) { - setState(() { - if (startData != null && endData != null) { + if (mounted) { + setState(() { startDate = startData; endDate = endData; - } - }); + }); + } }, onCancelClick: () {}, ), @@ -516,7 +514,7 @@ class _HotelHomeScreenState extends State Widget getAppBarUI() { return Container( decoration: BoxDecoration( - color: HotelAppTheme.buildLightTheme().backgroundColor, + color: HotelAppTheme.buildLightTheme().colorScheme.background, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), @@ -527,76 +525,64 @@ class _HotelHomeScreenState extends State child: Padding( padding: EdgeInsets.only( top: MediaQuery.of(context).padding.top, left: 8, right: 8), - child: Row( - children: [ - Container( - alignment: Alignment.centerLeft, - width: AppBar().preferredSize.height + 40, - height: AppBar().preferredSize.height, - child: Material( - color: Colors.transparent, + child: Material( + child: Row( + children: [ + Container( + alignment: Alignment.centerLeft, + width: AppBar().preferredSize.height + 40, + height: AppBar().preferredSize.height, child: InkWell( - borderRadius: const BorderRadius.all( - Radius.circular(32.0), - ), - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), + borderRadius: const BorderRadius.all(Radius.circular(32.0)), + onTap: () => Navigator.pop(context), + child: const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.arrow_back), ), ), ), - ), - Expanded( - child: Center( - child: Text( - 'Explore', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 22, + const Expanded( + child: Center( + child: Text( + 'Explore', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 22, + ), ), ), ), - ), - Container( - width: AppBar().preferredSize.height + 40, - height: AppBar().preferredSize.height, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Material( - color: Colors.transparent, - child: InkWell( + SizedBox( + width: AppBar().preferredSize.height + 40, + height: AppBar().preferredSize.height, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () {}, - child: Padding( - padding: const EdgeInsets.all(8.0), + child: const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.favorite_border), ), ), - ), - Material( - color: Colors.transparent, - child: InkWell( + InkWell( borderRadius: const BorderRadius.all( Radius.circular(32.0), ), onTap: () {}, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Icon(FontAwesomeIcons.mapMarkerAlt), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon(FontAwesomeIcons.locationDot), ), ), - ), - ], - ), - ) - ], + ], + ), + ) + ], + ), ), ), ); diff --git a/best_flutter_ui_templates/lib/hotel_booking/hotel_list_view.dart b/lib/hotel_booking/hotel_list_view.dart similarity index 54% rename from best_flutter_ui_templates/lib/hotel_booking/hotel_list_view.dart rename to lib/hotel_booking/hotel_list_view.dart index fec57e7c..721718a0 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/hotel_list_view.dart +++ b/lib/hotel_booking/hotel_list_view.dart @@ -1,29 +1,29 @@ -import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:smooth_star_rating/smooth_star_rating.dart'; +import 'hotel_app_theme.dart'; import 'model/hotel_list_data.dart'; +import 'smooth_star_rating.dart'; class HotelListView extends StatelessWidget { - const HotelListView( - {Key key, - this.hotelData, - this.animationController, - this.animation, - this.callback}) - : super(key: key); + const HotelListView({ + required this.hotelData, + required this.animationController, + required this.animation, + required this.callback, + super.key, + }); final VoidCallback callback; final HotelListData hotelData; final AnimationController animationController; - final Animation animation; + final Animation animation; @override Widget build(BuildContext context) { return AnimatedBuilder( animation: animationController, - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, _) { return FadeTransition( opacity: animation, child: Transform( @@ -32,11 +32,8 @@ class HotelListView extends StatelessWidget { child: Padding( padding: const EdgeInsets.only( left: 24, right: 24, top: 8, bottom: 16), - child: InkWell( - splashColor: Colors.transparent, - onTap: () { - callback(); - }, + child: GestureDetector( + onTap: () => callback(), child: Container( decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(16.0)), @@ -63,95 +60,89 @@ class HotelListView extends StatelessWidget { ), Container( color: HotelAppTheme.buildLightTheme() - .backgroundColor, + .colorScheme + .background, child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( - child: Container( - child: Padding( - padding: const EdgeInsets.only( - left: 16, top: 8, bottom: 8), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - hotelData.titleTxt, - textAlign: TextAlign.left, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 22, - ), + child: Padding( + padding: const EdgeInsets.only( + left: 16, top: 8, bottom: 8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + hotelData.titleTxt, + textAlign: TextAlign.left, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 22, ), - Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - hotelData.subTxt, + ), + Row( + children: [ + Text( + hotelData.subTxt, + style: TextStyle( + fontSize: 14, + color: Colors.grey + .withOpacity(0.8)), + ), + const SizedBox( + width: 4, + ), + Icon( + FontAwesomeIcons.locationDot, + size: 12, + color: HotelAppTheme + .buildLightTheme() + .primaryColor, + ), + Expanded( + child: Text( + '${hotelData.dist.toStringAsFixed(1)} km to city', + overflow: + TextOverflow.ellipsis, style: TextStyle( fontSize: 14, color: Colors.grey .withOpacity(0.8)), ), - const SizedBox( - width: 4, - ), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 12, + ), + ], + ), + Padding( + padding: + const EdgeInsets.only(top: 4), + child: Row( + children: [ + SmoothStarRating( + rating: hotelData.rating, + onRatingChanged: (_) {}, + size: 20, color: HotelAppTheme .buildLightTheme() .primaryColor, + borderColor: HotelAppTheme + .buildLightTheme() + .primaryColor, ), - Expanded( - child: Text( - '${hotelData.dist.toStringAsFixed(1)} km to city', - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontSize: 14, - color: Colors.grey - .withOpacity(0.8)), - ), + Text( + ' ${hotelData.reviews} Reviews', + style: TextStyle( + fontSize: 14, + color: Colors.grey + .withOpacity(0.8)), ), ], ), - Padding( - padding: - const EdgeInsets.only(top: 4), - child: Row( - children: [ - SmoothStarRating( - allowHalfRating: true, - starCount: 5, - rating: hotelData.rating, - size: 20, - color: HotelAppTheme - .buildLightTheme() - .primaryColor, - borderColor: HotelAppTheme - .buildLightTheme() - .primaryColor, - ), - Text( - ' ${hotelData.reviews} Reviews', - style: TextStyle( - fontSize: 14, - color: Colors.grey - .withOpacity(0.8)), - ), - ], - ), - ), - ], - ), + ), + ], ), ), ), @@ -167,7 +158,7 @@ class HotelListView extends StatelessWidget { Text( '\$${hotelData.perNight}', textAlign: TextAlign.left, - style: TextStyle( + style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 22, ), @@ -207,7 +198,7 @@ class HotelListView extends StatelessWidget { ), ), ), - ) + ), ], ), ), diff --git a/best_flutter_ui_templates/lib/hotel_booking/model/hotel_list_data.dart b/lib/hotel_booking/model/hotel_list_data.dart similarity index 93% rename from best_flutter_ui_templates/lib/hotel_booking/model/hotel_list_data.dart rename to lib/hotel_booking/model/hotel_list_data.dart index 3305d38e..4699f503 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/model/hotel_list_data.dart +++ b/lib/hotel_booking/model/hotel_list_data.dart @@ -2,7 +2,7 @@ class HotelListData { HotelListData({ this.imagePath = '', this.titleTxt = '', - this.subTxt = "", + this.subTxt = '', this.dist = 1.8, this.reviews = 80, this.rating = 4.5, @@ -23,9 +23,7 @@ class HotelListData { titleTxt: 'Grand Royal Hotel', subTxt: 'Wembley, London', dist: 2.0, - reviews: 80, rating: 4.4, - perNight: 180, ), HotelListData( imagePath: 'assets/hotel/hotel_2.png', @@ -33,7 +31,6 @@ class HotelListData { subTxt: 'Wembley, London', dist: 4.0, reviews: 74, - rating: 4.5, perNight: 200, ), HotelListData( @@ -60,7 +57,6 @@ class HotelListData { subTxt: 'Wembley, London', dist: 2.0, reviews: 240, - rating: 4.5, perNight: 200, ), ]; diff --git a/best_flutter_ui_templates/lib/hotel_booking/model/popular_filter_list.dart b/lib/hotel_booking/model/popular_filter_list.dart similarity index 77% rename from best_flutter_ui_templates/lib/hotel_booking/model/popular_filter_list.dart rename to lib/hotel_booking/model/popular_filter_list.dart index 656e6753..5b1406d3 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/model/popular_filter_list.dart +++ b/lib/hotel_booking/model/popular_filter_list.dart @@ -10,11 +10,9 @@ class PopularFilterListData { static List popularFList = [ PopularFilterListData( titleTxt: 'Free Breakfast', - isSelected: false, ), PopularFilterListData( titleTxt: 'Free Parking', - isSelected: false, ), PopularFilterListData( titleTxt: 'Pool', @@ -22,22 +20,18 @@ class PopularFilterListData { ), PopularFilterListData( titleTxt: 'Pet Friendly', - isSelected: false, ), PopularFilterListData( titleTxt: 'Free wifi', - isSelected: false, ), ]; - static List accomodationList = [ + static List accomodationList = [ PopularFilterListData( titleTxt: 'All', - isSelected: false, ), PopularFilterListData( titleTxt: 'Apartment', - isSelected: false, ), PopularFilterListData( titleTxt: 'Home', @@ -45,15 +39,12 @@ class PopularFilterListData { ), PopularFilterListData( titleTxt: 'Villa', - isSelected: false, ), PopularFilterListData( titleTxt: 'Hotel', - isSelected: false, ), PopularFilterListData( titleTxt: 'Resort', - isSelected: false, ), ]; } diff --git a/best_flutter_ui_templates/lib/hotel_booking/range_slider_view.dart b/lib/hotel_booking/range_slider_view.dart similarity index 56% rename from best_flutter_ui_templates/lib/hotel_booking/range_slider_view.dart rename to lib/hotel_booking/range_slider_view.dart index fe29ade2..13777c39 100644 --- a/best_flutter_ui_templates/lib/hotel_booking/range_slider_view.dart +++ b/lib/hotel_booking/range_slider_view.dart @@ -1,96 +1,98 @@ -import 'package:best_flutter_ui_templates/hotel_booking/hotel_app_theme.dart'; import 'package:flutter/material.dart'; +import 'hotel_app_theme.dart'; + class RangeSliderView extends StatefulWidget { - const RangeSliderView({Key key, this.values, this.onChangeRangeValues}) - : super(key: key); + const RangeSliderView({ + required this.values, + required this.onChangeRangeValues, + super.key, + }); final Function(RangeValues) onChangeRangeValues; final RangeValues values; @override - _RangeSliderViewState createState() => _RangeSliderViewState(); + State createState() => _RangeSliderViewState(); } class _RangeSliderViewState extends State { - RangeValues _values; - + late RangeValues _values; @override void initState() { - _values = widget.values; super.initState(); + _values = widget.values; } @override Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - Stack( - children: [ - Row( - children: [ - Expanded( - flex: _values.start.round(), - child: const SizedBox(), - ), - Container( - width: 54, - child: Text( - '\$${_values.start.round()}', - textAlign: TextAlign.center, - ), - ), - Expanded( - flex: 1000 - _values.start.round(), - child: const SizedBox(), + return Column( + children: [ + Stack( + children: [ + Row( + children: [ + Expanded( + flex: _values.start.round(), + child: const SizedBox(), + ), + SizedBox( + width: 54, + child: Text( + '\$${_values.start.round()}', + textAlign: TextAlign.center, ), - ], - ), - Row( - children: [ - Expanded( - flex: _values.end.round(), - child: const SizedBox(), - ), - Container( - width: 54, - child: Text( - '\$${_values.end.round()}', - textAlign: TextAlign.center, - ), - ), - Expanded( - flex: 1000 - _values.end.round(), - child: const SizedBox(), + ), + Expanded( + flex: 1000 - _values.start.round(), + child: const SizedBox(), + ), + ], + ), + Row( + children: [ + Expanded( + flex: _values.end.round(), + child: const SizedBox(), + ), + SizedBox( + width: 54, + child: Text( + '\$${_values.end.round()}', + textAlign: TextAlign.center, ), - ], - ), - ], - ), - SliderTheme( - data: SliderThemeData( - rangeThumbShape: CustomRangeThumbShape(), + ), + Expanded( + flex: 1000 - _values.end.round(), + child: const SizedBox(), + ), + ], ), - child: RangeSlider( - values: _values, - min: 0.0, - max: 1000.0, - activeColor: HotelAppTheme.buildLightTheme().primaryColor, - inactiveColor: Colors.grey.withOpacity(0.4), - divisions: 1000, - onChanged: (RangeValues values) { - try { + ], + ), + SliderTheme( + data: SliderThemeData( + rangeThumbShape: CustomRangeThumbShape(), + ), + child: RangeSlider( + values: _values, + max: 1000.0, + activeColor: HotelAppTheme.buildLightTheme().primaryColor, + inactiveColor: Colors.grey.withOpacity(0.4), + divisions: 1000, + onChanged: (RangeValues values) { + try { + if (mounted) { setState(() { _values = values; }); - widget.onChangeRangeValues(_values); - } catch (_) {} - }, - ), + } + widget.onChangeRangeValues(_values); + } catch (_) {} + }, ), - ], - ), + ), + ], ); } } @@ -115,15 +117,15 @@ class CustomRangeThumbShape extends RangeSliderThumbShape { void paint( PaintingContext context, Offset center, { - @required Animation activationAnimation, - @required Animation enableAnimation, + required Animation activationAnimation, + required Animation enableAnimation, + required SliderThemeData sliderTheme, bool isDiscrete = false, bool isEnabled = false, - bool isOnTop, - bool isPressed, - @required SliderThemeData sliderTheme, - TextDirection textDirection, - Thumb thumb, + bool isOnTop = false, + bool isPressed = false, + TextDirection textDirection = TextDirection.ltr, + Thumb thumb = Thumb.start, }) { final Canvas canvas = context.canvas; final ColorTween colorTween = ColorTween( @@ -167,10 +169,10 @@ class CustomRangeThumbShape extends RangeSliderThumbShape { MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(8))); final Paint cPaint = Paint(); - cPaint..color = Colors.white; - cPaint..strokeWidth = 14 / 2; + cPaint.color = Colors.white; + cPaint.strokeWidth = 14 / 2; canvas.drawCircle(Offset(center.dx, center.dy), 12, cPaint); - cPaint..color = colorTween.evaluate(enableAnimation); + cPaint.color = colorTween.evaluate(enableAnimation) ?? Colors.white; canvas.drawCircle(Offset(center.dx, center.dy), 10, cPaint); canvas.drawPath(thumbPath, Paint()..color = Colors.white); } diff --git a/lib/hotel_booking/slider_view.dart b/lib/hotel_booking/slider_view.dart new file mode 100644 index 00000000..0f41d27b --- /dev/null +++ b/lib/hotel_booking/slider_view.dart @@ -0,0 +1,135 @@ +import 'package:flutter/material.dart'; + +import 'hotel_app_theme.dart'; + +class SliderView extends StatefulWidget { + const SliderView({ + required this.onChangedistValue, + required this.distValue, + super.key, + }); + + final Function(double) onChangedistValue; + final double distValue; + + @override + State createState() => _SliderViewState(); +} + +class _SliderViewState extends State { + double distValue = 50.0; + + @override + void initState() { + super.initState(); + distValue = widget.distValue; + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + Expanded( + flex: distValue.round(), + child: const SizedBox(), + ), + SizedBox( + width: 170, + child: Text( + 'Less than ${(distValue / 10).toStringAsFixed(1)} Km', + textAlign: TextAlign.center, + ), + ), + Expanded( + flex: 100 - distValue.round(), + child: const SizedBox(), + ), + ], + ), + SliderTheme( + data: SliderThemeData( + thumbShape: CustomThumbShape(), + ), + child: Slider( + onChanged: (double value) { + if (mounted) { + setState(() { + distValue = value; + }); + } + try { + widget.onChangedistValue(distValue); + } catch (_) {} + }, + max: 100, + activeColor: HotelAppTheme.buildLightTheme().primaryColor, + inactiveColor: Colors.grey.withOpacity(0.4), + divisions: 100, + value: distValue, + ), + ), + ], + ); + } +} + +class CustomThumbShape extends SliderComponentShape { + static const double _thumbSize = 3.0; + static const double _disabledThumbSize = 3.0; + + @override + Size getPreferredSize(bool isEnabled, bool isDiscrete) { + return isEnabled + ? const Size.fromRadius(_thumbSize) + : const Size.fromRadius(_disabledThumbSize); + } + + static final Animatable sizeTween = Tween( + begin: _disabledThumbSize, + end: _thumbSize, + ); + + @override + void paint( + PaintingContext context, + Offset center, { + required Animation activationAnimation, + required Animation enableAnimation, + required bool isDiscrete, + required TextPainter labelPainter, + required RenderBox parentBox, + required Size sizeWithOverflow, + required SliderThemeData sliderTheme, + required TextDirection textDirection, + required double textScaleFactor, + required double value, + }) { + final Canvas canvas = context.canvas; + final ColorTween colorTween = ColorTween( + begin: sliderTheme.disabledThumbColor, + end: sliderTheme.thumbColor, + ); + canvas.drawPath( + Path() + ..addOval(Rect.fromPoints(Offset(center.dx + 12, center.dy + 12), + Offset(center.dx - 12, center.dy - 12))) + ..fillType = PathFillType.evenOdd, + Paint() + ..color = Colors.black.withOpacity(0.5) + ..maskFilter = + MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(8))); + + final Paint cPaint = Paint(); + cPaint.color = Colors.white; + cPaint.strokeWidth = 14 / 2; + canvas.drawCircle(Offset(center.dx, center.dy), 12, cPaint); + cPaint.color = colorTween.evaluate(enableAnimation) ?? Colors.white; + canvas.drawCircle(Offset(center.dx, center.dy), 10, cPaint); + } + + double convertRadiusToSigma(double radius) { + return radius * 0.57735 + 0.5; + } +} diff --git a/lib/hotel_booking/smooth_star_rating.dart b/lib/hotel_booking/smooth_star_rating.dart new file mode 100644 index 00000000..b9dec7f6 --- /dev/null +++ b/lib/hotel_booking/smooth_star_rating.dart @@ -0,0 +1,104 @@ +// The MIT License (MIT) + +// Copyright (c) 2019 Thangrobul Infimate + +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +import 'package:flutter/material.dart'; + +typedef RatingChangeCallback = void Function(double rating); + +class SmoothStarRating extends StatelessWidget { + const SmoothStarRating({ + required this.onRatingChanged, + this.starCount = 5, + this.spacing = 0.0, + this.rating = 0.0, + this.defaultIconData = Icons.star_border, + this.color, + this.borderColor, + this.size = 25, + this.filledIconData = Icons.star, + this.halfFilledIconData = Icons.star_half, + this.allowHalfRating = true, + super.key, + }); + + final int starCount; + final double rating; + final RatingChangeCallback onRatingChanged; + final Color? color; + final Color? borderColor; + final double size; + final bool allowHalfRating; + final IconData filledIconData; + final IconData halfFilledIconData; + final IconData + defaultIconData; // this is needed only when having fullRatedIconData && halfRatedIconData + final double spacing; + + Widget buildStar(BuildContext context, int index) { + Icon icon; + if (index >= rating) { + icon = Icon( + defaultIconData, + color: borderColor ?? Theme.of(context).primaryColor, + size: size, + ); + } else if (index > rating - (allowHalfRating ? 0.5 : 1.0)) { + icon = Icon( + halfFilledIconData, + color: color ?? Theme.of(context).primaryColor, + size: size, + ); + } else { + icon = Icon( + filledIconData, + color: color ?? Theme.of(context).primaryColor, + size: size, + ); + } + + return GestureDetector( + onTap: () => onRatingChanged(index + 1.0), + onHorizontalDragUpdate: (DragUpdateDetails dragDetails) { + final RenderBox? box = context.findRenderObject() as RenderBox?; + final Offset? pos = box?.globalToLocal(dragDetails.globalPosition); + final double i = pos?.dx ?? 0 / size; + double rating = allowHalfRating ? i : i.round().toDouble(); + if (rating > starCount) { + rating = starCount.toDouble(); + } + if (rating < 0) { + rating = 0.0; + } + onRatingChanged(rating); + }, + child: icon, + ); + } + + @override + Widget build(BuildContext context) { + return Material( + color: Colors.transparent, + child: Wrap( + spacing: spacing, + children: List.generate( + starCount, (int index) => buildStar(context, index))), + ); + } +} diff --git a/lib/invite_friend_screen.dart b/lib/invite_friend_screen.dart new file mode 100644 index 00000000..e3adcff3 --- /dev/null +++ b/lib/invite_friend_screen.dart @@ -0,0 +1,92 @@ +import 'package:flutter/material.dart'; + +class InviteFriend extends StatefulWidget { + const InviteFriend({super.key}); + + @override + State createState() => _InviteFriendState(); +} + +class _InviteFriendState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + padding: EdgeInsets.only( + top: MediaQuery.of(context).padding.top, left: 16, right: 16), + child: Image.asset('assets/images/inviteImage.png'), + ), + Container( + padding: const EdgeInsets.only(top: 8), + child: const Text( + 'Invite Your Friends', + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + padding: const EdgeInsets.only(top: 16), + child: const Text( + 'Are you one of those who makes everything\n at the last moment?', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16, + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Container( + width: 120, + height: 40, + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: const BorderRadius.all(Radius.circular(4.0)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.6), + offset: const Offset(4, 4), + blurRadius: 8.0), + ], + ), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: () {}, + child: const Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.share, + color: Colors.white, + size: 22, + ), + Padding( + padding: EdgeInsets.all(4.0), + child: Text( + 'Share', + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + ), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ) + ], + ); + } +} diff --git a/best_flutter_ui_templates/lib/main.dart b/lib/main.dart similarity index 59% rename from best_flutter_ui_templates/lib/main.dart rename to lib/main.dart index ea3c4aec..3ff15d59 100644 --- a/best_flutter_ui_templates/lib/main.dart +++ b/lib/main.dart @@ -1,22 +1,30 @@ import 'dart:io'; -import 'package:best_flutter_ui_templates/app_theme.dart'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + +import 'app_theme.dart'; import 'navigation_home_screen.dart'; -void main() async { +Future main() async { WidgetsFlutterBinding.ensureInitialized(); - await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) - .then((_) => runApp(MyApp())); + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown + ]).then((_) => runApp(const MyApp())); } class MyApp extends StatelessWidget { + const MyApp({super.key}); + @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarIconBrightness: Brightness.dark, - statusBarBrightness: Platform.isAndroid ? Brightness.dark : Brightness.light, + statusBarBrightness: + Platform.isAndroid && !kIsWeb ? Brightness.dark : Brightness.light, systemNavigationBarColor: Colors.white, systemNavigationBarDividerColor: Colors.grey, systemNavigationBarIconBrightness: Brightness.dark, @@ -29,19 +37,12 @@ class MyApp extends StatelessWidget { textTheme: AppTheme.textTheme, platform: TargetPlatform.iOS, ), - home: NavigationHomeScreen(), + home: const Scaffold( + body: SafeArea( + top: false, + bottom: false, + child: NavigationHomeScreen(), + )), ); } } - -class HexColor extends Color { - HexColor(final String hexColor) : super(_getColorFromHex(hexColor)); - - static int _getColorFromHex(String hexColor) { - hexColor = hexColor.toUpperCase().replaceAll('#', ''); - if (hexColor.length == 6) { - hexColor = 'FF' + hexColor; - } - return int.parse(hexColor, radix: 16); - } -} diff --git a/lib/model/homelist.dart b/lib/model/homelist.dart new file mode 100644 index 00000000..5be1aadb --- /dev/null +++ b/lib/model/homelist.dart @@ -0,0 +1,27 @@ +import 'package:flutter/widgets.dart'; + +import '../design_course/home_design_course.dart'; +import '../fitness_app/fitness_app_home_screen.dart'; +import '../hotel_booking/hotel_home_screen.dart'; + +class HomeList { + HomeList({required this.navigateScreen, required this.imagePath}); + + Widget navigateScreen; + String imagePath; + + static List homeList = [ + HomeList( + navigateScreen: const HotelHomeScreen(), + imagePath: 'assets/hotel/hotel_booking.png', + ), + HomeList( + navigateScreen: const FitnessAppHomeScreen(), + imagePath: 'assets/fitness_app/fitness_app.png', + ), + HomeList( + navigateScreen: const DesignCourseHomeScreen(), + imagePath: 'assets/design_course/design_course.png', + ), + ]; +} diff --git a/lib/navigation_home_screen.dart b/lib/navigation_home_screen.dart new file mode 100644 index 00000000..78ae67a0 --- /dev/null +++ b/lib/navigation_home_screen.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; + +import 'about_screen.dart'; +import 'custom_drawer/drawer_user_controller.dart'; +import 'custom_drawer/home_drawer.dart'; +import 'feedback_screen.dart'; +import 'help_screen.dart'; +import 'home_screen.dart'; +import 'invite_friend_screen.dart'; + +class NavigationHomeScreen extends StatefulWidget { + const NavigationHomeScreen({super.key}); + + @override + State createState() => _NavigationHomeScreenState(); +} + +class _NavigationHomeScreenState extends State { + Widget screenView = const MyHomePage(); + DrawerIndex drawerIndex = DrawerIndex.home; + + @override + Widget build(BuildContext context) { + return DrawerUserController( + screenIndex: drawerIndex, + drawerWidth: MediaQuery.of(context).size.width * 0.75, + onDrawerCall: (DrawerIndex drawerIndexdata) { + changeIndex(drawerIndexdata); + //callback from drawer for replace screen as user need with passing DrawerIndex(Enum index) + }, + screenView: screenView, + //we replace screen view as we need on navigate starting screens like MyHomePage, HelpScreen, FeedbackScreen, etc... + ); + } + + void changeIndex(DrawerIndex drawerIndexdata) { + if (drawerIndex != drawerIndexdata) { + drawerIndex = drawerIndexdata; + if (drawerIndex == DrawerIndex.home) { + if (mounted) { + setState(() { + screenView = const MyHomePage(); + }); + } + } else if (drawerIndex == DrawerIndex.help) { + if (mounted) { + setState(() { + screenView = const HelpScreen(); + }); + } + } else if (drawerIndex == DrawerIndex.feedback) { + if (mounted) { + setState(() { + screenView = const FeedbackScreen(); + }); + } + } else if (drawerIndex == DrawerIndex.invite) { + if (mounted) { + setState(() { + screenView = const InviteFriend(); + }); + } + } else if (drawerIndex == DrawerIndex.about) { + if (mounted) { + setState(() { + screenView = const AboutScreen(); + }); + } + } + } + } +} diff --git a/linux/.gitignore b/linux/.gitignore new file mode 100644 index 00000000..d3896c98 --- /dev/null +++ b/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 00000000..8a788cb5 --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +set(BINARY_NAME "Templates") +set(APPLICATION_ID "com.example.templates") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Configure build options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Application build +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) +apply_standard_settings(${BINARY_NAME}) +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +add_dependencies(${BINARY_NAME} flutter_assemble) +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt new file mode 100644 index 00000000..a1da1b9e --- /dev/null +++ b/linux/flutter/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) +pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) +pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO + PkgConfig::BLKID + PkgConfig::LZMA +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + linux-x64 ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..f6f23bfe --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..f16b4c34 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_linux +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/main.cc b/linux/main.cc new file mode 100644 index 00000000..e7c5c543 --- /dev/null +++ b/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/my_application.cc b/linux/my_application.cc new file mode 100644 index 00000000..261c57c6 --- /dev/null +++ b/linux/my_application.cc @@ -0,0 +1,103 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen *screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "Templates"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "Templates"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject *object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + nullptr)); +} diff --git a/linux/my_application.h b/linux/my_application.h new file mode 100644 index 00000000..72271d5e --- /dev/null +++ b/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/macos/.gitignore b/macos/.gitignore new file mode 100644 index 00000000..746adbb6 --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 00000000..4b81f9b2 --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 00000000..5caa9d15 --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 00000000..8236f572 --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,12 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 00000000..dade8dfa --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,40 @@ +platform :osx, '10.11' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/macos/Podfile.lock b/macos/Podfile.lock new file mode 100644 index 00000000..137814e2 --- /dev/null +++ b/macos/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - FlutterMacOS (1.0.0) + - url_launcher_macos (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + url_launcher_macos: + :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + +SPEC CHECKSUMS: + FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 + url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 + +PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c + +COCOAPODS: 1.11.3 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..a02fc8ef --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,632 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + B8138E508FE297779E3079AC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72B5936C9BA9146B7146FA43 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 30E027315F6E4CD8BA092AFF /* 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 = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* templates.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = templates.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 5E181366B78D5870B2D1EFA8 /* 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 = ""; }; + 72B5936C9BA9146B7146FA43 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 833DA9CBDD543F1C30493AF4 /* 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 = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B8138E508FE297779E3079AC /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 535A33639158BC7B13D3B92B /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* templates.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 535A33639158BC7B13D3B92B /* Pods */ = { + isa = PBXGroup; + children = ( + 833DA9CBDD543F1C30493AF4 /* Pods-Runner.debug.xcconfig */, + 5E181366B78D5870B2D1EFA8 /* Pods-Runner.release.xcconfig */, + 30E027315F6E4CD8BA092AFF /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 72B5936C9BA9146B7146FA43 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 02F9E0E2FE81E948A0B75C55 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 6E36DCBB380AD8FD3125D678 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* templates.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 02F9E0E2FE81E948A0B75C55 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 6E36DCBB380AD8FD3125D678 /* [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; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..ed33d77f --- /dev/null +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..21a3cc14 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift new file mode 100644 index 00000000..d53ef643 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..a2ec33f1 --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 00000000..f4731d20 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 00000000..1b3f69ff Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 00000000..f1610a28 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 00000000..e2812878 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 00000000..fe004688 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 00000000..a5407c04 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 00000000..0c615886 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 00000000..537341ab --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 00000000..ce37883a --- /dev/null +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = Templates + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.templates + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2020 com.example. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 00000000..36b0fd94 --- /dev/null +++ b/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 00000000..dff4f495 --- /dev/null +++ b/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Warnings.xcconfig b/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 00000000..42bcbf47 --- /dev/null +++ b/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements new file mode 100644 index 00000000..dddb8a30 --- /dev/null +++ b/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist new file mode 100644 index 00000000..4789daa6 --- /dev/null +++ b/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 00000000..2722837e --- /dev/null +++ b/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements new file mode 100644 index 00000000..852fa1a4 --- /dev/null +++ b/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 00000000..e6abc109 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,298 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + font_awesome_flutter: + dependency: "direct main" + description: + name: font_awesome_flutter + sha256: "5fb789145cae1f4c3245c58b3f8fb287d055c26323879eab57a7bf0cfd1e45f3" + url: "https://pub.dev" + source: hosted + version: "10.5.0" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: transitive + description: + name: meta + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" + source: hosted + version: "2.1.6" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" + source: hosted + version: "0.7.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27" + url: "https://pub.dev" + source: hosted + version: "6.1.14" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: b04af59516ab45762b2ca6da40fa830d72d0f6045cd97744450b73493fa76330 + url: "https://pub.dev" + source: hosted + version: "6.1.0" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "7c65021d5dee51813d652357bc65b8dd4a6177082a9966bc8ba6ee477baa795f" + url: "https://pub.dev" + source: hosted + version: "6.1.5" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: b651aad005e0cb06a01dbd84b428a301916dc75f0e7ea6165f80057fee2d8e8e + url: "https://pub.dev" + source: hosted + version: "3.0.6" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: b55486791f666e62e0e8ff825e58a023fd6b1f71c49926483f1128d3bbd8fe88 + url: "https://pub.dev" + source: hosted + version: "3.0.7" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "95465b39f83bfe95fcb9d174829d6476216f2d548b79c38ab2506e0458787618" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: ba140138558fcc3eead51a1c42e92a9fb074a1b1149ed3c73e66035b2ccd94f2 + url: "https://pub.dev" + source: hosted + version: "2.0.19" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "95fef3129dc7cfaba2bc3d5ba2e16063bb561fc6d78e63eee16162bc70029069" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + vector_math: + dependency: "direct main" + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" +sdks: + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 00000000..0ed11584 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,55 @@ +name: templates + +publish_to: 'none' + +version: 1.0.0+1 + +environment: + sdk: '>=3.0.0 <4.0.0' + +dependencies: + flutter: + sdk: flutter + font_awesome_flutter: ^10.0.0 + intl: ^0.19.0 + url_launcher: ^6.0.0 + vector_math: ^2.0.0 + +dev_dependencies: + flutter_lints: ^4.0.0 + flutter_test: + sdk: flutter + +flutter_icons: + ios: true + android: true + image_path_ios: 'icon/ios.png' + image_path_android: 'icon/android.png' + adaptive_icon_background: '#ffffff' + adaptive_icon_foreground: 'icon/adaptive.png' + +flutter: + uses-material-design: true + + assets: + - assets/images/ + - assets/design_course/ + - assets/fitness_app/ + - assets/hotel/ + + fonts: + - family: WorkSans + fonts: + - asset: assets/fonts/WorkSans-Regular.ttf + - asset: assets/fonts/WorkSans-Medium.ttf + weight: 500 + - asset: assets/fonts/WorkSans-SemiBold.ttf + weight: 600 + - asset: assets/fonts/WorkSans-Bold.ttf + weight: 700 + - family: Roboto + fonts: + - asset: assets/fonts/Roboto-Bold.ttf + - asset: assets/fonts/Roboto-Regular.ttf + - asset: assets/fonts/Roboto-Medium.ttf + weight: 400 diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 00000000..700bee22 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +// import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +// import 'package:best_flutter_ui_templates/main.dart'; + +void main() { + testWidgets('Test', (WidgetTester tester) async { + // Build our app and trigger a frame. + // await tester.pumpWidget(MyApp()); + + // // Verify that our counter starts at 0. + // expect(find.text('0'), findsOneWidget); + // expect(find.text('1'), findsNothing); + + // // Tap the '+' icon and trigger a frame. + // await tester.tap(find.byIcon(Icons.add)); + // await tester.pump(); + + // // Verify that our counter has incremented. + // expect(find.text('0'), findsNothing); + // expect(find.text('1'), findsOneWidget); + }); +} diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 00000000..df6620aa Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 00000000..2da3b50c Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 00000000..0f7c5452 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 00000000..c12df5a4 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 00000000..c6dd9786 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 00000000..cedd8cfe --- /dev/null +++ b/web/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + Templates + + + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 00000000..7ce0c2a6 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "Flutter Templates", + "short_name": "Templates", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 00000000..d492d0d9 --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 00000000..dd4a062d --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required(VERSION 3.15) +project(templates LANGUAGES CXX) + +set(BINARY_NAME "templates") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Configure build options. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() + +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build +add_subdirectory("runner") + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt new file mode 100644 index 00000000..b02c5485 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required(VERSION 3.15) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + windows-x64 $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..4f788487 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include + +void RegisterPlugins(flutter::PluginRegistry* registry) { + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..dc139d85 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 00000000..88b22e5c --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + url_launcher_windows +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 00000000..977e38b5 --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.15) +project(runner LANGUAGES CXX) + +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "run_loop.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) +apply_standard_settings(${BINARY_NAME}) +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 00000000..7795ab04 --- /dev/null +++ b/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#ifdef FLUTTER_BUILD_NUMBER +#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#else +#define VERSION_AS_NUMBER 1,0,0 +#endif + +#ifdef FLUTTER_BUILD_NAME +#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "Flutter Templates" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "templates" "\0" + VALUE "LegalCopyright", "Copyright (C) 2020 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "templates.exe" "\0" + VALUE "ProductName", "templates" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp new file mode 100644 index 00000000..c4227230 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,64 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(RunLoop* run_loop, + const flutter::DartProject& project) + : run_loop_(run_loop), project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opporutunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h new file mode 100644 index 00000000..b663ddd5 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,39 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "run_loop.h" +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow driven by the |run_loop|, hosting a + // Flutter view running |project|. + explicit FlutterWindow(RunLoop* run_loop, + const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The run loop driving events for this window. + RunLoop* run_loop_; + + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 00000000..f2e7bd62 --- /dev/null +++ b/windows/runner/main.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "run_loop.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + RunLoop run_loop; + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(&run_loop, project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.CreateAndShow(L"best_flutter_ui_templates", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + run_loop.Run(); + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 00000000..66a65d1e --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 00000000..c04e20ca Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/run_loop.cpp b/windows/runner/run_loop.cpp new file mode 100644 index 00000000..2d6636ab --- /dev/null +++ b/windows/runner/run_loop.cpp @@ -0,0 +1,66 @@ +#include "run_loop.h" + +#include + +#include + +RunLoop::RunLoop() {} + +RunLoop::~RunLoop() {} + +void RunLoop::Run() { + bool keep_running = true; + TimePoint next_flutter_event_time = TimePoint::clock::now(); + while (keep_running) { + std::chrono::nanoseconds wait_duration = + std::max(std::chrono::nanoseconds(0), + next_flutter_event_time - TimePoint::clock::now()); + ::MsgWaitForMultipleObjects( + 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), + QS_ALLINPUT); + bool processed_events = false; + MSG message; + // All pending Windows messages must be processed; MsgWaitForMultipleObjects + // won't return again for items left in the queue after PeekMessage. + while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { + processed_events = true; + if (message.message == WM_QUIT) { + keep_running = false; + break; + } + ::TranslateMessage(&message); + ::DispatchMessage(&message); + // Allow Flutter to process messages each time a Windows message is + // processed, to prevent starvation. + next_flutter_event_time = + std::min(next_flutter_event_time, ProcessFlutterMessages()); + } + // If the PeekMessage loop didn't run, process Flutter messages. + if (!processed_events) { + next_flutter_event_time = + std::min(next_flutter_event_time, ProcessFlutterMessages()); + } + } +} + +void RunLoop::RegisterFlutterInstance( + flutter::FlutterEngine* flutter_instance) { + flutter_instances_.insert(flutter_instance); +} + +void RunLoop::UnregisterFlutterInstance( + flutter::FlutterEngine* flutter_instance) { + flutter_instances_.erase(flutter_instance); +} + +RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { + TimePoint next_event_time = TimePoint::max(); + for (auto instance : flutter_instances_) { + std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); + if (wait_duration != std::chrono::nanoseconds::max()) { + next_event_time = + std::min(next_event_time, TimePoint::clock::now() + wait_duration); + } + } + return next_event_time; +} diff --git a/windows/runner/run_loop.h b/windows/runner/run_loop.h new file mode 100644 index 00000000..000d3624 --- /dev/null +++ b/windows/runner/run_loop.h @@ -0,0 +1,40 @@ +#ifndef RUNNER_RUN_LOOP_H_ +#define RUNNER_RUN_LOOP_H_ + +#include + +#include +#include + +// A runloop that will service events for Flutter instances as well +// as native messages. +class RunLoop { + public: + RunLoop(); + ~RunLoop(); + + // Prevent copying + RunLoop(RunLoop const&) = delete; + RunLoop& operator=(RunLoop const&) = delete; + + // Runs the run loop until the application quits. + void Run(); + + // Registers the given Flutter instance for event servicing. + void RegisterFlutterInstance( + flutter::FlutterEngine* flutter_instance); + + // Unregisters the given Flutter instance from event servicing. + void UnregisterFlutterInstance( + flutter::FlutterEngine* flutter_instance); + + private: + using TimePoint = std::chrono::steady_clock::time_point; + + // Processes all currently pending messages for registered Flutter instances. + TimePoint ProcessFlutterMessages(); + + std::set flutter_instances_; +}; + +#endif // RUNNER_RUN_LOOP_H_ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 00000000..c977c4a4 --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,20 @@ + + + + + PerMonitorV2 + + + + + + + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 00000000..d19bdbbc --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,64 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr); + if (target_length == 0) { + return std::string(); + } + std::string utf8_string; + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, utf8_string.data(), + target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/windows/runner/utils.h b/windows/runner/utils.h new file mode 100644 index 00000000..3879d547 --- /dev/null +++ b/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp new file mode 100644 index 00000000..c10f08dc --- /dev/null +++ b/windows/runner/win32_window.cpp @@ -0,0 +1,245 @@ +#include "win32_window.h" + +#include + +#include "resource.h" + +namespace { + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + FreeLibrary(user32_module); + } +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + return OnCreate(); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h new file mode 100644 index 00000000..17ba4311 --- /dev/null +++ b/windows/runner/win32_window.h @@ -0,0 +1,98 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates and shows a win32 window with |title| and position and size using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size to will treat the width height passed in to this function + // as logical pixels and scale to appropriate for the default monitor. Returns + // true if the window was created successfully. + bool CreateAndShow(const std::wstring& title, + const Point& origin, + const Size& size); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responsponds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_