-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: switch to webview plugins (#12)
* fix: update android specific settings * fix: update ios specific settings * feat: add linux target * fix: update macos specific settings * feat: add windows target * feat: update example to reflect sdk changes due to webview plugin * fix: update readme * fix: readme headers * fix: always show clear cache checkbox * fix: update android platform directory * fix: login/logout button not being turned off * fix: version of casdoor sdk in pubspec.yaml * fix: update readme to reflect recent changes to the sdk
- Loading branch information
1 parent
a7ab984
commit 003523a
Showing
34 changed files
with
1,603 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,13 @@ The server: https://door.casdoor.com/ | |
- download the code | ||
|
||
```bash | ||
git clone [email protected]:casdoor/casdoor-flutter-example.git | ||
git clone [email protected]:casdoor/casdoor-flutter-example.git | ||
``` | ||
|
||
- install dependencies | ||
|
||
```shell | ||
flutter pub get | ||
flutter pub get | ||
``` | ||
## Configure | ||
Initialization requires 6 parameters, which are all str type: | ||
|
@@ -46,20 +46,28 @@ Initialization requires 6 parameters, which are all str type: | |
flutter run -d chrome --web-port 9000 | ||
``` | ||
|
||
## Note here that for Android and Web | ||
## Notes for different platforms | ||
|
||
### Windows 10 | ||
|
||
Download the WebView2 runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section) and install it. | ||
|
||
The WebView2 runtime is included in Windows 11 by default. | ||
|
||
## Linux and macOS | ||
|
||
Add the package `desktop_webview_window: ^0.2.3` inside *dependencies* to the *pubspec.yaml* file. | ||
|
||
Modify the *main* function to look like the following: | ||
|
||
### Android | ||
In order to capture the callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace YOUR_CALLBACK_URL_SCHEME_HERE with your actual callback url scheme. | ||
``` | ||
<activity android:name="com.example.casdoor_flutter_sdk.CallbackActivity" | ||
android:exported="true"> | ||
<intent-filter android:label="casdoor_flutter_sdk"> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<data android:scheme="casdoor" /> | ||
</intent-filter> | ||
</activity> | ||
void main(List<String> args) async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
if (runWebViewTitleBarWidget(args)) { | ||
return; | ||
} | ||
runApp(const MyApp()); | ||
} | ||
``` | ||
|
||
### Web | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Fri Jun 23 08:50:38 CEST 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
include ':app' | ||
pluginManagement { | ||
def flutterSdkPath = { | ||
def properties = new Properties() | ||
file("local.properties").withInputStream { properties.load(it) } | ||
def flutterSdkPath = properties.getProperty("flutter.sdk") | ||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||
return flutterSdkPath | ||
} | ||
settings.ext.flutterSdkPath = flutterSdkPath() | ||
|
||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") | ||
def properties = new Properties() | ||
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") | ||
|
||
assert localPropertiesFile.exists() | ||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } | ||
plugins { | ||
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false | ||
} | ||
} | ||
|
||
def flutterSdkPath = properties.getProperty("flutter.sdk") | ||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" | ||
include ":app" | ||
|
||
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.