diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f827c74..20d2a0e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -20,4 +20,5 @@ ## Related Issues [Add issues related to this PR, if any.] -- [issue 1 link] \ No newline at end of file + +- [issue 1 link] diff --git a/.github/actions/setup-flutter/action.yml b/.github/actions/setup-flutter/action.yml new file mode 100644 index 0000000..10ea5de --- /dev/null +++ b/.github/actions/setup-flutter/action.yml @@ -0,0 +1,20 @@ +name: "Setup Flutter" +description: "Reusable action to setup Flutter environment" + +runs: + using: "composite" + steps: + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.29.3" # Set the desired Flutter version + + - name: Install dependencies - CraftD Widget + working-directory: flutter/craftd_widget + run: flutter pub get + shell: bash + + - name: Install dependencies - Sample + working-directory: flutter/sample + run: flutter pub get + shell: bash diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4d0eb3e..662884b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,10 +1,10 @@ -name: documentation +name: documentation on: pull_request: branches: - main paths: - - 'docs/**' + - "docs/**" permissions: contents: write jobs: @@ -19,12 +19,12 @@ jobs: - uses: actions/setup-python@v5 with: python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v4 with: key: mkdocs-material-${{ env.cache_id }} path: .cache restore-keys: | mkdocs-material- - - run: pip install mkdocs-material + - run: pip install mkdocs-material - run: mkdocs gh-deploy --force diff --git a/.github/workflows/flutter-linter.yml b/.github/workflows/flutter-linter.yml new file mode 100644 index 0000000..5d5e8d5 --- /dev/null +++ b/.github/workflows/flutter-linter.yml @@ -0,0 +1,25 @@ +name: Flutter linter + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Flutter + uses: ./.github/actions/setup-flutter + + - name: Analyze - CraftD Widget + working-directory: flutter/craftd_widget + run: dart analyze + + - name: Analyze - Sample + working-directory: flutter/sample + run: dart analyze diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 953beb4..5909c2d 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -40,4 +40,4 @@ jobs: env: VALIDATE_ALL_CODEBASE: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a680d90..302c235 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -3,7 +3,7 @@ name: Build and Test for PRs on: pull_request: branches: - - '*' + - "*" jobs: build: @@ -17,8 +17,8 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: '17' + distribution: "temurin" + java-version: "17" - name: Set up Android SDK uses: android-actions/setup-android@v2 @@ -43,8 +43,8 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: '17' + distribution: "temurin" + java-version: "17" - name: Run Unit Tests run: ./gradlew testDebugUnitTest --no-daemon diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a4fbffc..7ed3c70 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,8 +17,8 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: '17' + distribution: "temurin" + java-version: "17" - name: Publish to Maven Central run: | @@ -37,7 +37,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: "3.0" bundler-cache: true - name: Install bundler & Fastlane @@ -49,4 +49,4 @@ jobs: - name: Update tag run: bundle exec fastlane update_tag env: - PREFIX: 'android' \ No newline at end of file + PREFIX: "android" diff --git a/.mega-linter.yml b/.mega-linter.yml index 8a0d448..0fa9788 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -4,7 +4,7 @@ # linters documentation # all, none, or list of linter keys -APPLY_FIXES: all +APPLY_FIXES: none # If you use ENABLE variable, all other languages/formats/tooling-formats will # be disabled by default @@ -16,7 +16,6 @@ ENABLE_LINTERS: - YAML_PRETTIER - MARKDOWN_MARKDOWN_TABLE_FORMATTER - KOTLIN_DETEKT - - DART_DARTANALYZER - SWIFT_SWIFTLINT DISABLE: @@ -28,7 +27,6 @@ SHOW_ELAPSED_TIME: true FILEIO_REPORTER: false # Uncomment if you want MegaLinter to detect errors but not block CI to pass -DISABLE_ERRORS: true - KOTLIN_DETEKT_ARGUMENTS: -c android_kmp/config/detekt/detekt.yml JAVASCRIPT_STANDARD_DISABLE_ERRORS: true +KOTLIN_DETEKT_DISABLE_ERRORS: true diff --git a/android_kmp/config/detekt/detekt.yml b/android_kmp/config/detekt/detekt.yml index d717e31..54e6c2e 100644 --- a/android_kmp/config/detekt/detekt.yml +++ b/android_kmp/config/detekt/detekt.yml @@ -12,12 +12,12 @@ config: warningsAsErrors: false checkExhaustiveness: false # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' - excludes: '' + excludes: "" processors: active: true exclude: - - 'DetektProgressListener' + - "DetektProgressListener" # - 'KtFileCountProcessor' # - 'PackageCountProcessor' # - 'ClassCountProcessor' @@ -34,11 +34,11 @@ processors: console-reports: active: true exclude: - - 'ProjectStatisticsReport' - - 'ComplexityReport' - - 'NotificationReport' - - 'FindingsReport' - - 'FileBasedFindingsReport' + - "ProjectStatisticsReport" + - "ComplexityReport" + - "NotificationReport" + - "FindingsReport" + - "FileBasedFindingsReport" # - 'LiteFindingsReport' output-reports: @@ -54,7 +54,7 @@ comments: active: true AbsentOrWrongFileLicense: active: false - licenseTemplateFile: 'license.template' + licenseTemplateFile: "license.template" licenseTemplateIsRegex: false CommentOverPrivateFunction: active: false @@ -67,7 +67,17 @@ comments: endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' KDocReferencesNonPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] OutdatedDocumentation: active: false matchTypeParameters: true @@ -75,7 +85,17 @@ comments: allowParamOnConstructorProperties: false UndocumentedPublicClass: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] searchInNestedClass: true searchInInnerClass: true searchInInnerObject: true @@ -83,11 +103,31 @@ comments: searchInProtectedClass: false UndocumentedPublicFunction: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] searchProtectedFunction: false UndocumentedPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] searchProtectedProperty: false complexity: @@ -111,15 +151,15 @@ complexity: ignoreSimpleWhenEntries: false ignoreNestingFunctions: false nestingFunctions: - - 'also' - - 'apply' - - 'forEach' - - 'isNotNull' - - 'ifNull' - - 'let' - - 'run' - - 'use' - - 'with' + - "also" + - "apply" + - "forEach" + - "isNotNull" + - "ifNull" + - "let" + - "run" + - "use" + - "with" LabeledExpression: active: false ignoredLabels: [] @@ -150,23 +190,43 @@ complexity: active: false threshold: 1 functions: - - 'kotlin.apply' - - 'kotlin.run' - - 'kotlin.with' - - 'kotlin.let' - - 'kotlin.also' + - "kotlin.apply" + - "kotlin.run" + - "kotlin.with" + - "kotlin.let" + - "kotlin.also" ReplaceSafeCallChainWithRun: active: false StringLiteralDuplication: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' + ignoreStringsRegex: "$^" TooManyFunctions: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] thresholdInFiles: 11 thresholdInClasses: 11 thresholdInInterfaces: 11 @@ -184,9 +244,9 @@ coroutines: InjectDispatcher: active: true dispatcherNames: - - 'IO' - - 'Default' - - 'Unconfined' + - "IO" + - "Default" + - "Unconfined" RedundantSuspendModifier: active: true SleepInsteadOfDelay: @@ -202,7 +262,7 @@ empty-blocks: active: true EmptyCatchBlock: active: true - allowedExceptionNameRegex: '_|(ignore|expected).*' + allowedExceptionNameRegex: "_|(ignore|expected).*" EmptyClassBlock: active: true EmptyDefaultConstructor: @@ -238,13 +298,23 @@ exceptions: ExceptionRaisedInUnexpectedLocation: active: true methodNames: - - 'equals' - - 'finalize' - - 'hashCode' - - 'toString' + - "equals" + - "finalize" + - "hashCode" + - "toString" InstanceOfCheckForException: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] NotImplementedDeclaration: active: false ObjectExtendsThrowable: @@ -259,67 +329,87 @@ exceptions: SwallowedException: active: true ignoredExceptionTypes: - - 'InterruptedException' - - 'MalformedURLException' - - 'NumberFormatException' - - 'ParseException' - allowedExceptionNameRegex: '_|(ignore|expected).*' + - "InterruptedException" + - "MalformedURLException" + - "NumberFormatException" + - "ParseException" + allowedExceptionNameRegex: "_|(ignore|expected).*" ThrowingExceptionFromFinally: active: true ThrowingExceptionInMain: active: false ThrowingExceptionsWithoutMessageOrCause: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] exceptions: - - 'ArrayIndexOutOfBoundsException' - - 'Exception' - - 'IllegalArgumentException' - - 'IllegalMonitorStateException' - - 'IllegalStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' + - "ArrayIndexOutOfBoundsException" + - "Exception" + - "IllegalArgumentException" + - "IllegalMonitorStateException" + - "IllegalStateException" + - "IndexOutOfBoundsException" + - "NullPointerException" + - "RuntimeException" + - "Throwable" ThrowingNewInstanceOfSameException: active: true TooGenericExceptionCaught: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] exceptionNames: - - 'ArrayIndexOutOfBoundsException' - - 'Error' - - 'Exception' - - 'IllegalMonitorStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - allowedExceptionNameRegex: '_|(ignore|expected).*' + - "ArrayIndexOutOfBoundsException" + - "Error" + - "Exception" + - "IllegalMonitorStateException" + - "IndexOutOfBoundsException" + - "NullPointerException" + - "RuntimeException" + - "Throwable" + allowedExceptionNameRegex: "_|(ignore|expected).*" TooGenericExceptionThrown: active: true exceptionNames: - - 'Error' - - 'Exception' - - 'RuntimeException' - - 'Throwable' + - "Error" + - "Exception" + - "RuntimeException" + - "Throwable" naming: active: true BooleanPropertyNaming: active: false - allowedPattern: '^(is|has|are)' + allowedPattern: "^(is|has|are)" ClassNaming: active: true - classPattern: '[A-Z][a-zA-Z0-9]*' + classPattern: "[A-Z][a-zA-Z0-9]*" ConstructorParameterNaming: active: true - parameterPattern: '[a-z][A-Za-z0-9]*' - privateParameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' + parameterPattern: "[a-z][A-Za-z0-9]*" + privateParameterPattern: "[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" EnumNaming: active: true - enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + enumEntryPattern: "[A-Z][_a-zA-Z0-9]*" ForbiddenClassName: active: false forbiddenName: [] @@ -331,21 +421,31 @@ naming: minimumFunctionNameLength: 3 FunctionNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - functionPattern: '[a-z][a-zA-Z0-9]*' - excludeClassPattern: '$^' - ignoreAnnotated: ['Composable'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + functionPattern: "[a-z][a-zA-Z0-9]*" + excludeClassPattern: "$^" + ignoreAnnotated: ["Composable"] FunctionParameterNaming: active: true - parameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' + parameterPattern: "[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" InvalidPackageDeclaration: active: true - rootPackage: '' + rootPackage: "" requireRootInDeclaration: false LambdaParameterNaming: active: false - parameterPattern: '[a-z][A-Za-z0-9]*|_' + parameterPattern: "[a-z][A-Za-z0-9]*|_" MatchingDeclarationName: active: true mustBeFirst: true @@ -358,17 +458,17 @@ naming: active: false ObjectPropertyNaming: active: true - constantPattern: '[A-Za-z][_A-Za-z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + constantPattern: "[A-Za-z][_A-Za-z0-9]*" + propertyPattern: "[A-Za-z][_A-Za-z0-9]*" + privatePropertyPattern: "(_)?[A-Za-z][_A-Za-z0-9]*" PackageNaming: active: true packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' TopLevelPropertyNaming: active: true - constantPattern: '[A-Z][_A-Z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + constantPattern: "[A-Z][_A-Z0-9]*" + propertyPattern: "[A-Za-z][_A-Za-z0-9]*" + privatePropertyPattern: "_?[A-Za-z][_A-Za-z0-9]*" VariableMaxLength: active: false maximumVariableNameLength: 64 @@ -377,9 +477,9 @@ naming: minimumVariableNameLength: 1 VariableNaming: active: true - variablePattern: '[a-z][A-Za-z0-9]*' - privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' + variablePattern: "[a-z][A-Za-z0-9]*" + privateVariablePattern: "(_)?[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" performance: active: true @@ -390,10 +490,30 @@ performance: threshold: 3 ForEachOnRange: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] SpreadOperator: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] UnnecessaryPartOfBinaryExpression: active: false UnnecessaryTemporaryInstantiation: @@ -404,7 +524,7 @@ potential-bugs: AvoidReferentialEquality: active: true forbiddenTypePatterns: - - 'kotlin.String' + - "kotlin.String" CastNullableToNonNullableType: active: false CastToNullableType: @@ -416,14 +536,14 @@ potential-bugs: DoubleMutabilityForCollection: active: true mutableTypes: - - 'kotlin.collections.MutableList' - - 'kotlin.collections.MutableMap' - - 'kotlin.collections.MutableSet' - - 'java.util.ArrayList' - - 'java.util.LinkedHashSet' - - 'java.util.HashSet' - - 'java.util.LinkedHashMap' - - 'java.util.HashMap' + - "kotlin.collections.MutableList" + - "kotlin.collections.MutableMap" + - "kotlin.collections.MutableSet" + - "java.util.ArrayList" + - "java.util.LinkedHashSet" + - "java.util.HashSet" + - "java.util.LinkedHashMap" + - "java.util.HashMap" ElseCaseInsteadOfExhaustiveWhen: active: false ignoredSubjectTypes: [] @@ -441,17 +561,17 @@ potential-bugs: active: true restrictToConfig: true returnValueAnnotations: - - 'CheckResult' - - '*.CheckResult' - - 'CheckReturnValue' - - '*.CheckReturnValue' + - "CheckResult" + - "*.CheckResult" + - "CheckReturnValue" + - "*.CheckReturnValue" ignoreReturnValueAnnotations: - - 'CanIgnoreReturnValue' - - '*.CanIgnoreReturnValue' + - "CanIgnoreReturnValue" + - "*.CanIgnoreReturnValue" returnValueTypes: - - 'kotlin.sequences.Sequence' - - 'kotlinx.coroutines.flow.*Flow' - - 'java.util.stream.*Stream' + - "kotlin.sequences.Sequence" + - "kotlinx.coroutines.flow.*Flow" + - "java.util.stream.*Stream" ignoreFunctionCall: [] ImplicitDefaultLocale: active: true @@ -466,13 +586,23 @@ potential-bugs: active: true LateinitUsage: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - ignoreOnClassesPattern: '' + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + ignoreOnClassesPattern: "" MapGetWithNotNullAssertionOperator: active: true MissingPackageDeclaration: active: false - excludes: ['**/*.kts'] + excludes: ["**/*.kts"] NullCheckOnMutableProperty: active: false NullableToStringCall: @@ -493,7 +623,17 @@ potential-bugs: active: true UnsafeCallOnNullableType: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] UnsafeCast: active: true UnusedUnaryOperator: @@ -509,12 +649,12 @@ style: active: false BracesOnIfStatements: active: false - singleLine: 'never' - multiLine: 'always' + singleLine: "never" + multiLine: "always" BracesOnWhenStatements: active: false - singleLine: 'necessary' - multiLine: 'consistent' + singleLine: "necessary" + multiLine: "consistent" CanBeNonNullable: active: false CascadingCallWrapping: @@ -527,7 +667,7 @@ style: DataClassContainsFunctions: active: false conversionFunctionPrefix: - - 'to' + - "to" allowOperators: false DataClassShouldBeImmutable: active: false @@ -537,13 +677,13 @@ style: DoubleNegativeLambda: active: false negativeFunctions: - - reason: 'Use `takeIf` instead.' - value: 'takeUnless' - - reason: 'Use `all` instead.' - value: 'none' + - reason: "Use `takeIf` instead." + value: "takeUnless" + - reason: "Use `all` instead." + value: "none" negativeFunctionNameParts: - - 'not' - - 'non' + - "not" + - "non" EqualsNullCall: active: true EqualsOnSignatureLine: @@ -558,41 +698,41 @@ style: ForbiddenAnnotation: active: false annotations: - - reason: 'it is a java annotation. Use `Suppress` instead.' - value: 'java.lang.SuppressWarnings' - - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' - value: 'java.lang.Deprecated' - - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' - value: 'java.lang.annotation.Documented' - - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' - value: 'java.lang.annotation.Target' - - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' - value: 'java.lang.annotation.Retention' - - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' - value: 'java.lang.annotation.Repeatable' - - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' - value: 'java.lang.annotation.Inherited' + - reason: "it is a java annotation. Use `Suppress` instead." + value: "java.lang.SuppressWarnings" + - reason: "it is a java annotation. Use `kotlin.Deprecated` instead." + value: "java.lang.Deprecated" + - reason: "it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead." + value: "java.lang.annotation.Documented" + - reason: "it is a java annotation. Use `kotlin.annotation.Target` instead." + value: "java.lang.annotation.Target" + - reason: "it is a java annotation. Use `kotlin.annotation.Retention` instead." + value: "java.lang.annotation.Retention" + - reason: "it is a java annotation. Use `kotlin.annotation.Repeatable` instead." + value: "java.lang.annotation.Repeatable" + - reason: "Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265" + value: "java.lang.annotation.Inherited" ForbiddenComment: active: true comments: - - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' - value: 'FIXME:' - - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' - value: 'STOPSHIP:' - - reason: 'Forbidden TODO todo marker in comment, please do the changes.' - value: 'TODO:' - allowedPatterns: '' + - reason: "Forbidden FIXME todo marker in comment, please fix the problem." + value: "FIXME:" + - reason: "Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code." + value: "STOPSHIP:" + - reason: "Forbidden TODO todo marker in comment, please do the changes." + value: "TODO:" + allowedPatterns: "" ForbiddenImport: active: false imports: [] - forbiddenPatterns: '' + forbiddenPatterns: "" ForbiddenMethodCall: active: false methods: - - reason: 'print does not allow you to configure the output stream. Use a logger instead.' - value: 'kotlin.io.print' - - reason: 'println does not allow you to configure the output stream. Use a logger instead.' - value: 'kotlin.io.println' + - reason: "print does not allow you to configure the output stream. Use a logger instead." + value: "kotlin.io.print" + - reason: "println does not allow you to configure the output stream. Use a logger instead." + value: "kotlin.io.println" ForbiddenSuppress: active: false rules: [] @@ -610,12 +750,23 @@ style: maxJumpCount: 1 MagicNumber: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + "**/*.kts", + ] ignoreNumbers: - - '-1' - - '0' - - '1' - - '2' + - "-1" + - "0" + - "1" + - "2" ignoreHashCodeFunction: true ignorePropertyDeclaration: false ignoreLocalVariableDeclaration: false @@ -648,8 +799,8 @@ style: active: false indentSize: 4 trimmingMethods: - - 'trimIndent' - - 'trimMargin' + - "trimIndent" + - "trimMargin" NestedClassesVisibility: active: true NewLineAtEndOfFile: @@ -678,7 +829,7 @@ style: active: true max: 2 excludedFunctions: - - 'equals' + - "equals" excludeLabeled: false excludeReturnFromLambda: true excludeGuardClauses: false @@ -701,8 +852,8 @@ style: TrimMultilineRawString: active: false trimmingMethods: - - 'trimIndent' - - 'trimMargin' + - "trimIndent" + - "trimMargin" UnderscoresInNumericLiterals: active: false acceptableLength: 4 @@ -734,15 +885,15 @@ style: active: false UnusedParameter: active: true - allowedNames: 'ignored|expected' + allowedNames: "ignored|expected" UnusedPrivateClass: active: true UnusedPrivateMember: active: true - allowedNames: '' + allowedNames: "" UnusedPrivateProperty: active: true - allowedNames: '_|ignored|expected|serialVersionUID' + allowedNames: "_|ignored|expected|serialVersionUID" UseAnyOrNoneInsteadOfFind: active: true UseArrayLiteralsInAnnotations: @@ -783,4 +934,4 @@ style: WildcardImport: active: true excludeImports: - - 'java.util.*' + - "java.util.*" diff --git a/flutter/README.md b/flutter/README.md index 15ebe89..afc25a9 100644 --- a/flutter/README.md +++ b/flutter/README.md @@ -7,6 +7,7 @@ ``` ## This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get): + ```yaml dependencies: craftd_widget: $last_version @@ -16,10 +17,9 @@ more detail [pub.dev](https://pub.dev/packages/craftd_widget/install) # How to use - ## 1. Create your ComponentPropertyClass with properties that you need -- In this example i used Button component +- In this example i used Button component ```dart class ButtonProperties { @@ -35,6 +35,7 @@ class ButtonProperties { ``` ## 2. Add your Component json object in Dymanic.json + ```json { "key": "CraftDBbutton", @@ -43,13 +44,16 @@ class ButtonProperties { ... place your properties } } - + ``` ## 3. Create your Component -> :memo: **Note:** Your widget must have two properties. + +> :memo: **Note:** Your widget must have two properties. + - ButtonProperties: The mapped properties from json - callback: This make reference to the component's behaviour, for example: onclick -> for buttons, onchange -> for checkbox etc... + ```dart class CraftDButton extends StatelessWidget { const CraftDButton( @@ -61,7 +65,8 @@ class CraftDButton extends StatelessWidget { ``` ## 4. Create your Component Builder - > :memo: **Note:** This Builder must extend CraftBuilder Class and override craft and fromJson methods. + +> :memo: **Note:** This Builder must extend CraftBuilder Class and override craft and fromJson methods. ```dart @@ -86,6 +91,7 @@ class CraftDButtonBuilder extends CraftDBuilder { ``` ## 5. In your Page, create your CraftDBuilder declaration and put it into CraftDynamic Widget + ```dart // You can put it in your dependency injection final craftdBuilderManager = CraftDBuilderManager(); @@ -102,6 +108,7 @@ class CraftDButtonBuilder extends CraftDBuilder { } ``` + ## So now just enjoy your component!!! ## Credits diff --git a/flutter/craftd_widget/CHANGELOG.md b/flutter/craftd_widget/CHANGELOG.md index a048270..1aa1a2d 100644 --- a/flutter/craftd_widget/CHANGELOG.md +++ b/flutter/craftd_widget/CHANGELOG.md @@ -1,8 +1,8 @@ ## 1.0.0 + - Stable version milestone ## 0.0.1 -- Create components -- ItemType mechanism - +- Create components +- ItemType mechanism diff --git a/flutter/craftd_widget/README.md b/flutter/craftd_widget/README.md index aa43d96..0b0e672 100644 --- a/flutter/craftd_widget/README.md +++ b/flutter/craftd_widget/README.md @@ -6,4 +6,4 @@ You can use the existing components or create your own components, more details ### Create your own component -## 🔗 Compatibility \ No newline at end of file +## 🔗 Compatibility diff --git a/flutter/craftd_widget/analysis_options.yaml b/flutter/craftd_widget/analysis_options.yaml index a5744c1..f0cadb1 100644 --- a/flutter/craftd_widget/analysis_options.yaml +++ b/flutter/craftd_widget/analysis_options.yaml @@ -1,4 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + avoid_print: false # Uncomment to disable the `avoid_print` rule + prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/flutter/craftd_widget/lib/data/model/action/action_properties.dart b/flutter/craftd_widget/lib/data/model/action/action_properties.dart index a64893d..52e6851 100644 --- a/flutter/craftd_widget/lib/data/model/action/action_properties.dart +++ b/flutter/craftd_widget/lib/data/model/action/action_properties.dart @@ -8,11 +8,11 @@ class ActionProperties { factory ActionProperties.fromJson(dynamic properties) { return ActionProperties( - deeplink: properties != null ? properties["deeplink"] : null, + deeplink: properties != null ? properties['deeplink'] : null, analyticsProperties: properties != null ? AnalyticsProperties .fromJson( properties[AnalyticsProperties.key]) : null); } - static const String key = "actionProperties"; + static const String key = 'actionProperties'; } \ No newline at end of file diff --git a/flutter/craftd_widget/lib/data/model/action/analytics_properties.dart b/flutter/craftd_widget/lib/data/model/action/analytics_properties.dart index 78d9eb6..53950bf 100644 --- a/flutter/craftd_widget/lib/data/model/action/analytics_properties.dart +++ b/flutter/craftd_widget/lib/data/model/action/analytics_properties.dart @@ -9,12 +9,12 @@ class AnalyticsProperties { factory AnalyticsProperties.fromJson(dynamic properties) { return AnalyticsProperties( - category: properties != null ? properties["category"] : null, - action: properties != null ? properties["action"] : null, - label: properties != null ? properties["label"] : null, - track: properties != null ? properties["track"] : null, + category: properties != null ? properties['category'] : null, + action: properties != null ? properties['action'] : null, + label: properties != null ? properties['label'] : null, + track: properties != null ? properties['track'] : null, ); } - static String key = "analytics"; + static String key = 'analytics'; } diff --git a/flutter/craftd_widget/lib/data/model/base/simple_properties.dart b/flutter/craftd_widget/lib/data/model/base/simple_properties.dart index 20b23bb..f626a7b 100644 --- a/flutter/craftd_widget/lib/data/model/base/simple_properties.dart +++ b/flutter/craftd_widget/lib/data/model/base/simple_properties.dart @@ -6,7 +6,7 @@ class SimpleProperties { factory SimpleProperties.fromJson(dynamic properties) { return SimpleProperties( - key: properties["key"], - value: properties["value"]); + key: properties['key'], + value: properties['value']); } } diff --git a/flutter/craftd_widget/lib/presentation/ui/button/craftd_button_builder.dart b/flutter/craftd_widget/lib/presentation/ui/button/craftd_button_builder.dart index 99b0a3a..7934a63 100644 --- a/flutter/craftd_widget/lib/presentation/ui/button/craftd_button_builder.dart +++ b/flutter/craftd_widget/lib/presentation/ui/button/craftd_button_builder.dart @@ -24,14 +24,14 @@ class CraftDButtonBuilder extends CraftDBuilder { @override ButtonProperties fromJson(properties) { return ButtonProperties( - text: properties["text"], - textColorHex: properties["textColorHex"], - textSize: properties["textSize"], - textAllCaps: properties["textAllCaps"], - fillMaxSize: properties["fillMaxSize"], - backgroundHex: properties["backgroundHex"], + text: properties['text'], + textColorHex: properties['textColorHex'], + textSize: properties['textSize'], + textAllCaps: properties['textAllCaps'], + fillMaxSize: properties['fillMaxSize'], + backgroundHex: properties['backgroundHex'], actionProperties: ActionProperties.fromJson( properties[ActionProperties.key])); } - static String keyBuilder = "CraftDButton"; + static String keyBuilder = 'CraftDButton'; } \ No newline at end of file diff --git a/flutter/craftd_widget/lib/presentation/ui/craftd_dynamic.dart b/flutter/craftd_widget/lib/presentation/ui/craftd_dynamic.dart index af09047..606efae 100644 --- a/flutter/craftd_widget/lib/presentation/ui/craftd_dynamic.dart +++ b/flutter/craftd_widget/lib/presentation/ui/craftd_dynamic.dart @@ -18,7 +18,7 @@ class CraftDynamic extends StatelessWidget { return ListView.builder( itemCount: simplePropertiesList.length, itemBuilder: (context, index) { - final SimpleProperties simpleProperties = simplePropertiesList[index]; + final simpleProperties = simplePropertiesList[index]; final craftdBuilder = craftDBuilderManager.getBuilder(simpleProperties.key); diff --git a/flutter/craftd_widget/lib/presentation/ui/empty/craftd_empty_builder.dart b/flutter/craftd_widget/lib/presentation/ui/empty/craftd_empty_builder.dart index c3483ae..2e376ac 100644 --- a/flutter/craftd_widget/lib/presentation/ui/empty/craftd_empty_builder.dart +++ b/flutter/craftd_widget/lib/presentation/ui/empty/craftd_empty_builder.dart @@ -16,5 +16,5 @@ class CraftDEmptyBuilder extends CraftDBuilder { EmptyProperties fromJson(properties) { return const EmptyProperties(); } - static String keyBuilder = "CraftDEmpty"; + static String keyBuilder = 'CraftDEmpty'; } \ No newline at end of file diff --git a/flutter/craftd_widget/lib/presentation/ui/helper/craftd_colors.dart b/flutter/craftd_widget/lib/presentation/ui/helper/craftd_colors.dart index 6431b78..f988634 100644 --- a/flutter/craftd_widget/lib/presentation/ui/helper/craftd_colors.dart +++ b/flutter/craftd_widget/lib/presentation/ui/helper/craftd_colors.dart @@ -1,12 +1,11 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; class CraftDColor{ static Color hexToColor(String? hexColor) { try{ - hexColor = hexColor!.replaceAll("#", ""); + hexColor = hexColor!.replaceAll('#', ''); if (hexColor.length == 6) { - hexColor = "FF" + hexColor; + hexColor = 'FF$hexColor'; } return Color(int.parse(hexColor, radix: 16)); } catch (e) { diff --git a/flutter/craftd_widget/lib/presentation/ui/text/craftd_text_builder.dart b/flutter/craftd_widget/lib/presentation/ui/text/craftd_text_builder.dart index 0e0c3b2..7f49827 100644 --- a/flutter/craftd_widget/lib/presentation/ui/text/craftd_text_builder.dart +++ b/flutter/craftd_widget/lib/presentation/ui/text/craftd_text_builder.dart @@ -8,7 +8,7 @@ import 'craftd_text.dart'; class CraftDTextBuilder extends CraftDBuilder { CraftDTextBuilder() : super(key: keyBuilder); - static String keyBuilder = "CraftDTextView"; + static String keyBuilder = 'CraftDTextView'; @override Widget craft(TextProperties model, CraftDViewListener listener) { @@ -24,11 +24,11 @@ class CraftDTextBuilder extends CraftDBuilder { @override TextProperties fromJson(properties) { return TextProperties( - text: properties["text"], - textColorHex: properties["textColorHex"], - textSize: properties["textSize"], - textAllCaps: properties["textAllCaps"], - backgroundHex: properties["backgroundHex"], + text: properties['text'], + textColorHex: properties['textColorHex'], + textSize: properties['textSize'], + textAllCaps: properties['textAllCaps'], + backgroundHex: properties['backgroundHex'], actionProperties: ActionProperties.fromJson( properties[ActionProperties.key])); } diff --git a/flutter/craftd_widget/pubspec.yaml b/flutter/craftd_widget/pubspec.yaml index b8688d1..a37a37e 100644 --- a/flutter/craftd_widget/pubspec.yaml +++ b/flutter/craftd_widget/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 homepage: https://github.com/CodandoTV/CraftD environment: - sdk: '>=2.18.5 <4.0.0' + sdk: ">=2.18.5 <4.0.0" flutter: ">=1.17.0" dependencies: @@ -17,5 +17,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 -flutter: \ No newline at end of file + flutter_lints: ^4.0.0 + +flutter: diff --git a/flutter/sample/.gitignore b/flutter/sample/.gitignore index 24476c5..6c31954 100644 --- a/flutter/sample/.gitignore +++ b/flutter/sample/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related diff --git a/flutter/sample/.metadata b/flutter/sample/.metadata index 3fdf532..3f600b8 100644 --- a/flutter/sample/.metadata +++ b/flutter/sample/.metadata @@ -1,11 +1,11 @@ # 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. +# This file should be version controlled and should not be manually edited. version: - revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - channel: stable + revision: "077b4a4ce10a07b82caa6897f0c626f9c0a3ac90" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: android - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: ios - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: linux - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: macos - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: web - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 - platform: windows - create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 - base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 + create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 + base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90 # User provided section diff --git a/flutter/sample/analysis_options.yaml b/flutter/sample/analysis_options.yaml index 61b6c4d..f0cadb1 100644 --- a/flutter/sample/analysis_options.yaml +++ b/flutter/sample/analysis_options.yaml @@ -13,8 +13,7 @@ linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. + # and their documentation is published at https://dart.dev/lints. # # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code @@ -22,8 +21,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + avoid_print: false # Uncomment to disable the `avoid_print` rule + prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/flutter/sample/android/.gitignore b/flutter/sample/android/.gitignore index 6f56801..be3943c 100644 --- a/flutter/sample/android/.gitignore +++ b/flutter/sample/android/.gitignore @@ -5,9 +5,10 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java +.cxx/ # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/flutter/sample/android/app/build.gradle b/flutter/sample/android/app/build.gradle deleted file mode 100644 index 90ac520..0000000 --- a/flutter/sample/android/app/build.gradle +++ /dev/null @@ -1,71 +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 flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.flutter_dynamics" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion 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 '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/flutter/sample/android/app/build.gradle.kts b/flutter/sample/android/app/build.gradle.kts new file mode 100644 index 0000000..c1af72d --- /dev/null +++ b/flutter/sample/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +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") +} + +android { + namespace = "com.example.flutter_dynamics" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.flutter_dynamics" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + 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.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/flutter/sample/android/app/src/debug/AndroidManifest.xml b/flutter/sample/android/app/src/debug/AndroidManifest.xml index 5eb6c9a..399f698 100644 --- a/flutter/sample/android/app/src/debug/AndroidManifest.xml +++ b/flutter/sample/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + + + + + + diff --git a/flutter/sample/android/app/src/main/kotlin/com/example/flutter_dynamics/MainActivity.kt b/flutter/sample/android/app/src/main/kotlin/com/example/flutter_dynamics/MainActivity.kt index 38314dd..5c65060 100644 --- a/flutter/sample/android/app/src/main/kotlin/com/example/flutter_dynamics/MainActivity.kt +++ b/flutter/sample/android/app/src/main/kotlin/com/example/flutter_dynamics/MainActivity.kt @@ -2,5 +2,4 @@ package com.example.flutter_dynamics import io.flutter.embedding.android.FlutterActivity -class MainActivity: FlutterActivity() { -} +class MainActivity : FlutterActivity() diff --git a/flutter/sample/android/app/src/profile/AndroidManifest.xml b/flutter/sample/android/app/src/profile/AndroidManifest.xml index 5eb6c9a..399f698 100644 --- a/flutter/sample/android/app/src/profile/AndroidManifest.xml +++ b/flutter/sample/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - +