Repository: VictorRancesCode/flutter_dialogflow
Branch: master
Commit: 24949ff6a2c2
Files: 58
Total size: 109.2 KB
Directory structure:
gitextract_xg4h5x02/
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── example/
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android/
│ │ ├── .gitignore
│ │ ├── app/
│ │ │ ├── build.gradle
│ │ │ └── src/
│ │ │ └── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── com/
│ │ │ │ └── codigopanda/
│ │ │ │ └── example/
│ │ │ │ └── MainActivity.java
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ └── launch_background.xml
│ │ │ └── values/
│ │ │ └── styles.xml
│ │ ├── build.gradle
│ │ ├── gradle/
│ │ │ └── wrapper/
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradle.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ ├── example.iml
│ ├── example_android.iml
│ ├── ios/
│ │ ├── .gitignore
│ │ ├── Flutter/
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── flutter_export_environment.sh
│ │ ├── Runner/
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchImage.imageset/
│ │ │ │ ├── Contents.json
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj/
│ │ │ │ ├── LaunchScreen.storyboard
│ │ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── Runner-Bridging-Header.h
│ │ ├── Runner.xcodeproj/
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace/
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ └── xcschemes/
│ │ │ └── Runner.xcscheme
│ │ └── Runner.xcworkspace/
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata/
│ │ └── WorkspaceSettings.xcsettings
│ ├── lib/
│ │ ├── dialogflow_v1.dart
│ │ ├── dialogflow_v2.dart
│ │ ├── google_assistant.dart
│ │ ├── main.dart
│ │ └── widgets/
│ │ ├── basicCard.dart
│ │ ├── carouselSelect.dart
│ │ └── simple_message.dart
│ ├── pubspec.yaml
│ └── test/
│ └── widget_test.dart
├── flutter_dialogflow.iml
├── lib/
│ ├── dialogflow_v2.dart
│ ├── flutter_dialogflow.dart
│ ├── utils/
│ │ └── language.dart
│ └── v2/
│ ├── auth_google.dart
│ ├── dialogflow_v2.dart
│ └── message.dart
├── pubspec.yaml
└── test/
└── flutter_dialogflow_test.dart
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_Store
.atom/
.dart_tool/
.idea
.idea/
.packages
.pub/
packages
================================================
FILE: CHANGELOG.md
================================================
## [0.1.3] - TODO: 27-03-2019.
* Upgrade dependencies and added example
## [0.1.2] - TODO: 27-03-2019.
* Fix delete dartdoc
## [0.1.1] - TODO: 26-11-2018.
* Fix 'AUTHORIZATION' is deprecated and added dartdoc
## [0.1.0] - TODO: 25-11-2018.
* Support Dart 2.0 and added Support for Dialogflow V2
## [0.0.1] - TODO: 27-05-2018.
* The flutter_dialogflow makes it easy to integrate dialogflow
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
http://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.
================================================
FILE: README.md
================================================
# Dialogflow v1 & v2 for Flutter apps.

### :heart: Star :heart: the repo to support the project. Thanks!
A new Flutter package.
* [Example](https://github.com/VictorRancesCode/flutter_dialogflow/tree/master/example)
## Awesome Tutorials
* [Flutter and Bots (DialogFlow)](https://medium.com/flutterpub/flutter-and-bots-dialogflow-d490fc7e5aaf). By [Aseem Wangoo](https://medium.com/@aseemwangoo)
* [Chatbot Inventory Tracking iOS & Android App with Flutter, DialogFlow, and GCP](https://medium.com/flutter-community/chatbot-inventory-tracking-ios-android-app-with-flutter-dialogflow-and-gcp-d7d903ce7f90). By [Alfian Losari](https://medium.com/@alfianlosari)
Thanks for the tutorials!
## Installation
* Add this to your package's pubspec.yaml file:
```
dependencies:
flutter_dialogflow: ^0.1.0
```
* You can install packages from the command line:
with Flutter:
```
$ flutter packages get
```
* Dialogflow v1 Import it Now in your Dart code, you can use:
```
import 'package:flutter_dialogflow/flutter_dialogflow.dart';
```
* Or Dialogflow v2 Import it Now in your Dart code, you can use:
```
import 'package:flutter_dialogflow/dialogflow_v2.dart';
```
## Usage
### Dialogflow v1
* [Dialogflow](https://dialogflow.com/) register and create new Agent
* Copy Api key (Token)
* Code
```
Dialogflow dialogflow = Dialogflow(token: "Your Token");
AIResponse response = await dialogflow.sendQuery("Your Query");
```
* Example
```
void Response(query) async {
Dialogflow dialogflow = Dialogflow(token: "10178f9cb6cf12321asdf4aae75c87cd");
AIResponse response = await dialogflow.sendQuery(query);
print(response.getMessageResponse());
}
```
### Dialogflow v2
* Dialogflow](https://dialogflow.com/) register and create new Agent
* Project Setup and Authentication
* First of all, we need to create a Google Cloud Platform Project using [Console Google Cloud](https://console.cloud.google.com/)
* Create or select an existing GCP project.
* From the GCP console, go to APIs and Services and click on credentials.
* Click on Create credentials and choose Service account key.
* Select your service account from the dropdown, choose JSON and click Create. This will download the JSON key to your computer. Save it securely.
* We downloaded a JSON file with all our data.
* In your project create folder assets(folder name recommended optional)
* Move file json in your project in folder created
* open file pubspec.yaml
```
flutter:
uses-material-design: true
assets:
- assets/your_file_downloaded_google_cloud.json
```
* Import dialogflow_v2
```
import 'package:flutter_dialogflow/dialogflow_v2.dart';
```
* Code
```
AuthGoogle authGoogle = await AuthGoogle(fileJson: "Asset Your File Json").build();
// Select Language.ENGLISH or Language.SPANISH or others...
Dialogflow dialogflow =Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
AIResponse response = await dialogflow.detectIntent("Your Query");
```
* Example
```
AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/your_file_downloaded_google_cloud.json").build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
AIResponse response = await dialogflow.detectIntent("Hi!!!");
print(response.getMessage())
```
* Or Get List Message type Card
```
Call function response.getListMessage()
response List
example
new CardDialogflow(response.getListMessage()[0]).title
Convert first item in CardDialogflow for worked easy
CardDialogflow have
- title
- subtitle
- imageUri
- List buttonss
- each button have text and postback
```
* Or Setup custom authentication (session)
```
Get a session id from your backend server after authentication.(Eg: OAuth Token)
Pass the session id a named parameter 'sessionId' to AuthGoogle function.
On the dialogflow fulfillment, access it inside `agent.session` (WebhookClient.session)
and apply your session logic
Example:
AuthGoogle authGoogle = await AuthGoogle(fileJson: "assets/your_file_downloaded_google_cloud.json", sessionId: "YOUR_CUSTOM_SESSION_ID").build();
Dialogflow dialogflow = Dialogflow(authGoogle: authGoogle,language: Language.ENGLISH);
AIResponse response = await dialogflow.detectIntent("Hi!!!");
print(response.getMessage())
```

### Dialogflow For Flutter Web
Visit the repository: [Flutter Dialogflow Web](https://github.com/VictorRancesCode/flutter_dialogflow_web) 🚀
================================================
FILE: example/.gitignore
================================================
.DS_Store
.atom/
.dart_tool/
.idea
.vscode/
.packages
.pub/
build/
ios/.generated/
packages
.flutter-plugins
assets/
================================================
FILE: example/.metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: b397406561f5e7a9c94e28f58d9e49fca0dd58b7
channel: beta
================================================
FILE: example/README.md
================================================
# example
A new Flutter project.
## Getting Started
For help getting started with Flutter, view our online
[documentation](https://flutter.io/).
================================================
FILE: example/android/.gitignore
================================================
*.iml
*.class
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
GeneratedPluginRegistrant.java
================================================
FILE: example/android/app/build.gradle
================================================
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.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.codigopanda.example"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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 {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
================================================
FILE: example/android/app/src/main/AndroidManifest.xml
================================================
================================================
FILE: example/android/app/src/main/java/com/codigopanda/example/MainActivity.java
================================================
package com.codigopanda.example;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
================================================
FILE: example/android/app/src/main/res/drawable/launch_background.xml
================================================
================================================
FILE: example/android/app/src/main/res/values/styles.xml
================================================
================================================
FILE: example/android/build.gradle
================================================
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: example/android/gradle/wrapper/gradle-wrapper.properties
================================================
#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-4.4-all.zip
================================================
FILE: example/android/gradle.properties
================================================
org.gradle.jvmargs=-Xmx1536M
================================================
FILE: example/android/gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
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" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: example/android/gradlew.bat
================================================
@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
@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=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
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 init
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
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
: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 %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: example/android/settings.gradle
================================================
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
================================================
FILE: example/example.iml
================================================
================================================
FILE: example/example_android.iml
================================================
================================================
FILE: example/ios/.gitignore
================================================
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/app.flx
/Flutter/app.zip
/Flutter/flutter_assets/
/Flutter/App.framework
/Flutter/Flutter.framework
/Flutter/Generated.xcconfig
/ServiceDefinitions.json
Pods/
================================================
FILE: example/ios/Flutter/AppFrameworkInfo.plist
================================================
CFBundleDevelopmentRegionenCFBundleExecutableAppCFBundleIdentifierio.flutter.flutter.appCFBundleInfoDictionaryVersion6.0CFBundleNameAppCFBundlePackageTypeFMWKCFBundleShortVersionString1.0CFBundleSignature????CFBundleVersion1.0UIRequiredDeviceCapabilitiesarm64MinimumOSVersion8.0
================================================
FILE: example/ios/Flutter/Debug.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: example/ios/Flutter/Release.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: example/ios/Flutter/flutter_export_environment.sh
================================================
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/rances/development/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/rances/Repositorio/MyProjects/flutter_dialogflow/example"
export "FLUTTER_TARGET=/Users/rances/Repositorio/MyProjects/flutter_dialogflow/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/rances/development/flutter/bin/cache/artifacts/engine/ios"
================================================
FILE: example/ios/Runner/AppDelegate.swift
================================================
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
================================================
FILE: example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
================================================
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
================================================
FILE: example/ios/Runner/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: example/ios/Runner/Base.lproj/Main.storyboard
================================================
================================================
FILE: example/ios/Runner/Info.plist
================================================
CFBundleDevelopmentRegionenCFBundleExecutable$(EXECUTABLE_NAME)CFBundleIdentifier$(PRODUCT_BUNDLE_IDENTIFIER)CFBundleInfoDictionaryVersion6.0CFBundleNameexampleCFBundlePackageTypeAPPLCFBundleShortVersionString1.0CFBundleSignature????CFBundleVersion1LSRequiresIPhoneOSUILaunchStoryboardNameLaunchScreenUIMainStoryboardFileMainUIRequiredDeviceCapabilitiesarm64UISupportedInterfaceOrientationsUIInterfaceOrientationPortraitUIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUISupportedInterfaceOrientations~ipadUIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDownUIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIViewControllerBasedStatusBarAppearance
================================================
FILE: example/ios/Runner/Runner-Bridging-Header.h
================================================
#import "GeneratedPluginRegistrant.h"
================================================
FILE: example/ios/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
);
name = "Supporting Files";
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0910;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.codigopanda.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.codigopanda.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
================================================
FILE: example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
================================================
FILE: example/ios/Runner.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
BuildSystemTypeOriginal
================================================
FILE: example/lib/dialogflow_v1.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_dialogflow/flutter_dialogflow.dart';
class PageDialogflowV1 extends StatefulWidget {
PageDialogflowV1({Key key, this.title}) : super(key: key);
final String title;
@override
_PageDialogflowV1 createState() => new _PageDialogflowV1();
}
class _PageDialogflowV1 extends State {
final List _messages = [];
final TextEditingController _textController = new TextEditingController();
Widget _buildTextComposer() {
return new IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: [
new Flexible(
child: new TextField(
controller: _textController,
onSubmitted: _handleSubmitted,
decoration:
new InputDecoration.collapsed(hintText: "Send a message"),
),
),
new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: () => _handleSubmitted(_textController.text)),
),
],
),
),
);
}
void Response(query) async {
_textController.clear();
Dialogflow dialogflow =Dialogflow(token: "Your Token");
AIResponse response = await dialogflow.sendQuery(query);
ChatMessage message = new ChatMessage(
text: response.getMessageResponse(),
name: "Bot",
type: false,
);
setState(() {
_messages.insert(0, message);
});
}
void _handleSubmitted(String text) {
_textController.clear();
ChatMessage message = new ChatMessage(
text: text,
name: "Rances",
type: true,
);
setState(() {
_messages.insert(0, message);
});
Response(text);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Dialogflow V1"),
),
body: new Column(children: [
new Flexible(
child: new ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
)),
new Divider(height: 1.0),
new Container(
decoration: new BoxDecoration(color: Theme.of(context).cardColor),
child: _buildTextComposer(),
),
]),
);
}
}
class ChatMessage extends StatelessWidget {
ChatMessage({this.text, this.name, this.type});
final String text;
final String name;
final bool type;
List otherMessage(context) {
return [
new Container(
margin: const EdgeInsets.only(right: 16.0),
child: new CircleAvatar(child: new Image.asset("img/placeholder.png")),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Text(this.name, style:new TextStyle(fontWeight:FontWeight.bold )),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(text),
),
],
),
),
];
}
List myMessage(context) {
return [
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
new Text(this.name, style: Theme.of(context).textTheme.subhead),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(text),
),
],
),
),
new Container(
margin: const EdgeInsets.only(left: 16.0),
child: new CircleAvatar(child: new Text(this.name[0])),
),
];
}
@override
Widget build(BuildContext context) {
return new Container(
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: this.type ? myMessage(context) : otherMessage(context),
),
);
}
}
================================================
FILE: example/lib/dialogflow_v2.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_dialogflow/dialogflow_v2.dart';
class HomePageDialogflowV2 extends StatefulWidget {
HomePageDialogflowV2({Key key, this.title}) : super(key: key);
final String title;
@override
_HomePageDialogflowV2 createState() => new _HomePageDialogflowV2();
}
class _HomePageDialogflowV2 extends State {
final List _messages = [];
final TextEditingController _textController = new TextEditingController();
Widget _buildTextComposer() {
return new IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: [
new Flexible(
child: new TextField(
controller: _textController,
onSubmitted: _handleSubmitted,
decoration:
new InputDecoration.collapsed(hintText: "Send a message"),
),
),
new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: () => _handleSubmitted(_textController.text)),
),
],
),
),
);
}
void Response(query) async {
_textController.clear();
AuthGoogle authGoogle = await AuthGoogle(fileJson: "Asset Your File Json").build();
Dialogflow dialogflow =Dialogflow(authGoogle: authGoogle,language: Language.english);
AIResponse response = await dialogflow.detectIntent(query);
ChatMessage message = new ChatMessage(
text: response.getMessage() ?? new TypeMessage(response.getListMessage()[0]).platform,
name: "Bot",
type: false,
);
setState(() {
_messages.insert(0, message);
});
}
void _handleSubmitted(String text) {
_textController.clear();
ChatMessage message = new ChatMessage(
text: text,
name: "Rances",
type: true,
);
setState(() {
_messages.insert(0, message);
});
Response(text);
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Dialogflow V2"),
),
body: new Column(children: [
new Flexible(
child: new ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
)),
new Divider(height: 1.0),
new Container(
decoration: new BoxDecoration(color: Theme.of(context).cardColor),
child: _buildTextComposer(),
),
]),
);
}
}
class ChatMessage extends StatelessWidget {
ChatMessage({this.text, this.name, this.type});
final String text;
final String name;
final bool type;
List otherMessage(context) {
return [
new Container(
margin: const EdgeInsets.only(right: 16.0),
child: new CircleAvatar(child: new Image.asset("img/placeholder.png")),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Text(this.name, style:new TextStyle(fontWeight:FontWeight.bold )),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(text),
),
],
),
),
];
}
List myMessage(context) {
return [
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
new Text(this.name, style: Theme.of(context).textTheme.subhead),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(text),
),
],
),
),
new Container(
margin: const EdgeInsets.only(left: 16.0),
child: new CircleAvatar(child: new Text(this.name[0])),
),
];
}
@override
Widget build(BuildContext context) {
return new Container(
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: this.type ? myMessage(context) : otherMessage(context),
),
);
}
}
================================================
FILE: example/lib/google_assistant.dart
================================================
import 'package:example/widgets/basicCard.dart';
import 'package:example/widgets/carouselSelect.dart';
import 'package:example/widgets/simple_message.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dialogflow/dialogflow_v2.dart';
class GoogleAssistant extends StatefulWidget {
GoogleAssistant({Key key, this.title}) : super(key: key);
final String title;
@override
_GoogleAssistant createState() => new _GoogleAssistant();
}
class _GoogleAssistant extends State {
final List _messages = [];
final TextEditingController _textController = new TextEditingController();
BuildContext buildContext;
Widget _buildTextComposer() {
return new IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(
children: [
new Flexible(
child: new TextField(
controller: _textController,
onSubmitted: _handleSubmitted,
decoration:
new InputDecoration.collapsed(hintText: "Send a message"),
),
),
new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send,color: Colors.blue,),
onPressed: () => _handleSubmitted(_textController.text)),
),
],
),
),
);
}
dynamic getWidgetMessage(message) {
TypeMessage ms = TypeMessage(message);
if (ms.platform == "ACTIONS_ON_GOOGLE") {
if (ms.type == "simpleResponses") {
return SimpleMessage(
text: message['simpleResponses']['simpleResponses'][0]
['textToSpeech'],
name: "Bot",
type: false,
);
}
if (ms.type == "basicCard") {
return BasicCardWidget(card: BasicCardDialogflow(message));
}
if (ms.type == "carouselSelect") {
return CarouselSelectWidget(
carouselSelect: CarouselSelect(message),
clickItem: (info) {
print(info); // Item Click print List Keys
});
}
}
return null;
}
void Response(query) async {
_textController.clear();
AuthGoogle authGoogle =
await AuthGoogle(fileJson: "Asset Your File Json").build();
Dialogflow dialogflow =
Dialogflow(authGoogle: authGoogle, language: Language.english);
AIResponse response = await dialogflow.detectIntent(query);
if (response.getMessage() != null && response.getMessage() != "") {
SimpleMessage message = new SimpleMessage(
text: response.getMessage(),
name: "Bot",
type: false,
);
setState(() {
_messages.insert(0, message);
});
} else {
List messages = response.getListMessage();
for (var i = 0; i < messages.length; i++) {
dynamic message = getWidgetMessage(messages[i]);
if (message != null) {
setState(() {
_messages.insert(0, message);
});
}
}
}
}
void _handleSubmitted(String text) {
_textController.clear();
SimpleMessage message = new SimpleMessage(
text: text,
name: "Rances",
type: true,
);
setState(() {
_messages.insert(0, message);
});
Response(text);
}
@override
Widget build(BuildContext context) {
this.buildContext=context;
return new Scaffold(
backgroundColor: Color(0xf4f4f4f4f4),
appBar: new AppBar(
title: new Text("Google Assistant"),
backgroundColor: Colors.blue,
),
body: new Column(children: [
new Flexible(
child: new ListView.builder(
padding: new EdgeInsets.all(8.0),
reverse: true,
itemBuilder: (_, int index) => _messages[index],
itemCount: _messages.length,
)),
new Divider(height: 1.0),
new Container(
decoration: new BoxDecoration(color: Theme.of(context).cardColor),
child: _buildTextComposer(),
),
]),
);
}
}
================================================
FILE: example/lib/main.dart
================================================
import 'package:example/dialogflow_v1.dart';
import 'package:example/dialogflow_v2.dart';
import 'package:flutter/material.dart';
import 'google_assistant.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Example Dialogflow Flutter',
theme: new ThemeData(
primarySwatch: Colors.deepOrange,
),
home: new MyHomePage(title: 'Flutter Demo Dialogflow'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Column(children: [
new Container(
margin: EdgeInsets.all(10.0),
child: new RaisedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PageDialogflowV1()),
);
},
child: Text("Dialogflow v1"),
),
),
new Container(
margin: EdgeInsets.all(10.0),
child: new RaisedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => HomePageDialogflowV2()),
);
},
child: Text("Dialogflow v2"),
),
),
new Container(
margin: EdgeInsets.all(10.0),
child: new RaisedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => GoogleAssistant()),
);
},
child: Text("GoogleAssistant"),
),
)
]),
);
}
}
================================================
FILE: example/lib/widgets/basicCard.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dialogflow/v2/message.dart';
class BasicCardWidget extends StatelessWidget {
BasicCardWidget({this.card});
final BasicCardDialogflow card;
List generateButton() {
List buttons = [];
for (var i = 0; i < this.card.buttons.length; i++) {
buttons.add(new SizedBox(
width: double.infinity,
child: new RaisedButton(
onPressed: () {},
color: Colors.green,
textColor: Colors.white,
child: Text(this.card.buttons[i]['title']),
)));
}
return buttons;
}
@override
Widget build(BuildContext context) {
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
child: new Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
color: Colors.white),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Container(
child: Image.network(this.card.image.imageUri),
),
new Padding(
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Text(
this.card.title,
style:
TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
),
new Text(
this.card.subtitle,
style: TextStyle(color: Colors.black.withOpacity(0.6)),
),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(this.card.formattedText),
),
],
),
),
new Container(
child: new Column(
children: generateButton(),
),
),
],
),
),
);
}
}
================================================
FILE: example/lib/widgets/carouselSelect.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_dialogflow/v2/message.dart';
class ItemCarouselWidget extends StatefulWidget {
final ItemCarousel item;
final Function clickItem;
ItemCarouselWidget({Key key,this.item, this.clickItem}) : super(key: key);
@override
_ItemCarouselWidget createState() => _ItemCarouselWidget();
}
class _ItemCarouselWidget extends State {
@override
Widget build(BuildContext context) {
// TODO: implement build
return InkWell(
onTap: () {
widget.clickItem(widget.item.info);
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
child: new Container(
margin: EdgeInsets.all(10.0),
width: 300.0,
height: 350.0,
decoration: BoxDecoration(
border: Border.all(color: Colors.black26),
borderRadius: BorderRadius.all(Radius.circular(20.0)),
color: Colors.white),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new NetworkImage(widget.item.image.imageUri),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0))),
child: null,
height: 200.0,
),
new Padding(
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Text(
widget.item.title,
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold),
),
new Container(
margin: const EdgeInsets.only(top: 5.0),
child: new Text(widget.item.description),
),
],
),
),
],
),
),
));
}
}
class CarouselSelectWidget extends StatefulWidget {
CarouselSelectWidget({this.carouselSelect, this.clickItem});
final Function clickItem;
final CarouselSelect carouselSelect;
@override
_CarouselSelectWidget createState() => _CarouselSelectWidget();
}
class _CarouselSelectWidget extends State {
List listItems() {
List items = [];
for (var i = 0; i < widget.carouselSelect.items.length; i++) {
items.add(new ItemCarouselWidget(
item: widget.carouselSelect.items[i], clickItem: widget.clickItem));
}
return items;
}
@override
Widget build(BuildContext context) {
return new Container(
child: new SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(children: listItems()),
),
);
}
}
================================================
FILE: example/lib/widgets/simple_message.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class SimpleMessage extends StatelessWidget {
SimpleMessage({this.text, this.name, this.type});
final String text;
final String name;
final bool type;
List otherMessage(context) {
return [
new Container(
margin: const EdgeInsets.only(right: 16.0),
child: new CircleAvatar(
child: new Image.asset("img/googleasistant.png"),
backgroundColor: Colors.transparent,
),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Container(
margin: const EdgeInsets.only(top: 5.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(20.0))),
child: Padding(
padding: EdgeInsets.only(
top: 10.0, bottom: 10.0, left: 10.0, right: 10.0),
child: new Text(text, style: TextStyle(color: Colors.black),),
),
),
],
),
),
];
}
List myMessage(context) {
return [
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
new Container(
margin: const EdgeInsets.only(top: 5.0),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(20.0))),
child: Padding(
padding: EdgeInsets.only(
top: 10.0, bottom: 10.0, left: 10.0, right: 10.0),
child: new Text(text, style: TextStyle(color: Colors.white),),
),
),
],
),
),
new Container(
margin: const EdgeInsets.only(left: 16.0),
child: new CircleAvatar(child: new Text(this.name[0])),
),
];
}
@override
Widget build(BuildContext context) {
return new Container(
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: this.type ? myMessage(context) : otherMessage(context),
),
);
}
}
================================================
FILE: example/pubspec.yaml
================================================
name: example
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
flutter_dialogflow:
path: ../
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.0
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- img/placeholder.png
- img/googleasistant.png
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
================================================
FILE: example/test/widget_test.dart
================================================
// This is a basic Flutter widget test.
// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
// find child widgets in the widget tree, read text, and verify that the values of widget properties
// are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:example/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
================================================
FILE: flutter_dialogflow.iml
================================================
================================================
FILE: lib/dialogflow_v2.dart
================================================
library flutter_dialogflow;
export 'v2/auth_google.dart';
export 'v2/dialogflow_v2.dart';
export 'utils/language.dart';
export 'v2/message.dart';
================================================
FILE: lib/flutter_dialogflow.dart
================================================
library flutter_dialogflow;
import 'package:meta/meta.dart';
import 'package:http/http.dart' as http;
import 'dart:async';
import 'dart:convert';
import 'dart:io';
class Status {
int _code;
String _errorType;
String _errorDetails;
Status(Map response) {
this._code = response["code"];
this._errorType = response["errorType"];
this._errorDetails = response["errorDetails"];
}
int get getCode => _code;
set code(int value) {
_code = value;
}
String get getErrorType => _errorType;
set errorType(String value) {
_errorType = value;
}
String get getErrorDetails => _errorDetails;
set errorDetails(String value) {
_errorDetails = value;
}
}
class Fulfillment {
String _speech;
dynamic _messages;
Fulfillment(Map response) {
this._speech = response["speech"];
this._messages = response["messages"];
}
getMessageResponse() {
return this._messages[0]["speech"];
}
getSpeechResponse() {
return this._speech;
}
String get getSApeech => _speech;
set speech(String value) {
_speech = value;
}
dynamic get getMessages => _messages;
set messages(dynamic value) {
_messages = value;
}
}
class Metadata {
String _intentId;
String _webhookUsed;
String _webhookForSlotFillingUsed;
String _intentName;
Metadata(Map response) {
this._intentId = response["intentId"];
this._webhookUsed = response["webhookUsed"];
this._webhookForSlotFillingUsed = response["webhookForSlotFillingUsed"];
this._intentName = response["intentName"];
}
String get getIntentId => _intentId;
set intentId(String value) {
_intentId = value;
}
String get getWebhookUsed => _webhookUsed;
set webhookUsed(String value) {
_webhookUsed = value;
}
String get getWebhookForSlotFillingUsed => _webhookForSlotFillingUsed;
set webhookForSlotFillingUsed(String value) {
_webhookForSlotFillingUsed = value;
}
String get getIntentName => _intentName;
set intentName(String value) {
_intentName = value;
}
}
class Result {
String _source;
String _action;
String _resolvedQuery;
bool _actionIncomplete;
Map _parameters;
dynamic _contexts;
Metadata _metadata;
Fulfillment _fulfillment;
double _score;
Result(Map response) {
this._source = response["source"];
this._action = response["action"];
this._resolvedQuery = response["resolvedQuery"];
this._actionIncomplete = response["actionIncomplete"];
this._parameters = response["parameters"];
this._contexts = response["contexts"];
this._metadata = new Metadata(response["metadata"]);
this._fulfillment = new Fulfillment(response["fulfillment"]);
this._score = response["score"];
}
String get getSource => _source;
set source(String value) {
_source = value;
}
String get getAction => _action;
set action(String value) {
_action = value;
}
String get getResolvedQuery => _resolvedQuery;
set resolvedQuery(String value) {
_resolvedQuery = value;
}
bool get getActionIncomplete => _actionIncomplete;
set actionIncomplete(bool value) {
_actionIncomplete = value;
}
Map get getParameters => _parameters;
set parameters(Map value) {
_parameters = value;
}
dynamic get getContexts => _contexts;
set contexts(dynamic value) {
_contexts = value;
}
Metadata get getMetadata => _metadata;
set metadata(Metadata value) {
_metadata = value;
}
Fulfillment get getFulfillment => _fulfillment;
set fulfillment(Fulfillment value) {
_fulfillment = value;
}
double get getScore => _score;
set score(double value) {
_score = value;
}
}
class AIResponse {
String _id;
String _timestamp;
String _lang;
Result _result;
Status _status;
String _sessionId;
AIResponse(Map response) {
this._status = new Status(response["status"]);
if (this._status.getCode != 200) {
print(this._status.getErrorType);
print(this._status.getErrorDetails);
throw new FormatException(this._status.getErrorDetails);
} else {
this._id = response["id"];
this._timestamp = response["timestamp"];
this._lang = response["lang"];
this._result = new Result(response["result"]);
}
}
getMessageResponse() {
return this._result.getFulfillment.getMessageResponse();
}
getSpeechResponse() {
return this._result.getFulfillment.getSpeechResponse();
}
String get getId => _id;
set id(String value) {
_id = value;
}
String get getTimestamp => _timestamp;
set timestamp(String value) {
_timestamp = value;
}
String get getLang => _lang;
set lang(String value) {
_lang = value;
}
Result get getResult => _result;
set result(Result value) {
_result = value;
}
Status get getStatus => _status;
set status(Status value) {
_status = value;
}
String get getsessionId => _sessionId;
set sessionId(String value) {
_sessionId = value;
}
}
class Dialogflow {
final String token;
final String version;
final String timezone;
final String sessionId;
final String language;
const Dialogflow(
{@required this.token,
this.version = "20170712",
this.timezone = "America/New_York",
this.sessionId = "12345",
this.language = "en"});
String _getUrl(query) {
return "https://api.dialogflow.com/v1/query?v=$version&contexts=$query"
"&lang=es&query=$query&lang=$language&sessionId=$sessionId&timezone=$timezone";
}
Future sendQuery(query) async {
var response = await http.get(
_getUrl(query),
headers: {HttpHeaders.authorizationHeader: "Bearer " + token},
);
Map data = json.decode(response.body);
AIResponse aiResponse = new AIResponse(data);
return aiResponse;
}
}
================================================
FILE: lib/utils/language.dart
================================================
class Language {
/* Chinese Cantonese */
static String chineseCantonese = "zh-HK";
@Deprecated("Use chineseCantonese")
static String CHINESE_CANTONESE = chineseCantonese;
/* Chinese Simplified */
static String chineseSimplified = "zh-CN";
@Deprecated("Use chineseSimplified")
static String CHINESE_SIMPLIFIED = chineseSimplified;
/* Chinese Traditional */
static String chineseTraditional = "zh-TW";
@Deprecated("Use chineseTraditional")
static String CHINESE_TRADITIONAL = chineseTraditional;
/* Danish */
static String danish = "da";
@Deprecated("Use danish")
static String DANISH = danish;
/* Dutch */
static String dutch = "nl";
@Deprecated("Use dutch")
static String DUTCH = dutch;
/* English */
static String english = "en";
@Deprecated("Use english")
static String ENGLISH = english;
/* English Australian locale */
static String englishAustralianLocale = "en-AU";
@Deprecated("Use englishAustralianLocale")
static String ENGLISH_AUSTRALIAN_LOCALE = englishAustralianLocale;
/* English Canadian locale */
static String englishCanadianLocale = "en-CA";
@Deprecated("Use englishCanadianLocale")
static String ENGLISH_CANADIAN_LOCALE = englishCanadianLocale;
/* English Great Britain locale */
static String englishGreatBritaniLocale = "en-GB";
@Deprecated("Use englishGreatBritaniLocale")
static String ENGLISH_GREAT_BRITANI_LOCALE = englishGreatBritaniLocale;
/* English Indian locale */
static String englishIndianLocale = "en-IN";
@Deprecated("Use englishIndianLocale")
static String ENGLISH_INDIAN_LOCALE = englishIndianLocale;
/* English US locale */
static String englishUsLocale = "en-US";
@Deprecated("Use englishUsLocale")
static String ENGLISH_US_LOCALE = englishUsLocale;
/* French */
static String french = "fr";
@Deprecated("Use french")
static String FRENCH = french;
/* French Canadian locale */
static String frenchCanadianLocale = "fr-CA";
@Deprecated("Use frenchCanadianLocale")
static String FRENCH_CANADIAN_LOCALE = frenchCanadianLocale;
/* France locale */
static String frenchFranceLocale = "fr-FR";
@Deprecated("Use frenchFranceLocale")
static String FRENCH_FRANCE_LOCALE = frenchFranceLocale;
/* German */
static String german = "de";
@Deprecated("Use german")
static String GERMAN = german;
/* Hindi */
static String hindi = "hi";
@Deprecated("Use hindi")
static String HINDI = hindi;
/* Indonesian */
static String indonesian = "id";
@Deprecated("Use indonesian")
static String INDONESIAN = indonesian;
/* Italian */
static String italian = "it";
@Deprecated("Use italian")
static String ITALIAN = italian;
/* Japanese */
static String japonese = "ja";
@Deprecated("Use japonese")
static String JAPANESE = japonese;
/* Korean */
static String korean = "ko";
@Deprecated("Use korean")
static String KOREAN = korean;
/* Norwegian */
static String norwegian = "no";
@Deprecated("Use norwegian")
static String NORWEGIAN = norwegian;
/* Portuguese */
static String portuguese = "pt";
@Deprecated("Use portuguese")
static String PORTUGUESE = portuguese;
/* Portuguese Brazilian */
static String portugueseBrazilian = "pt-BR";
@Deprecated("Use portugueseBrazilian")
static String PORTUGUESE_BRAZILIAN = portugueseBrazilian;
/* Russian */
static String russian = "ru";
@Deprecated("Use russian")
static String RUSSIAN = russian;
/* Spanish */
static String spanish = "es";
@Deprecated("Use spanish")
static String SPANISH = spanish;
/* Spanish Latin America locale */
static String spanishLatinAmerica = "es-419";
@Deprecated("Use spanishLatinAmerica")
static String SPANISH_LATIN_AMERICA = spanishLatinAmerica;
/* Spanish Spain */
static String spanishSpain = "es-ES";
@Deprecated("Use spanishSpain")
static String SPANISH_SPAIN = spanishSpain;
/* Swedish */
static String swedish = "sv";
@Deprecated("Use swedish")
static String SWEDISH = swedish;
/* Thai */
static String thai = "th";
@Deprecated("Use thai")
static String THAI = thai;
/* Ukranian */
static String ukranian = "uk";
@Deprecated("Use ukranian")
static String UKRANIAN = ukranian;
}
================================================
FILE: lib/v2/auth_google.dart
================================================
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'package:http/http.dart';
import 'package:meta/meta.dart';
import 'package:http/http.dart' as http;
class AuthGoogle {
final String fileJson;
final List scope;
final String sessionId;
AuthGoogle({@required this.fileJson,this.scope=const ["https://www.googleapis.com/auth/cloud-platform"],this.sessionId="123"});
String _projectId;
AccessCredentials _credentials;
Future getReadJson() async {
String data = await rootBundle.loadString(this.fileJson);
return data;
}
Future build() async {
String readJson = await getReadJson();
Map jsonData = json.decode(readJson);
var _credentialsResponse = new ServiceAccountCredentials.fromJson(readJson);
var data = await clientViaServiceAccount(_credentialsResponse, this.scope);
_projectId = jsonData['project_id'];
_credentials = data.credentials;
return this;
}
bool get hasExpired{
return _credentials.accessToken.hasExpired;
}
String get getSessionId{
return sessionId;
}
String get getProjectId{
return _projectId;
}
String get getToken{
return _credentials.accessToken.data;
}
Future post(url, {Map headers, body,
Encoding encoding}) async{
if (!hasExpired) {
return await http.post(url, headers: headers, body:body);
} else {
await build();
return await http.post(url, headers: headers, body:body);
}
}
}
================================================
FILE: lib/v2/dialogflow_v2.dart
================================================
import 'dart:convert';
import 'dart:io';
import 'package:flutter_dialogflow/v2/auth_google.dart';
import 'package:meta/meta.dart';
class Intent {
String name;
String displayName;
Intent(Map data) {
name = data["name"];
displayName = data["displayName"];
}
}
class QueryResult {
String queryText;
String action;
Map parameters;
bool allRequiredParamsPresent;
String fulfillmentText;
List fulfillmentMessages;
Intent intent;
QueryResult(Map data) {
queryText = data["queryText"];
action = data["action"];
parameters = data["parameters"] ?? null;
allRequiredParamsPresent = data["allRequiredParamsPresent"];
fulfillmentText = data["fulfillmentText"];
intent = data['intent'] != null ? new Intent(data['intent']) : null;
fulfillmentMessages = data['fulfillmentMessages'];
}
}
class DiagnosticInfo {
String webhookLatencyMs;
DiagnosticInfo(Map response) {
webhookLatencyMs = response["webhook_latency_ms"];
}
}
class WebhookStatus {
String message;
WebhookStatus(Map response) {
message = response['message'];
}
}
class AIResponse {
String _responseId;
QueryResult _queryResult;
num _intentDetectionConfidence;
String _languageCode;
DiagnosticInfo _diagnosticInfo;
WebhookStatus _webhookStatus;
AIResponse({Map body}) {
_responseId = body['responseId'];
_intentDetectionConfidence = body['intentDetectionConfidence'];
_queryResult = new QueryResult(body['queryResult']);
_languageCode = body['languageCode'];
_diagnosticInfo = (body['diagnosticInfo'] != null
? new DiagnosticInfo(body['diagnosticInfo'])
: null);
_webhookStatus = body['webhookStatus'] != null
? new WebhookStatus(body['webhookStatus'])
: null;
}
String get responseId {
return _responseId;
}
String getMessage() {
return _queryResult.fulfillmentText;
}
String getWebhookStatusMessage() {
return _webhookStatus.message;
}
List getListMessage() {
return _queryResult.fulfillmentMessages;
}
num get intentDetectionConfidence {
return _intentDetectionConfidence;
}
String get languageCode {
return _languageCode;
}
DiagnosticInfo get diagnosticInfo {
return _diagnosticInfo;
}
WebhookStatus get webhookStatus {
return _webhookStatus;
}
QueryResult get queryResult {
return _queryResult;
}
}
class Dialogflow {
final AuthGoogle authGoogle;
final String language;
final String payload;
final bool resetContexts;
const Dialogflow({@required this.authGoogle, this.language="en", this.payload="", this.resetContexts=false});
String _getUrl() {
return "https://dialogflow.googleapis.com/v2/projects/${authGoogle.getProjectId}/agent/sessions/${authGoogle.getSessionId}:detectIntent";
}
Future detectIntent(String query) async {
String queryParams = '{"resetContexts": ${this.resetContexts} }';
if (payload.isNotEmpty) {
queryParams = '{"resetContexts": ${this.resetContexts}, "payload": $payload}';
}
String body = '{"queryInput":{"text":{"text":"$query","language_code":"$language"}}, "queryParams": $queryParams}';
var response = await authGoogle.post(_getUrl(),
headers: {
HttpHeaders.authorizationHeader: "Bearer ${authGoogle.getToken}"
},
body: body);
return AIResponse(body: json.decode(response.body));
}
}
================================================
FILE: lib/v2/message.dart
================================================
class ListTextDialogflow {
List listText = [];
ListTextDialogflow(Map response) {
List listText = response['text']['text'];
listText.forEach((element)=> this.listText.add(element));
}
}
class ImageDialogflow {
String imageUri;
String accessibilityText;
ImageDialogflow(Map response) {
this.imageUri = response['imageUri'];
this.accessibilityText = response['accessibilityText'];
}
}
class QuickReplies {
String title;
List quickReplies=[];
QuickReplies(Map response) {
this.title = response['quickReplies']['title'];
List listQuickReplies = response['quickReplies']['quickReplies'];
listQuickReplies.forEach((element)=> this.quickReplies.add(element));
}
}
class ButtonDialogflow {
String text;
String postback;
ButtonDialogflow(Map response) {
text = response['text'];
postback = response['postback'];
}
}
class CardDialogflow {
String title;
String subtitle;
String imageUri;
List buttons=[];
CardDialogflow(Map response) {
this.title = response['card']['title'];
this.subtitle = response['card']['subtitle'];
this.imageUri = response['card']['imageUri'];
List listButtons = response['card']['buttons'];
for (int i = 0; i < listButtons.length; i++) {
ButtonDialogflow b =new ButtonDialogflow(listButtons[i]);
buttons.add(b);
}
}
}
class SimpleResponse {
String textToSpeech;
String ssml;
String displayText;
SimpleResponse(Map response){
this.textToSpeech = response['textToSpeech'];
this.ssml = response['ssml'];
this.displayText = response['displayText'];
}
}
class SimpleResponses {
List simpleResponses =[];
SimpleResponses(Map response){
List listSimpleResponse = response['simpleResponses']['simpleResponses'];
for (int i = 0; i < listSimpleResponse.length; i++) {
SimpleResponse b =new SimpleResponse(listSimpleResponse[i]);
simpleResponses.add(b);
}
}
}
class BasicCardDialogflow {
String title;
String subtitle;
String formattedText;
ImageDialogflow image;
List buttons;
BasicCardDialogflow(Map response) {
this.title = response['basicCard']['title'];
this.subtitle = response['basicCard']['subtitle'];
this.formattedText = response['basicCard']['formattedText'];
this.image = new ImageDialogflow(response['basicCard']['image']) ;
this.buttons = response['basicCard']['buttons'];
}
}
class ItemCarousel{
dynamic info;
String title;
String description;
ImageDialogflow image;
ItemCarousel(Map item){
this.info = item['info'];
this.title = item['title'];
this.description = item['description'];
this.image =new ImageDialogflow(item['image']);
}
}
class CarouselSelect {
List items=[];
CarouselSelect(Map response){
List list = response['carouselSelect']['items'];
for(var i=0;i
homepage: https://github.com/VictorRancesCode/flutter_dialogflow
dependencies:
flutter:
sdk: flutter
http: ^0.12.0+2
googleapis_auth: ^0.2.6
dev_dependencies:
test:
flutter_test:
sdk: flutter
flutter:
environment:
sdk: '>=1.20.1 <3.0.0'
================================================
FILE: test/flutter_dialogflow_test.dart
================================================
import 'package:test/test.dart';
import 'package:flutter_dialogflow/flutter_dialogflow.dart';
void main() {
test('Test Dialogflow', () async {
Dialogflow dialogflow =
Dialogflow(token: "Your Token");
AIResponse response = await dialogflow.sendQuery("hello world");
if (response.getStatus.getCode != 200)
expect(false, throwsNoSuchMethodError);
});
}