├── Laravel new apicloudx Git.pdf ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── flutter │ │ │ │ └── plugins │ │ │ │ └── GeneratedPluginRegistrant.java │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── appturorialapi │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── appturorialapi_android.iml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle ├── apicloud.rar ├── apicloud_crud.rar ├── app laravel crud.rar ├── appturorialapi.iml ├── dbapicloudx.sql ├── install laravel and configuration.pdf ├── laravel intro.png ├── lib ├── main.dart └── view │ └── login.dart ├── pubspec.lock └── pubspec.yaml /Laravel new apicloudx Git.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/Laravel new apicloudx Git.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter + Laravel API JWT Authentication 2 | 3 | 4 | The code is 100% Flutter - API file .rar - bd.SQL, 5 | 6 | 7 | ![Codigo Alpha Flutter] 8 | 9 | ![alt text](https://github.com/codigoalphacol/api_laravel_flutter/blob/master/laravel%20intro.png) 10 | 11 | Los invitamos para que se suscriban en el canal de Youtube 12 | 13 | https://youtu.be/FWZvri_-X5w 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.appturorialapi" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java: -------------------------------------------------------------------------------- 1 | package io.flutter.plugins; 2 | 3 | import io.flutter.plugin.common.PluginRegistry; 4 | import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin; 5 | 6 | /** 7 | * Generated file. Do not edit. 8 | */ 9 | public final class GeneratedPluginRegistrant { 10 | public static void registerWith(PluginRegistry registry) { 11 | if (alreadyRegisteredWith(registry)) { 12 | return; 13 | } 14 | SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin")); 15 | } 16 | 17 | private static boolean alreadyRegisteredWith(PluginRegistry registry) { 18 | final String key = GeneratedPluginRegistrant.class.getCanonicalName(); 19 | if (registry.hasPlugin(key)) { 20 | return true; 21 | } 22 | registry.registrarFor(key); 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/appturorialapi/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.appturorialapi 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/appturorialapi_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/local.properties: -------------------------------------------------------------------------------- 1 | sdk.dir=C:\\Users\\Asus\\AppData\\Local\\Android\\Sdk 2 | flutter.sdk=C:\\src\\flutter 3 | flutter.buildMode=debug 4 | flutter.versionName=1.0.0 5 | flutter.versionCode=1 -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /apicloud.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/apicloud.rar -------------------------------------------------------------------------------- /apicloud_crud.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/apicloud_crud.rar -------------------------------------------------------------------------------- /app laravel crud.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/app laravel crud.rar -------------------------------------------------------------------------------- /appturorialapi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /dbapicloudx.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.8.3 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Servidor: 127.0.0.1 6 | -- Tiempo de generación: 08-01-2020 a las 01:49:55 7 | -- Versión del servidor: 10.1.36-MariaDB 8 | -- Versión de PHP: 7.2.10 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Base de datos: `dbapicloudx` 23 | -- 24 | 25 | -- -------------------------------------------------------- 26 | 27 | -- 28 | -- Estructura de tabla para la tabla `failed_jobs` 29 | -- 30 | 31 | CREATE TABLE `failed_jobs` ( 32 | `id` bigint(20) UNSIGNED NOT NULL, 33 | `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, 34 | `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, 35 | `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, 36 | `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL, 37 | `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP 38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 39 | 40 | -- -------------------------------------------------------- 41 | 42 | -- 43 | -- Estructura de tabla para la tabla `migrations` 44 | -- 45 | 46 | CREATE TABLE `migrations` ( 47 | `id` int(10) UNSIGNED NOT NULL, 48 | `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 49 | `batch` int(11) NOT NULL 50 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 51 | 52 | -- 53 | -- Volcado de datos para la tabla `migrations` 54 | -- 55 | 56 | INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES 57 | (1, '2014_10_12_000000_create_users_table', 1), 58 | (2, '2014_10_12_100000_create_password_resets_table', 1), 59 | (3, '2019_08_19_000000_create_failed_jobs_table', 1); 60 | 61 | -- -------------------------------------------------------- 62 | 63 | -- 64 | -- Estructura de tabla para la tabla `password_resets` 65 | -- 66 | 67 | CREATE TABLE `password_resets` ( 68 | `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 69 | `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 70 | `created_at` timestamp NULL DEFAULT NULL 71 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 72 | 73 | -- -------------------------------------------------------- 74 | 75 | -- 76 | -- Estructura de tabla para la tabla `users` 77 | -- 78 | 79 | CREATE TABLE `users` ( 80 | `id` bigint(20) UNSIGNED NOT NULL, 81 | `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 82 | `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 83 | `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, 84 | `created_at` timestamp NULL DEFAULT NULL, 85 | `updated_at` timestamp NULL DEFAULT NULL 86 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; 87 | 88 | -- 89 | -- Volcado de datos para la tabla `users` 90 | -- 91 | 92 | INSERT INTO `users` (`id`, `name`, `email`, `password`, `created_at`, `updated_at`) VALUES 93 | (2, 'Codigo', 'codigoalphacol@gmail.com', '$2y$10$Do17.EPwFvb1rM55vQxClORgMCexCJv728V.9MeDxwfgULNfEQxS6', '2020-01-02 00:34:11', '2020-01-02 00:34:11'), 94 | (3, 'Flutter', 'flutter@gmail.com', '$2y$10$J./.eoMpztPvKGhOTvKLBOTJMCQocOq52vpFSyZNeKASGBdKwoVeS', '2020-01-02 00:35:14', '2020-01-02 00:35:14'); 95 | 96 | -- 97 | -- Índices para tablas volcadas 98 | -- 99 | 100 | -- 101 | -- Indices de la tabla `failed_jobs` 102 | -- 103 | ALTER TABLE `failed_jobs` 104 | ADD PRIMARY KEY (`id`); 105 | 106 | -- 107 | -- Indices de la tabla `migrations` 108 | -- 109 | ALTER TABLE `migrations` 110 | ADD PRIMARY KEY (`id`); 111 | 112 | -- 113 | -- Indices de la tabla `password_resets` 114 | -- 115 | ALTER TABLE `password_resets` 116 | ADD KEY `password_resets_email_index` (`email`); 117 | 118 | -- 119 | -- Indices de la tabla `users` 120 | -- 121 | ALTER TABLE `users` 122 | ADD PRIMARY KEY (`id`), 123 | ADD UNIQUE KEY `users_email_unique` (`email`); 124 | 125 | -- 126 | -- AUTO_INCREMENT de las tablas volcadas 127 | -- 128 | 129 | -- 130 | -- AUTO_INCREMENT de la tabla `failed_jobs` 131 | -- 132 | ALTER TABLE `failed_jobs` 133 | MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; 134 | 135 | -- 136 | -- AUTO_INCREMENT de la tabla `migrations` 137 | -- 138 | ALTER TABLE `migrations` 139 | MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 140 | 141 | -- 142 | -- AUTO_INCREMENT de la tabla `users` 143 | -- 144 | ALTER TABLE `users` 145 | MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 146 | COMMIT; 147 | 148 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 149 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 150 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 151 | -------------------------------------------------------------------------------- /install laravel and configuration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/install laravel and configuration.pdf -------------------------------------------------------------------------------- /laravel intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codigoalphacol/api_laravel_flutter/ba8078aba92a017e966213fb0600116ae47275d2/laravel intro.png -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:appturorialapi/view/login.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:http/http.dart' as http; 7 | import 'package:shared_preferences/shared_preferences.dart'; 8 | 9 | void main() => runApp(MyApp()); 10 | 11 | class MyApp extends StatelessWidget { 12 | @override 13 | Widget build(BuildContext context) { 14 | return MaterialApp( 15 | title: "Codigo Alpha Flutter", 16 | debugShowCheckedModeBanner: false, 17 | home: MainPage(), 18 | theme: ThemeData( 19 | accentColor: Colors.white70 20 | ), 21 | ); 22 | } 23 | } 24 | 25 | class MainPage extends StatefulWidget { 26 | @override 27 | _MainPageState createState() => _MainPageState(); 28 | } 29 | 30 | class _MainPageState extends State { 31 | 32 | SharedPreferences sharedPreferences; 33 | 34 | @override 35 | void initState() { 36 | super.initState(); 37 | checkLoginStatus(); 38 | } 39 | 40 | checkLoginStatus() async { 41 | sharedPreferences = await SharedPreferences.getInstance(); 42 | if(sharedPreferences.getString("token") == null) { 43 | Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) => LoginPage()), (Route route) => false); 44 | } 45 | } 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Scaffold( 50 | appBar: AppBar( 51 | title: Text("Codigo Alpha Flutter", style: TextStyle(color: Colors.white)), 52 | actions: [ 53 | FlatButton( 54 | onPressed: () { 55 | sharedPreferences.clear(); 56 | sharedPreferences.commit(); 57 | Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) => LoginPage()), (Route route) => false); 58 | }, 59 | child: Text("Log Out", style: TextStyle(color: Colors.white)), 60 | ), 61 | ], 62 | ), 63 | body: Center(child: Text("Main Page")), 64 | drawer: Drawer( 65 | child: new ListView( 66 | children: [ 67 | new UserAccountsDrawerHeader( 68 | accountName: new Text('Ejercicios'), 69 | accountEmail: new Text('codigoalphacol@gmail.com'), 70 | // decoration: new BoxDecoration( 71 | // image: new DecorationImage( 72 | // fit: BoxFit.fill, 73 | // // image: AssetImage('img/estiramiento.jpg'), 74 | // ) 75 | // ), 76 | ), 77 | new Divider(), 78 | // new ListTile( 79 | // title: new Text("Add data"), 80 | // trailing: new Icon(Icons.fitness_center), 81 | // onTap: () => Navigator.of(context).push(new MaterialPageRoute( 82 | // builder: (BuildContext context) => AddData(), 83 | // )), 84 | // ), 85 | // new Divider(), 86 | // new ListTile( 87 | // title: new Text("Mostrar listado"), 88 | // trailing: new Icon(Icons.help), 89 | // onTap: () => Navigator.of(context).push(new MaterialPageRoute( 90 | // builder: (BuildContext context) => ShowData(), 91 | // )), 92 | // ), 93 | ], 94 | ), 95 | ), 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/view/login.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:http/http.dart' as http; 6 | import 'package:shared_preferences/shared_preferences.dart'; 7 | 8 | import '../main.dart'; 9 | 10 | 11 | 12 | class LoginPage extends StatefulWidget { 13 | @override 14 | _LoginPageState createState() => _LoginPageState(); 15 | } 16 | 17 | class _LoginPageState extends State { 18 | 19 | bool _isLoading = false; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light.copyWith(statusBarColor: Colors.transparent)); 24 | return Scaffold( 25 | body: Container( 26 | decoration: BoxDecoration( 27 | gradient: LinearGradient( 28 | colors: [Colors.blue, Colors.teal], 29 | begin: Alignment.topCenter, 30 | end: Alignment.bottomCenter), 31 | ), 32 | child: _isLoading ? Center(child: CircularProgressIndicator()) : ListView( 33 | children: [ 34 | headerSection(), 35 | textSection(), 36 | buttonSection(), 37 | ], 38 | ), 39 | ), 40 | ); 41 | } 42 | 43 | signIn(String email, pass) async { 44 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 45 | Map data = { 46 | 'email': email, 47 | 'password': pass 48 | }; 49 | var jsonResponse = null; 50 | 51 | var response = await http.post("http://192.168.1.55:8000/api/login", body: data); 52 | if(response.statusCode == 200) { 53 | jsonResponse = json.decode(response.body); 54 | print('Response status: ${response.statusCode}'); 55 | print('Response body: ${response.body}'); 56 | if(jsonResponse != null) { 57 | setState(() { 58 | _isLoading = false; 59 | }); 60 | sharedPreferences.setString("token", jsonResponse['token']); 61 | Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) => MainPage()), (Route route) => false); 62 | } 63 | } 64 | else { 65 | setState(() { 66 | _isLoading = false; 67 | }); 68 | print(response.body); 69 | } 70 | } 71 | 72 | Container buttonSection() { 73 | return Container( 74 | width: MediaQuery.of(context).size.width, 75 | height: 40.0, 76 | padding: EdgeInsets.symmetric(horizontal: 15.0), 77 | margin: EdgeInsets.only(top: 15.0), 78 | child: RaisedButton( 79 | onPressed: emailController.text == "" || passwordController.text == "" ? null : () { 80 | setState(() { 81 | _isLoading = true; 82 | }); 83 | signIn(emailController.text, passwordController.text); 84 | }, 85 | elevation: 0.0, 86 | color: Colors.purple, 87 | child: Text("Sign In", style: TextStyle(color: Colors.white70)), 88 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)), 89 | ), 90 | ); 91 | } 92 | 93 | final TextEditingController emailController = new TextEditingController(); 94 | final TextEditingController passwordController = new TextEditingController(); 95 | 96 | Container textSection() { 97 | return Container( 98 | padding: EdgeInsets.symmetric(horizontal: 15.0, vertical: 20.0), 99 | child: Column( 100 | children: [ 101 | TextFormField( 102 | controller: emailController, 103 | cursorColor: Colors.white, 104 | 105 | style: TextStyle(color: Colors.white70), 106 | decoration: InputDecoration( 107 | icon: Icon(Icons.email, color: Colors.white70), 108 | hintText: "Email", 109 | border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white70)), 110 | hintStyle: TextStyle(color: Colors.white70), 111 | ), 112 | ), 113 | SizedBox(height: 30.0), 114 | TextFormField( 115 | controller: passwordController, 116 | cursorColor: Colors.white, 117 | obscureText: true, 118 | style: TextStyle(color: Colors.white70), 119 | decoration: InputDecoration( 120 | icon: Icon(Icons.lock, color: Colors.white70), 121 | hintText: "Password", 122 | border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white70)), 123 | hintStyle: TextStyle(color: Colors.white70), 124 | ), 125 | ), 126 | ], 127 | ), 128 | ); 129 | } 130 | 131 | Container headerSection() { 132 | return Container( 133 | margin: EdgeInsets.only(top: 50.0), 134 | padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 30.0), 135 | child: Text("Codigo Alpha Flutter", 136 | style: TextStyle( 137 | color: Colors.white70, 138 | fontSize: 40.0, 139 | fontWeight: FontWeight.bold)), 140 | ); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.3.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.5" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.14.11" 32 | cupertino_icons: 33 | dependency: "direct main" 34 | description: 35 | name: cupertino_icons 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "0.1.3" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | flutter_test: 45 | dependency: "direct dev" 46 | description: flutter 47 | source: sdk 48 | version: "0.0.0" 49 | http: 50 | dependency: "direct main" 51 | description: 52 | name: http 53 | url: "https://pub.dartlang.org" 54 | source: hosted 55 | version: "0.12.0+3" 56 | http_parser: 57 | dependency: transitive 58 | description: 59 | name: http_parser 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "3.1.3" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.12.5" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.1.7" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.6.4" 84 | pedantic: 85 | dependency: transitive 86 | description: 87 | name: pedantic 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.8.0+1" 91 | quiver: 92 | dependency: transitive 93 | description: 94 | name: quiver 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "2.0.5" 98 | shared_preferences: 99 | dependency: "direct main" 100 | description: 101 | name: shared_preferences 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.5.4+8" 105 | shared_preferences_platform_interface: 106 | dependency: transitive 107 | description: 108 | name: shared_preferences_platform_interface 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.0.1" 112 | sky_engine: 113 | dependency: transitive 114 | description: flutter 115 | source: sdk 116 | version: "0.0.99" 117 | source_span: 118 | dependency: transitive 119 | description: 120 | name: source_span 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.5.5" 124 | stack_trace: 125 | dependency: transitive 126 | description: 127 | name: stack_trace 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.9.3" 131 | stream_channel: 132 | dependency: transitive 133 | description: 134 | name: stream_channel 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.0.0" 138 | string_scanner: 139 | dependency: transitive 140 | description: 141 | name: string_scanner 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.0.5" 145 | term_glyph: 146 | dependency: transitive 147 | description: 148 | name: term_glyph 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.1.0" 152 | test_api: 153 | dependency: transitive 154 | description: 155 | name: test_api 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "0.2.5" 159 | typed_data: 160 | dependency: transitive 161 | description: 162 | name: typed_data 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.6" 166 | vector_math: 167 | dependency: transitive 168 | description: 169 | name: vector_math 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.0.8" 173 | sdks: 174 | dart: ">=2.4.0 <3.0.0" 175 | flutter: ">=1.6.7 <2.0.0" 176 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: appturorialapi 2 | description: A new Flutter project. 3 | 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | http: any 14 | shared_preferences: any 15 | 16 | 17 | 18 | cupertino_icons: ^0.1.2 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | 24 | 25 | # For information on the generic Dart part of this file, see the 26 | # following page: https://dart.dev/tools/pub/pubspec 27 | 28 | # The following section is specific to Flutter. 29 | flutter: 30 | 31 | # The following line ensures that the Material Icons font is 32 | # included with your application, so that you can use the icons in 33 | # the material Icons class. 34 | uses-material-design: true 35 | 36 | # To add assets to your application, add an assets section, like this: 37 | # assets: 38 | # - images/a_dot_burr.jpeg 39 | # - images/a_dot_ham.jpeg 40 | 41 | # An image asset can refer to one or more resolution-specific "variants", see 42 | # https://flutter.dev/assets-and-images/#resolution-aware. 43 | 44 | # For details regarding adding assets from package dependencies, see 45 | # https://flutter.dev/assets-and-images/#from-packages 46 | 47 | # To add custom fonts to your application, add a fonts section here, 48 | # in this "flutter" section. Each entry in this list should have a 49 | # "family" key with the font family name, and a "fonts" key with a 50 | # list giving the asset and other descriptors for the font. For 51 | # example: 52 | # fonts: 53 | # - family: Schyler 54 | # fonts: 55 | # - asset: fonts/Schyler-Regular.ttf 56 | # - asset: fonts/Schyler-Italic.ttf 57 | # style: italic 58 | # - family: Trajan Pro 59 | # fonts: 60 | # - asset: fonts/TrajanPro.ttf 61 | # - asset: fonts/TrajanPro_Bold.ttf 62 | # weight: 700 63 | # 64 | # For details regarding fonts from package dependencies, 65 | # see https://flutter.dev/custom-fonts/#from-packages 66 | --------------------------------------------------------------------------------