diff --git a/.gitignore b/.gitignore index b11d3bf..6eddbb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,28 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp .DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# VSCode related +.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ .dart_tool/ .packages diff --git a/.metadata b/.metadata index 8e195da..b2c661a 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: 62bd79521d8d007524e351747471ba66696fc2d4 - channel: stable + revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" + channel: "stable" -project_type: plugin +project_type: package diff --git a/.pubignore b/.pubignore new file mode 100644 index 0000000..809f15f --- /dev/null +++ b/.pubignore @@ -0,0 +1 @@ +README.md.old diff --git a/README.md b/README.md index c2e5d48..1e87a5e 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,28 @@ -# modal_progress_hud(_nsn) +# modal_progress_hud_nsn +[![pub package](https://img.shields.io/pub/v/modal_progress_hud_nsn.svg)](https://pub.dartlang.org/packages/modal_progress_hud_nsn) + A simple widget wrapper to enable modal progress HUD (a modal progress indicator, HUD = Heads Up Display) -[![pub package](https://img.shields.io/pub/v/modal_progress_hud_nsn.svg)](https://pub.dartlang.org/packages/modal_progress_hud_nsn) -~~Inspired by [this](https://codingwithjoe.com/flutter-how-to-build-a-modal-progress-indicator/) article.~~ Link broken, Dont click. - -A fork of [this](https://github.com/mmcc007/modal_progress_hud) with support for Null Safety. - -## Demo - -![Demo](https://raw.githubusercontent.com/kphanipavan/modal_progress_hud_nsn/master/demo.mp4) - -_See example for details_ +A fork of [the original modal_progress_hud by mmcc007](https://github.com/mmcc007/modal_progress_hud) with Null Safety and additional features. ## Usage -Add the package to your `pubspec.yml` file. +Add the `modal_progress_hud_nsn` to dependencies in `pubspec.yaml`. ```yml dependencies: modal_progress_hud_nsn: ^0.4.0 ``` -Next, import the library into your widget. +Next, import the library into your app. ```dart import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; ``` -Now, all you have to do is simply wrap your widget as a child of `ModalProgressHUD`, typically a form, together with a boolean that is maintained in local state. +Now, wrap your widget as a child of `ModalProgressHUD`, typically a form, together with a boolean variable that is maintained in local state. ```dart ... @@ -48,7 +41,7 @@ Widget build(BuildContext context) { ## Options -The current parameters are customizable in the constructor +Below parameters can be customised accordingly. ```dart ModalProgressHUD( @@ -63,21 +56,16 @@ ModalProgressHUD( ); ``` -## Similar Packages - -* [modal_progress_hud](https://pub.dev/packages/modal_progress_hud) : Original -* [modal_progress_hud_alt](https://pub.dev/packages/modal_progress_hud_alt) : Alternative -* [blurry_modal_progress_hud](https://pub.dev/packages/blurry_modal_progress_hud) : With blur -* [flutter_progress_hud](https://pub.dev/packages/flutter_progress_hud) : Light weight and with fade -* [loading_overlay](https://pub.dev/packages/loading_overlay) : Another fork of original with fade - ## Example -Here is an example app that demonstrates the usage. +An example app that demonstrates the usage. -1. On initial load, `_saving` is false which causes your child widget to display -2. When the form is submitted, `_saving` is set to true, which will display the modal -3. Once the async call is complete, `_saving` is set back to false, hiding the modal +1. On initial load, `_saving` defaults to false which causes your child widget to display. +2. When the form is submitted, `_saving` is set to true, which will display the modal. +3. Once the async call is complete, `_saving` is set back to false, hiding the modal. + +
+Example Code ```dart class SettingsPage extends StatefulWidget { @@ -137,10 +125,22 @@ class _SettingsPageState extends State { ); } } - ``` +
-Update: See this [article](https://medium.com/@nocnoc/the-secret-to-async-validation-on-flutter-forms-4b273c667c03) on Medium about async form validation +## Similar Alternatives + +* [modal_progress_hud](https://pub.dev/packages/modal_progress_hud) : Original +* [modal_progress_hud_alt](https://pub.dev/packages/modal_progress_hud_alt) : Alternative +* [blurry_modal_progress_hud](https://pub.dev/packages/blurry_modal_progress_hud) : With blur +* [flutter_progress_hud](https://pub.dev/packages/flutter_progress_hud) : Light weight and with fade +* [loading_overlay](https://pub.dev/packages/loading_overlay) : Another fork of original with fade + + + +## Useful Resources + + See this [article](https://medium.com/@nocnoc/the-secret-to-async-validation-on-flutter-forms-4b273c667c03) on Medium about async form validation See the [example application](https://github.com/kphanipavan/modal_progress_hud_nsn/tree/master/example) source for a complete sample app using the modal progress HUD. Included in the diff --git a/README.md.old b/README.md.old new file mode 100644 index 0000000..c2e5d48 --- /dev/null +++ b/README.md.old @@ -0,0 +1,153 @@ +# modal_progress_hud(_nsn) + +A simple widget wrapper to enable modal progress HUD (a modal progress indicator, HUD = Heads Up Display) + +[![pub package](https://img.shields.io/pub/v/modal_progress_hud_nsn.svg)](https://pub.dartlang.org/packages/modal_progress_hud_nsn) + +~~Inspired by [this](https://codingwithjoe.com/flutter-how-to-build-a-modal-progress-indicator/) article.~~ Link broken, Dont click. + +A fork of [this](https://github.com/mmcc007/modal_progress_hud) with support for Null Safety. + +## Demo + +![Demo](https://raw.githubusercontent.com/kphanipavan/modal_progress_hud_nsn/master/demo.mp4) + +_See example for details_ + +## Usage + +Add the package to your `pubspec.yml` file. + +```yml +dependencies: + modal_progress_hud_nsn: ^0.4.0 +``` + +Next, import the library into your widget. + +```dart +import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; +``` + +Now, all you have to do is simply wrap your widget as a child of `ModalProgressHUD`, typically a form, together with a boolean that is maintained in local state. + +```dart +... +bool _saving = false +... + +@override +Widget build(BuildContext context) { + return Scaffold( + body: ModalProgressHUD(child: Container( + Form(...) + ), inAsyncCall: _saving), + ); +} +``` + +## Options + +The current parameters are customizable in the constructor + +```dart +ModalProgressHUD( + @required inAsyncCall: bool, + @required child: Widget, + opacity: double, + color: Color, + progressIndicator: CircularProgressIndicator, + offset: double + dismissible: bool, + blur: double, +); +``` + +## Similar Packages + +* [modal_progress_hud](https://pub.dev/packages/modal_progress_hud) : Original +* [modal_progress_hud_alt](https://pub.dev/packages/modal_progress_hud_alt) : Alternative +* [blurry_modal_progress_hud](https://pub.dev/packages/blurry_modal_progress_hud) : With blur +* [flutter_progress_hud](https://pub.dev/packages/flutter_progress_hud) : Light weight and with fade +* [loading_overlay](https://pub.dev/packages/loading_overlay) : Another fork of original with fade + +## Example + +Here is an example app that demonstrates the usage. + +1. On initial load, `_saving` is false which causes your child widget to display +2. When the form is submitted, `_saving` is set to true, which will display the modal +3. Once the async call is complete, `_saving` is set back to false, hiding the modal + +```dart +class SettingsPage extends StatefulWidget { + @override + _SettingsPageState createState() => new _SettingsPageState(); +} + +class _SettingsPageState extends State { + bool _saving = false; + + void _submit() { + + setState(() { + _saving = true; + }); + + //Simulate a service call + print('submitting to backend...'); + new Future.delayed(new Duration(seconds: 4), () { + setState(() { + _saving = false; + }); + }); + } + + Widget _buildWidget() { + return new Form( + child: new Column( + children: [ + new SwitchListTile( + title: const Text('Bedroom'), + value: _bedroom, + onChanged: (bool value) { + setState(() { + _bedroom = value; + }); + }, + secondary: const Icon(Icons.hotel), + ), + new RaisedButton( + onPressed: _submit, + child: new Text('Save'), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return new Scaffold( + appBar: new AppBar( + title: new Text('Flutter Progress Indicator Demo'), + backgroundColor: Colors.blue, + ), + body: ModalProgressHUD(child: _buildWidget(), inAsyncCall: _saving), + ); + } +} + +``` + +Update: See this [article](https://medium.com/@nocnoc/the-secret-to-async-validation-on-flutter-forms-4b273c667c03) on Medium about async form validation + +See the [example application](https://github.com/kphanipavan/modal_progress_hud_nsn/tree/master/example) source +for a complete sample app using the modal progress HUD. Included in the +example is a method for using a form's validators while making async +calls (see [flutter/issues/9688](https://github.com/flutter/flutter/issues/9688) for details). + +## Issues and feedback + +Please file [issues](https://github.com/kphanipavan/modal_progress_hud_nsn/issues/new) +to send feedback or report a bug. Thank you! diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index 161bdcd..0000000 --- a/android/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures -.cxx diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 73b3db5..0000000 --- a/android/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -group 'boi.walle.modal_progress_hud_nsn' -version '0.4.0' - -buildscript { - ext.kotlin_version = '1.9.20' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.1.4' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - if (project.android.hasProperty("namespace")) { - namespace 'boi.walle.modal_progress_hud_nsn' - } - - compileSdk 31 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - minSdkVersion 16 - } -} diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e583..0000000 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index da1db5f..0000000 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew deleted file mode 100755 index a69d9cb..0000000 --- a/android/gradlew +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat deleted file mode 100644 index 53a6b23..0000000 --- a/android/gradlew.bat +++ /dev/null @@ -1,91 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index cfa6b5d..0000000 --- a/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'modal_progress_hud_nsn' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml deleted file mode 100644 index 994983c..0000000 --- a/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/android/src/main/kotlin/boi/walle/modal_progress_hud_nsn/ModalProgressHudNsnPlugin.kt b/android/src/main/kotlin/boi/walle/modal_progress_hud_nsn/ModalProgressHudNsnPlugin.kt deleted file mode 100644 index 9f12290..0000000 --- a/android/src/main/kotlin/boi/walle/modal_progress_hud_nsn/ModalProgressHudNsnPlugin.kt +++ /dev/null @@ -1,35 +0,0 @@ -package boi.walle.modal_progress_hud_nsn - -import androidx.annotation.NonNull - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result - -/** ModalProgressHudNsnPlugin */ -class ModalProgressHudNsnPlugin: FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "modal_progress_hud_nsn") - channel.setMethodCallHandler(this) - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { - if (call.method == "getPlatformVersion") { - result.success("Android ${android.os.Build.VERSION.RELEASE}") - } else { - result.notImplemented() - } - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } -} diff --git a/demo.mp4 b/demo.mp4 deleted file mode 100644 index f360fc7..0000000 Binary files a/demo.mp4 and /dev/null differ diff --git a/example/.metadata b/example/.metadata index 20eb09c..eea2802 100644 --- a/example/.metadata +++ b/example/.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: 62bd79521d8d007524e351747471ba66696fc2d4 - channel: stable + revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" + channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: android - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: ios - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: linux - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: macos - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: web - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 - platform: windows - create_revision: 62bd79521d8d007524e351747471ba66696fc2d4 - base_revision: 62bd79521d8d007524e351747471ba66696fc2d4 + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 # User provided section diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 61b6c4d..0d29021 100644 --- a/example/analysis_options.yaml +++ b/example/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 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 565fed8..118ee1d 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -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' @@ -21,11 +22,8 @@ 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 { + namespace "com.example.example" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion @@ -44,7 +42,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "boi.walle.modal_progress_hud_nsn_example" + applicationId "com.example.example" // 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. minSdkVersion flutter.minSdkVersion @@ -66,6 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index d5ef7fe..399f698 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + @@ -27,28 +28,32 @@ - + modal_progress_hud_nsn_example + - + + \ No newline at end of file diff --git a/example/web/manifest.json b/example/web/manifest.json index 34b4947..218b88c 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -32,4 +32,4 @@ "purpose": "maskable" } ] -} +} \ No newline at end of file diff --git a/example/windows/CMakeLists.txt b/example/windows/CMakeLists.txt index aa304d0..d960948 100644 --- a/example/windows/CMakeLists.txt +++ b/example/windows/CMakeLists.txt @@ -1,14 +1,14 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(modal_progress_hud_nsn_example LANGUAGES CXX) +project(example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "modal_progress_hud_nsn_example") +set(BINARY_NAME "example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. -cmake_policy(SET CMP0063 NEW) +cmake_policy(VERSION 3.14...3.25) # Define build configuration option. get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -52,6 +52,7 @@ add_subdirectory(${FLUTTER_MANAGED_DIR}) # Application build; see runner/CMakeLists.txt. add_subdirectory("runner") + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) @@ -86,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # 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") diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt index 930d207..903f489 100644 --- a/example/windows/flutter/CMakeLists.txt +++ b/example/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index f2acfe6..8b6d468 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,6 @@ #include "generated_plugin_registrant.h" -#include void RegisterPlugins(flutter::PluginRegistry* registry) { - ModalProgressHudNsnPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ModalProgressHudNsnPluginCApi")); } diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index 3951f2f..b93c4c3 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - modal_progress_hud_nsn ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/example/windows/runner/flutter_window.cpp b/example/windows/runner/flutter_window.cpp index b25e363..955ee30 100644 --- a/example/windows/runner/flutter_window.cpp +++ b/example/windows/runner/flutter_window.cpp @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() { this->Show(); }); + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; } diff --git a/example/windows/runner/main.cpp b/example/windows/runner/main.cpp index 6adfe82..a61bf80 100644 --- a/example/windows/runner/main.cpp +++ b/example/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"modal_progress_hud_nsn_example", origin, size)) { + if (!window.Create(L"example", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); diff --git a/example/windows/runner/utils.cpp b/example/windows/runner/utils.cpp index f5bf9fa..b2b0873 100644 --- a/example/windows/runner/utils.cpp +++ b/example/windows/runner/utils.cpp @@ -47,16 +47,17 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { } int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr); + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length == 0 || target_length > utf8_string.max_size()) { + if (target_length <= 0 || target_length > utf8_string.max_size()) { return 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); + input_length, utf8_string.data(), target_length, nullptr, nullptr); if (converted_length == 0) { return std::string(); } diff --git a/example/windows/runner/win32_window.cpp b/example/windows/runner/win32_window.cpp index 041a385..60608d0 100644 --- a/example/windows/runner/win32_window.cpp +++ b/example/windows/runner/win32_window.cpp @@ -60,7 +60,7 @@ class WindowClassRegistrar { public: ~WindowClassRegistrar() = default; - // Returns the singleton registar instance. + // Returns the singleton registrar instance. static WindowClassRegistrar* GetInstance() { if (!instance_) { instance_ = new WindowClassRegistrar(); diff --git a/example/windows/runner/win32_window.h b/example/windows/runner/win32_window.h index c86632d..e901dde 100644 --- a/example/windows/runner/win32_window.h +++ b/example/windows/runner/win32_window.h @@ -77,7 +77,7 @@ class Win32Window { // 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 + // responds to changes in DPI. All other messages are handled by // MessageHandler. static LRESULT CALLBACK WndProc(HWND const window, UINT const message, diff --git a/ios/.gitignore b/ios/.gitignore deleted file mode 100644 index 0c88507..0000000 --- a/ios/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/Generated.xcconfig -/Flutter/ephemeral/ -/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/ios/Assets/.gitkeep b/ios/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ios/Classes/ModalProgressHudNsnPlugin.swift b/ios/Classes/ModalProgressHudNsnPlugin.swift deleted file mode 100644 index 3464181..0000000 --- a/ios/Classes/ModalProgressHudNsnPlugin.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Flutter -import UIKit - -public class ModalProgressHudNsnPlugin: NSObject, FlutterPlugin { - public static func register(with registrar: FlutterPluginRegistrar) { - let channel = FlutterMethodChannel(name: "modal_progress_hud_nsn", binaryMessenger: registrar.messenger()) - let instance = ModalProgressHudNsnPlugin() - registrar.addMethodCallDelegate(instance, channel: channel) - } - - public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - result("iOS " + UIDevice.current.systemVersion) - } -} diff --git a/ios/modal_progress_hud_nsn.podspec b/ios/modal_progress_hud_nsn.podspec deleted file mode 100644 index 2a4702f..0000000 --- a/ios/modal_progress_hud_nsn.podspec +++ /dev/null @@ -1,23 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint modal_progress_hud_nsn.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'modal_progress_hud_nsn' - s.version = '0.4.0' - s.summary = 'A modal progress indicator widget with Sound Null Safety' - s.description = <<-DESC -A new Flutter plugin project. - DESC - s.homepage = 'https://github.com/kphanipavan/modal_progress_hud_nsn' - s.license = { :file => '../LICENSE' } - s.author = { 'My Company' => 'kphanipavan@gmail.com' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.dependency 'Flutter' - s.platform = :ios, '9.0' - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } - s.swift_version = '5.0' -end diff --git a/lib/modal_progress_hud_nsn.dart b/lib/modal_progress_hud_nsn.dart index 346ae57..9f8e040 100644 --- a/lib/modal_progress_hud_nsn.dart +++ b/lib/modal_progress_hud_nsn.dart @@ -1,15 +1,8 @@ library modal_progress_hud_nsn; -import "modal_progress_hud_nsn_platform_interface.dart"; import "package:flutter/material.dart"; import "dart:ui"; -class ModalProgressHudNsn { - Future getPlatformVersion() { - return ModalProgressHudNsnPlatform.instance.getPlatformVersion(); - } -} - /// /// Wrap around any widget that makes an async call to show a modal progress /// indicator while the async call is in progress. diff --git a/lib/modal_progress_hud_nsn_method_channel.dart b/lib/modal_progress_hud_nsn_method_channel.dart deleted file mode 100644 index 5281eca..0000000 --- a/lib/modal_progress_hud_nsn_method_channel.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; - -import 'modal_progress_hud_nsn_platform_interface.dart'; - -/// An implementation of [ModalProgressHudNsnPlatform] that uses method channels. -class MethodChannelModalProgressHudNsn extends ModalProgressHudNsnPlatform { - /// The method channel used to interact with the native platform. - @visibleForTesting - final methodChannel = const MethodChannel('modal_progress_hud_nsn'); - - @override - Future getPlatformVersion() async { - final version = - await methodChannel.invokeMethod('getPlatformVersion'); - return version; - } -} diff --git a/lib/modal_progress_hud_nsn_platform_interface.dart b/lib/modal_progress_hud_nsn_platform_interface.dart deleted file mode 100644 index 8a5de80..0000000 --- a/lib/modal_progress_hud_nsn_platform_interface.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:plugin_platform_interface/plugin_platform_interface.dart'; - -import 'modal_progress_hud_nsn_method_channel.dart'; - -abstract class ModalProgressHudNsnPlatform extends PlatformInterface { - /// Constructs a ModalProgressHudNsnPlatform. - ModalProgressHudNsnPlatform() : super(token: _token); - - static final Object _token = Object(); - - static ModalProgressHudNsnPlatform _instance = - MethodChannelModalProgressHudNsn(); - - /// The default instance of [ModalProgressHudNsnPlatform] to use. - /// - /// Defaults to [MethodChannelModalProgressHudNsn]. - static ModalProgressHudNsnPlatform get instance => _instance; - - /// Platform-specific implementations should set this with their own - /// platform-specific class that extends [ModalProgressHudNsnPlatform] when - /// they register themselves. - static set instance(ModalProgressHudNsnPlatform instance) { - PlatformInterface.verifyToken(instance, _token); - _instance = instance; - } - - Future getPlatformVersion() { - throw UnimplementedError('platformVersion() has not been implemented.'); - } -} diff --git a/lib/modal_progress_hud_nsn_web.dart b/lib/modal_progress_hud_nsn_web.dart deleted file mode 100644 index 3a921ff..0000000 --- a/lib/modal_progress_hud_nsn_web.dart +++ /dev/null @@ -1,26 +0,0 @@ -// In order to *not* need this ignore, consider extracting the "web" version -// of your plugin as a separate package, instead of inlining it in the same -// package as the core of your plugin. -// ignore: avoid_web_libraries_in_flutter -import 'dart:html' as html show window; - -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -import 'modal_progress_hud_nsn_platform_interface.dart'; - -/// A web implementation of the ModalProgressHudNsnPlatform of the ModalProgressHudNsn plugin. -class ModalProgressHudNsnWeb extends ModalProgressHudNsnPlatform { - /// Constructs a ModalProgressHudNsnWeb - ModalProgressHudNsnWeb(); - - static void registerWith(Registrar registrar) { - ModalProgressHudNsnPlatform.instance = ModalProgressHudNsnWeb(); - } - - /// Returns a [String] containing the version of the platform. - @override - Future getPlatformVersion() async { - final version = html.window.navigator.userAgent; - return version; - } -} diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt deleted file mode 100644 index 1d8272d..0000000 --- a/linux/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# The Flutter tooling requires that developers have CMake 3.10 or later -# installed. You should not increase this version, as doing so will cause -# the plugin to fail to compile for some customers of the plugin. -cmake_minimum_required(VERSION 3.10) - -# Project-level configuration. -set(PROJECT_NAME "modal_progress_hud_nsn") -project(${PROJECT_NAME} LANGUAGES CXX) - -# This value is used when generating builds using this plugin, so it must -# not be changed. -set(PLUGIN_NAME "modal_progress_hud_nsn_plugin") - -# Define the plugin library target. Its name must not be changed (see comment -# on PLUGIN_NAME above). -# -# Any new source files that you add to the plugin should be added here. -add_library(${PLUGIN_NAME} SHARED - "modal_progress_hud_nsn_plugin.cc" -) - -# Apply a standard set of build settings that are configured in the -# application-level CMakeLists.txt. This can be removed for plugins that want -# full control over build settings. -apply_standard_settings(${PLUGIN_NAME}) - -# Symbols are hidden by default to reduce the chance of accidental conflicts -# between plugins. This should not be removed; any symbols that should be -# exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. -set_target_properties(${PLUGIN_NAME} PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) - -# Source include directories and library dependencies. Add any plugin-specific -# dependencies here. -target_include_directories(${PLUGIN_NAME} INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) -target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) - -# List of absolute paths to libraries that should be bundled with the plugin. -# This list could contain prebuilt libraries, or libraries created by an -# external build triggered from this build file. -set(modal_progress_hud_nsn_bundled_libraries - "" - PARENT_SCOPE -) diff --git a/linux/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin.h b/linux/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin.h deleted file mode 100644 index 8c754e6..0000000 --- a/linux/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ -#define FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ - -#include - -G_BEGIN_DECLS - -#ifdef FLUTTER_PLUGIN_IMPL -#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) -#else -#define FLUTTER_PLUGIN_EXPORT -#endif - -typedef struct _ModalProgressHudNsnPlugin ModalProgressHudNsnPlugin; -typedef struct { - GObjectClass parent_class; -} ModalProgressHudNsnPluginClass; - -FLUTTER_PLUGIN_EXPORT GType modal_progress_hud_nsn_plugin_get_type(); - -FLUTTER_PLUGIN_EXPORT void modal_progress_hud_nsn_plugin_register_with_registrar( - FlPluginRegistrar* registrar); - -G_END_DECLS - -#endif // FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ diff --git a/linux/modal_progress_hud_nsn_plugin.cc b/linux/modal_progress_hud_nsn_plugin.cc deleted file mode 100644 index a1d0e43..0000000 --- a/linux/modal_progress_hud_nsn_plugin.cc +++ /dev/null @@ -1,70 +0,0 @@ -#include "include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin.h" - -#include -#include -#include - -#include - -#define MODAL_PROGRESS_HUD_NSN_PLUGIN(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), modal_progress_hud_nsn_plugin_get_type(), \ - ModalProgressHudNsnPlugin)) - -struct _ModalProgressHudNsnPlugin { - GObject parent_instance; -}; - -G_DEFINE_TYPE(ModalProgressHudNsnPlugin, modal_progress_hud_nsn_plugin, g_object_get_type()) - -// Called when a method call is received from Flutter. -static void modal_progress_hud_nsn_plugin_handle_method_call( - ModalProgressHudNsnPlugin* self, - FlMethodCall* method_call) { - g_autoptr(FlMethodResponse) response = nullptr; - - const gchar* method = fl_method_call_get_name(method_call); - - if (strcmp(method, "getPlatformVersion") == 0) { - struct utsname uname_data = {}; - uname(&uname_data); - g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version); - g_autoptr(FlValue) result = fl_value_new_string(version); - response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); - } else { - response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); - } - - fl_method_call_respond(method_call, response, nullptr); -} - -static void modal_progress_hud_nsn_plugin_dispose(GObject* object) { - G_OBJECT_CLASS(modal_progress_hud_nsn_plugin_parent_class)->dispose(object); -} - -static void modal_progress_hud_nsn_plugin_class_init(ModalProgressHudNsnPluginClass* klass) { - G_OBJECT_CLASS(klass)->dispose = modal_progress_hud_nsn_plugin_dispose; -} - -static void modal_progress_hud_nsn_plugin_init(ModalProgressHudNsnPlugin* self) {} - -static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call, - gpointer user_data) { - ModalProgressHudNsnPlugin* plugin = MODAL_PROGRESS_HUD_NSN_PLUGIN(user_data); - modal_progress_hud_nsn_plugin_handle_method_call(plugin, method_call); -} - -void modal_progress_hud_nsn_plugin_register_with_registrar(FlPluginRegistrar* registrar) { - ModalProgressHudNsnPlugin* plugin = MODAL_PROGRESS_HUD_NSN_PLUGIN( - g_object_new(modal_progress_hud_nsn_plugin_get_type(), nullptr)); - - g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); - g_autoptr(FlMethodChannel) channel = - fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar), - "modal_progress_hud_nsn", - FL_METHOD_CODEC(codec)); - fl_method_channel_set_method_call_handler(channel, method_call_cb, - g_object_ref(plugin), - g_object_unref); - - g_object_unref(plugin); -} diff --git a/macos/Classes/ModalProgressHudNsnPlugin.swift b/macos/Classes/ModalProgressHudNsnPlugin.swift deleted file mode 100644 index 51d8b06..0000000 --- a/macos/Classes/ModalProgressHudNsnPlugin.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Cocoa -import FlutterMacOS - -public class ModalProgressHudNsnPlugin: NSObject, FlutterPlugin { - public static func register(with registrar: FlutterPluginRegistrar) { - let channel = FlutterMethodChannel(name: "modal_progress_hud_nsn", binaryMessenger: registrar.messenger) - let instance = ModalProgressHudNsnPlugin() - registrar.addMethodCallDelegate(instance, channel: channel) - } - - public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - switch call.method { - case "getPlatformVersion": - result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) - default: - result(FlutterMethodNotImplemented) - } - } -} diff --git a/macos/modal_progress_hud_nsn.podspec b/macos/modal_progress_hud_nsn.podspec deleted file mode 100644 index 917210d..0000000 --- a/macos/modal_progress_hud_nsn.podspec +++ /dev/null @@ -1,23 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint modal_progress_hud_nsn.podspec` to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'modal_progress_hud_nsn' - s.version = '0.4.0' - s.summary = 'A modal progress indicator widget with Sound Null Safety' - s.description = <<-DESC -A new Flutter plugin project. - DESC - s.homepage = 'https://github.com/kphanipavan/modal_progress_hud_nsn' - s.license = { :file => '../LICENSE' } - s.author = { 'Our Company' => 'kphanipavan@gmail.com' } - - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.dependency 'FlutterMacOS' - - s.platform = :osx, '10.11' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.swift_version = '5.0' -end diff --git a/modal_progress_hud_nsn.iml b/modal_progress_hud_nsn.iml deleted file mode 100644 index 07f2572..0000000 --- a/modal_progress_hud_nsn.iml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index daeb780..11e6eef 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,35 +5,16 @@ version: 0.4.0 homepage: https://github.com/kphanipavan/modal_progress_hud_nsn environment: - sdk: '>=2.19.6 <3.0.0' - flutter: ">=2.5.0" + sdk: '>=3.2.5 <4.0.0' + flutter: ">=1.17.0" dependencies: flutter: sdk: flutter - flutter_web_plugins: - sdk: flutter - plugin_platform_interface: ^2.0.2 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: ^3.0.1 flutter: - plugin: - platforms: - android: - package: boi.walle.modal_progress_hud_nsn - pluginClass: ModalProgressHudNsnPlugin - ios: - pluginClass: ModalProgressHudNsnPlugin - linux: - pluginClass: ModalProgressHudNsnPlugin - macos: - pluginClass: ModalProgressHudNsnPlugin - windows: - pluginClass: ModalProgressHudNsnPluginCApi - web: - pluginClass: ModalProgressHudNsnWeb - fileName: modal_progress_hud_nsn_web.dart diff --git a/test/modal_progress_hud_nsn_test.dart b/test/modal_progress_hud_nsn_test.dart index c5e118a..c1fcdd3 100644 --- a/test/modal_progress_hud_nsn_test.dart +++ b/test/modal_progress_hud_nsn_test.dart @@ -43,4 +43,4 @@ void main() { expect(find.byType(CircularProgressIndicator), findsOneWidget); }); }); -} \ No newline at end of file +} diff --git a/windows/.gitignore b/windows/.gitignore deleted file mode 100644 index b3eb2be..0000000 --- a/windows/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -flutter/ - -# 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 deleted file mode 100644 index 96d4665..0000000 --- a/windows/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# The Flutter tooling requires that developers have a version of Visual Studio -# installed that includes CMake 3.14 or later. You should not increase this -# version, as doing so will cause the plugin to fail to compile for some -# customers of the plugin. -cmake_minimum_required(VERSION 3.14) - -# Project-level configuration. -set(PROJECT_NAME "modal_progress_hud_nsn") -project(${PROJECT_NAME} LANGUAGES CXX) - -# This value is used when generating builds using this plugin, so it must -# not be changed -set(PLUGIN_NAME "modal_progress_hud_nsn_plugin") - -# Any new source files that you add to the plugin should be added here. -list(APPEND PLUGIN_SOURCES - "modal_progress_hud_nsn_plugin.cpp" - "modal_progress_hud_nsn_plugin.h" -) - -# Define the plugin library target. Its name must not be changed (see comment -# on PLUGIN_NAME above). -add_library(${PLUGIN_NAME} SHARED - "include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h" - "modal_progress_hud_nsn_plugin_c_api.cpp" - ${PLUGIN_SOURCES} -) - -# Apply a standard set of build settings that are configured in the -# application-level CMakeLists.txt. This can be removed for plugins that want -# full control over build settings. -apply_standard_settings(${PLUGIN_NAME}) - -# Symbols are hidden by default to reduce the chance of accidental conflicts -# between plugins. This should not be removed; any symbols that should be -# exported should be explicitly exported with the FLUTTER_PLUGIN_EXPORT macro. -set_target_properties(${PLUGIN_NAME} PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) - -# Source include directories and library dependencies. Add any plugin-specific -# dependencies here. -target_include_directories(${PLUGIN_NAME} INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) - -# List of absolute paths to libraries that should be bundled with the plugin. -# This list could contain prebuilt libraries, or libraries created by an -# external build triggered from this build file. -set(modal_progress_hud_nsn_bundled_libraries - "" - PARENT_SCOPE -) diff --git a/windows/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h b/windows/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h deleted file mode 100644 index 08ef468..0000000 --- a/windows/include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_C_API_H_ -#define FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_C_API_H_ - -#include - -#ifdef FLUTTER_PLUGIN_IMPL -#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) -#else -#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -FLUTTER_PLUGIN_EXPORT void ModalProgressHudNsnPluginCApiRegisterWithRegistrar( - FlutterDesktopPluginRegistrarRef registrar); - -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_C_API_H_ diff --git a/windows/modal_progress_hud_nsn_plugin.cpp b/windows/modal_progress_hud_nsn_plugin.cpp deleted file mode 100644 index 3b67da0..0000000 --- a/windows/modal_progress_hud_nsn_plugin.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "modal_progress_hud_nsn_plugin.h" - -// This must be included before many other Windows headers. -#include - -// For getPlatformVersion; remove unless needed for your plugin implementation. -#include - -#include -#include -#include - -#include -#include - -namespace modal_progress_hud_nsn { - -// static -void ModalProgressHudNsnPlugin::RegisterWithRegistrar( - flutter::PluginRegistrarWindows *registrar) { - auto channel = - std::make_unique>( - registrar->messenger(), "modal_progress_hud_nsn", - &flutter::StandardMethodCodec::GetInstance()); - - auto plugin = std::make_unique(); - - channel->SetMethodCallHandler( - [plugin_pointer = plugin.get()](const auto &call, auto result) { - plugin_pointer->HandleMethodCall(call, std::move(result)); - }); - - registrar->AddPlugin(std::move(plugin)); -} - -ModalProgressHudNsnPlugin::ModalProgressHudNsnPlugin() {} - -ModalProgressHudNsnPlugin::~ModalProgressHudNsnPlugin() {} - -void ModalProgressHudNsnPlugin::HandleMethodCall( - const flutter::MethodCall &method_call, - std::unique_ptr> result) { - if (method_call.method_name().compare("getPlatformVersion") == 0) { - std::ostringstream version_stream; - version_stream << "Windows "; - if (IsWindows10OrGreater()) { - version_stream << "10+"; - } else if (IsWindows8OrGreater()) { - version_stream << "8"; - } else if (IsWindows7OrGreater()) { - version_stream << "7"; - } - result->Success(flutter::EncodableValue(version_stream.str())); - } else { - result->NotImplemented(); - } -} - -} // namespace modal_progress_hud_nsn diff --git a/windows/modal_progress_hud_nsn_plugin.h b/windows/modal_progress_hud_nsn_plugin.h deleted file mode 100644 index df22a6c..0000000 --- a/windows/modal_progress_hud_nsn_plugin.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ -#define FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ - -#include -#include - -#include - -namespace modal_progress_hud_nsn { - -class ModalProgressHudNsnPlugin : public flutter::Plugin { - public: - static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar); - - ModalProgressHudNsnPlugin(); - - virtual ~ModalProgressHudNsnPlugin(); - - // Disallow copy and assign. - ModalProgressHudNsnPlugin(const ModalProgressHudNsnPlugin&) = delete; - ModalProgressHudNsnPlugin& operator=(const ModalProgressHudNsnPlugin&) = delete; - - private: - // Called when a method is called on this plugin's channel from Dart. - void HandleMethodCall( - const flutter::MethodCall &method_call, - std::unique_ptr> result); -}; - -} // namespace modal_progress_hud_nsn - -#endif // FLUTTER_PLUGIN_MODAL_PROGRESS_HUD_NSN_PLUGIN_H_ diff --git a/windows/modal_progress_hud_nsn_plugin_c_api.cpp b/windows/modal_progress_hud_nsn_plugin_c_api.cpp deleted file mode 100644 index edc63aa..0000000 --- a/windows/modal_progress_hud_nsn_plugin_c_api.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "include/modal_progress_hud_nsn/modal_progress_hud_nsn_plugin_c_api.h" - -#include - -#include "modal_progress_hud_nsn_plugin.h" - -void ModalProgressHudNsnPluginCApiRegisterWithRegistrar( - FlutterDesktopPluginRegistrarRef registrar) { - modal_progress_hud_nsn::ModalProgressHudNsnPlugin::RegisterWithRegistrar( - flutter::PluginRegistrarManager::GetInstance() - ->GetRegistrar(registrar)); -}