Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
appFluetter
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
Nayeli Monserrat Velasco Lopez
appFluetter
Commits
f5b6f189
Commit
f5b6f189
authored
Aug 02, 2024
by
Nayeli Monserrat Velasco Lopez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nayeli.velasco' into 'master'
UI formulario de categoria See merge request
!8
parents
0dfe403a
a2ea6099
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
9 deletions
+119
-9
NewCategoryPage.dart
lib/src/pages/NewCategoryPage.dart
+96
-0
home_page.dart
lib/src/pages/home_page.dart
+10
-9
login_page.dart
lib/src/pages/login_page.dart
+4
-0
pubspec.lock
pubspec.lock
+8
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/src/pages/NewCategoryPage.dart
0 → 100644
View file @
f5b6f189
import
'package:flutter/material.dart'
;
import
'package:intl/intl.dart'
;
class
NewCategoryPage
extends
StatefulWidget
{
const
NewCategoryPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
_NewCategoryPageState
createState
()
=>
_NewCategoryPageState
();
}
class
_NewCategoryPageState
extends
State
<
NewCategoryPage
>
{
final
_formKey
=
GlobalKey
<
FormState
>();
final
_claveController
=
TextEditingController
();
final
_nombreController
=
TextEditingController
();
DateTime
_selectedDate
=
DateTime
.
now
();
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Nueva Categoría'
),
backgroundColor:
Colors
.
blue
,
),
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
Form
(
key:
_formKey
,
child:
Column
(
children:
[
TextFormField
(
controller:
_claveController
,
decoration:
const
InputDecoration
(
labelText:
'Clave'
),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
'Por favor ingrese una clave'
;
}
return
null
;
},
),
TextFormField
(
controller:
_nombreController
,
decoration:
const
InputDecoration
(
labelText:
'Nombre'
),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
'Por favor ingrese un nombre'
;
}
return
null
;
},
),
const
SizedBox
(
height:
16.0
),
TextFormField
(
readOnly:
true
,
decoration:
InputDecoration
(
labelText:
'Fecha de Creación'
,
hintText:
DateFormat
(
'yyyy-MM-dd'
).
format
(
_selectedDate
),
),
onTap:
()
async
{
DateTime
?
pickedDate
=
await
showDatePicker
(
context:
context
,
initialDate:
_selectedDate
,
firstDate:
DateTime
(
2000
),
lastDate:
DateTime
(
2101
),
);
if
(
pickedDate
!=
null
&&
pickedDate
!=
_selectedDate
)
{
setState
(()
{
_selectedDate
=
pickedDate
;
});
}
},
),
const
SizedBox
(
height:
16.0
),
ElevatedButton
(
onPressed:
()
{
if
(
_formKey
.
currentState
!.
validate
())
{
int
fechaCreado
=
_selectedDate
.
millisecondsSinceEpoch
;
print
({
"clave"
:
_claveController
.
text
,
"fechaCreado"
:
fechaCreado
,
"nombre"
:
_nombreController
.
text
});
Navigator
.
pop
(
context
);
}
},
child:
const
Text
(
'GUARDAR'
),
style:
ElevatedButton
.
styleFrom
(
foregroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
blue
,
),
),
],
),
),
),
);
}
}
lib/src/pages/home_page.dart
View file @
f5b6f189
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:miapp_flutter/src/specific_widgets/menu.dart'
;
import
'package:miapp_flutter/src/specific_widgets/menu.dart'
;
import
'NewCategoryPage.dart'
;
import
'category/CategoryListWidget.dart'
;
import
'category/CategoryListWidget.dart'
;
void
main
(
)
=>
runApp
(
const
DrawerApp
());
void
main
(
)
=>
runApp
(
const
DrawerApp
());
...
@@ -28,12 +28,10 @@ class _HomePageState extends State<HomePage> {
...
@@ -28,12 +28,10 @@ class _HomePageState extends State<HomePage> {
String
selectedPage
=
''
;
String
selectedPage
=
''
;
void
_handleNewCategory
()
{
void
_handleNewCategory
()
{
// Define la acción que debe ocurrir cuando se presiona el botón "Nueva categoria"
// Navega a la página de nueva categoría
setState
(()
{
Navigator
.
push
(
selectedPage
=
'Nueva categoria'
;
context
,
});
MaterialPageRoute
(
builder:
(
context
)
=>
const
NewCategoryPage
()),
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
const
SnackBar
(
content:
Text
(
'Nueva categoria presionada'
)),
);
);
}
}
...
@@ -65,7 +63,7 @@ class _HomePageState extends State<HomePage> {
...
@@ -65,7 +63,7 @@ class _HomePageState extends State<HomePage> {
drawer:
MenuWidget
(),
drawer:
MenuWidget
(),
body:
TabBarView
(
body:
TabBarView
(
children:
[
children:
[
Column
(
Column
(
children:
[
children:
[
Expanded
(
Expanded
(
child:
CategoryListWidget
(),
child:
CategoryListWidget
(),
...
@@ -75,6 +73,9 @@ class _HomePageState extends State<HomePage> {
...
@@ -75,6 +73,9 @@ class _HomePageState extends State<HomePage> {
child:
ElevatedButton
(
child:
ElevatedButton
(
onPressed:
_handleNewCategory
,
onPressed:
_handleNewCategory
,
child:
const
Text
(
'Nueva categoría'
),
child:
const
Text
(
'Nueva categoría'
),
style:
ElevatedButton
.
styleFrom
(
foregroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
blue
,
),
),
),
),
),
],
],
...
...
lib/src/pages/login_page.dart
View file @
f5b6f189
...
@@ -42,6 +42,10 @@ class LoginPage extends StatelessWidget {
...
@@ -42,6 +42,10 @@ class LoginPage extends StatelessWidget {
Navigator
.
pushNamed
(
context
,
'home'
);
Navigator
.
pushNamed
(
context
,
'home'
);
},
},
child:
const
Text
(
'Acceder'
),
child:
const
Text
(
'Acceder'
),
style:
ElevatedButton
.
styleFrom
(
foregroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
blueLogin
,
),
),
),
],
],
),
),
...
...
pubspec.lock
View file @
f5b6f189
...
@@ -136,6 +136,14 @@ packages:
...
@@ -136,6 +136,14 @@ packages:
url: "https://pub.dev"
url: "https://pub.dev"
source: hosted
source: hosted
version: "4.0.2"
version: "4.0.2"
intl:
dependency: "direct main"
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
url: "https://pub.dev"
source: hosted
version: "0.18.1"
leak_tracker:
leak_tracker:
dependency: transitive
dependency: transitive
description:
description:
...
...
pubspec.yaml
View file @
f5b6f189
...
@@ -39,6 +39,7 @@ dependencies:
...
@@ -39,6 +39,7 @@ dependencies:
cupertino_icons
:
^1.0.6
cupertino_icons
:
^1.0.6
http
:
^1.2.2
http
:
^1.2.2
connectivity_plus
:
^6.0.4
connectivity_plus
:
^6.0.4
intl
:
^0.18.0
dev_dependencies
:
dev_dependencies
:
flutter_test
:
flutter_test
:
...
...
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