Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
primera_practica
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yenisleydi Benitez Martinez
primera_practica
Commits
66a26e6a
You need to sign in or sign up before continuing.
Commit
66a26e6a
authored
Jul 31, 2024
by
yenisleydi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avances tarea 7
parent
ef0fb08b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
195 additions
and
0 deletions
+195
-0
urls.dart
lib/environments/urls.dart
+2
-0
category_service.dart
lib/src/http_api/category_service.dart
+23
-0
categoryModel.dart
lib/src/models/categoryModel.dart
+53
-0
GeneratedPluginRegistrant.swift
macos/Flutter/GeneratedPluginRegistrant.swift
+2
-0
pubspec.lock
pubspec.lock
+109
-0
pubspec.yaml
pubspec.yaml
+2
-0
generated_plugin_registrant.cc
windows/flutter/generated_plugin_registrant.cc
+3
-0
generated_plugins.cmake
windows/flutter/generated_plugins.cmake
+1
-0
No files found.
lib/environments/urls.dart
0 → 100644
View file @
66a26e6a
const
apiApp
=
'https://basic2.visorus.com.mx'
;
\ No newline at end of file
lib/src/http_api/category_service.dart
0 → 100644
View file @
66a26e6a
import
'package:flutter/foundation.dart'
;
// Para usar kDebugMode
import
'package:http/http.dart'
as
http
;
import
'package:primer_practica/environments/urls.dart'
as
api
;
class
CategoryService
{
static
const
String
apiBaseUrl
=
'categoria'
;
// Cambia esto a la URL base de tu API
// Método para obtener las categorías
Future
<
Map
<
String
,
dynamic
>>
getCategories
({
int
offset
=
0
,
int
max
=
100
})
async
{
String
url
=
'
${{api.apiApp}
}/
$apiBaseUrl
?offset=
$offset
&max=
$max
'
;
if
(
kDebugMode
)
{
print
(
'Url ->
$url
'
);
}
try
{
final
resp
=
await
http
.
get
(
Uri
.
parse
(
url
));
return
{
"statusCode"
:
resp
.
statusCode
,
"body"
:
resp
.
body
};
}
catch
(
e
)
{
return
{
"statusCode"
:
501
,
"body"
:
'
$e
'
};
}
}
}
lib/src/models/categoryModel.dart
0 → 100644
View file @
66a26e6a
// lib/src/models/category_model.dart
class
CategoryModel
{
int
id
;
int
?
version
;
String
clave
;
String
nombre
;
int
?
fechaCreado
;
String
categoria
;
bool
?
activo
;
CategoryModel
({
required
this
.
id
,
this
.
version
,
required
this
.
clave
,
required
this
.
nombre
,
this
.
fechaCreado
,
required
this
.
categoria
,
this
.
activo
,
});
// Método para crear una instancia de CategoryModel desde un JSON
factory
CategoryModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
CategoryModel
(
id:
json
[
'id'
],
version:
json
[
'version'
]
??
0
,
clave:
json
[
'clave'
]
??
''
,
nombre:
json
[
'nombre'
]
??
''
,
fechaCreado:
json
[
'fechaCreado'
],
categoria:
json
[
'categoria'
]
??
''
,
activo:
json
[
'activo'
],
);
// Método para convertir una instancia de CategoryModel a JSON
Map
<
String
,
dynamic
>
toJson
()
=>
{
'id'
:
id
,
'version'
:
version
,
'clave'
:
clave
,
'nombre'
:
nombre
,
'fechaCreado'
:
fechaCreado
,
'categoria'
:
categoria
,
'activo'
:
activo
,
};
// Método para crear una lista de CategoryModel desde una lista de JSONs
static
List
<
CategoryModel
>
fromJsonArray
(
List
<
dynamic
>
json
)
{
return
json
.
map
((
data
)
=>
CategoryModel
.
fromJson
(
data
)).
toList
();
}
// Método para convertir una lista de CategoryModel a una lista de JSONs
static
List
<
Map
<
String
,
dynamic
>>
toJsonArray
(
List
<
CategoryModel
>
list
)
{
return
list
.
map
((
item
)
=>
item
.
toJson
()).
toList
();
}
}
macos/Flutter/GeneratedPluginRegistrant.swift
View file @
66a26e6a
...
...
@@ -5,6 +5,8 @@
import
FlutterMacOS
import
Foundation
import
connectivity_plus
func
RegisterGeneratedPlugins
(
registry
:
FlutterPluginRegistry
)
{
ConnectivityPlusPlugin
.
register
(
with
:
registry
.
registrar
(
forPlugin
:
"ConnectivityPlusPlugin"
))
}
pubspec.lock
View file @
66a26e6a
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
args:
dependency: transitive
description:
name: args
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
async:
dependency: transitive
description:
...
...
@@ -41,6 +49,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.18.0"
connectivity_plus:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "3e7d1d9dbae40ae82cbe6c23c518f0c4ffe32764ee9749b9a99d32cbac8734f6"
url: "https://pub.dev"
source: hosted
version: "6.0.4"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
cupertino_icons:
dependency: "direct main"
description:
...
...
@@ -49,6 +73,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.8"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
fake_async:
dependency: transitive
description:
...
...
@@ -57,6 +89,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
ffi:
dependency: transitive
description:
name: ffi
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
flutter:
dependency: "direct main"
description: flutter
...
...
@@ -75,6 +115,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
name: http
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
url: "https://pub.dev"
source: hosted
version: "1.2.2"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
leak_tracker:
dependency: transitive
description:
...
...
@@ -131,6 +192,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.12.0"
nm:
dependency: transitive
description:
name: nm
sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
path:
dependency: transitive
description:
...
...
@@ -139,6 +208,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.2"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -192,6 +277,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.0"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.2"
vector_math:
dependency: transitive
description:
...
...
@@ -208,6 +301,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.1"
web:
dependency: transitive
description:
name: web
sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
url: "https://pub.dev"
source: hosted
version: "1.0.0"
xml:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.5.0"
sdks:
dart: ">=3.4.4 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
pubspec.yaml
View file @
66a26e6a
...
...
@@ -30,6 +30,8 @@ environment:
dependencies
:
flutter
:
sdk
:
flutter
http
:
^1.2.2
connectivity_plus
:
^6.0.4
# The following adds the Cupertino Icons font to your application.
...
...
windows/flutter/generated_plugin_registrant.cc
View file @
66a26e6a
...
...
@@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
void
RegisterPlugins
(
flutter
::
PluginRegistry
*
registry
)
{
ConnectivityPlusWindowsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"ConnectivityPlusWindowsPlugin"
));
}
windows/flutter/generated_plugins.cmake
View file @
66a26e6a
...
...
@@ -3,6 +3,7 @@
#
list
(
APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
)
list
(
APPEND FLUTTER_FFI_PLUGIN_LIST
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment