Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Projeto Focus
Frontend
Commits
c0a7748d
You need to sign in or sign up before continuing.
Commit
c0a7748d
authored
1 year ago
by
Leonardo José Machado Canto
Browse files
Options
Download
Email Patches
Plain Diff
provider de objetivos finalizado
parent
eeae4dc2
Pipeline
#7718
failed with stage
in 1 minute and 12 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/components/mensagens_personalizadas/add_text.dart
+1
-1
lib/components/mensagens_personalizadas/add_text.dart
lib/view/objetivos/objectives_provider.dart
+3
-3
lib/view/objetivos/objectives_provider.dart
lib/view/objetivos/objetivos_view.dart
+21
-12
lib/view/objetivos/objetivos_view.dart
with
25 additions
and
16 deletions
+25
-16
lib/components/mensagens_personalizadas/add_text.dart
View file @
c0a7748d
...
@@ -7,6 +7,7 @@ class AddText extends StatefulWidget {
...
@@ -7,6 +7,7 @@ class AddText extends StatefulWidget {
final
String
placeholder
;
final
String
placeholder
;
final
TextInputType
?
keyboardType
;
final
TextInputType
?
keyboardType
;
final
String
?
Function
(
String
?)?
validator
;
final
String
?
Function
(
String
?)?
validator
;
const
AddText
(
const
AddText
(
{
Key
?
key
,
{
Key
?
key
,
...
@@ -181,7 +182,6 @@ class _AddTextState extends State<AddText> {
...
@@ -181,7 +182,6 @@ class _AddTextState extends State<AddText> {
{
{
widget
.
onSave
(
_messageController
.
text
),
widget
.
onSave
(
_messageController
.
text
),
Navigator
.
pop
(
context
),
Navigator
.
pop
(
context
),
Navigator
.
pushNamed
(
context
,
pushPath
)
}
}
},
},
child:
Text
(
'Salvar'
,
child:
Text
(
'Salvar'
,
...
...
This diff is collapsed.
Click to expand it.
lib/view/objetivos/objectives_provider.dart
View file @
c0a7748d
...
@@ -19,9 +19,9 @@ class ObjectivesProvider extends ChangeNotifier {
...
@@ -19,9 +19,9 @@ class ObjectivesProvider extends ChangeNotifier {
notifyListeners
();
notifyListeners
();
}
}
Future
<
void
>
adicionarObjetivo
(
Objective
goal
)
async
{
adicionarObjetivo
(
Objective
goal
)
{
await
userModel
.
addObjective
(
goal
.
name
);
userModel
.
addObjective
(
goal
.
name
);
await
userModel
.
loadUserFromDB
();
userModel
.
loadUserFromDB
();
notifyListeners
();
notifyListeners
();
_list
.
add
(
goal
);
_list
.
add
(
goal
);
notifyListeners
();
notifyListeners
();
...
...
This diff is collapsed.
Click to expand it.
lib/view/objetivos/objetivos_view.dart
View file @
c0a7748d
...
@@ -84,8 +84,14 @@ class _ObjetivosState extends State<Objetivos> {
...
@@ -84,8 +84,14 @@ class _ObjetivosState extends State<Objetivos> {
context:
context
,
context:
context
,
builder:
(
context
)
=>
AddText
(
builder:
(
context
)
=>
AddText
(
//função que precisam criar
//função que precisam criar
onSave:
userModel
onSave:
(
String
value
)
{
.
addObjective
,
//userModel.addObjective, // mudar aqui
if
(
value
!=
null
)
{
Provider
.
of
<
ObjectivesProvider
>(
context
,
listen:
false
)
.
adicionarObjetivo
(
Objective
(
name:
value
,
phrases:
[]));
}
},
//userModel.addObjective, // mudar aqui
placeholder:
'Escreva seu objetivo'
,
placeholder:
'Escreva seu objetivo'
,
validator:
(
String
?
v
)
{
validator:
(
String
?
v
)
{
if
(
v
==
null
)
return
null
;
if
(
v
==
null
)
return
null
;
...
@@ -112,16 +118,19 @@ class _ObjetivosState extends State<Objetivos> {
...
@@ -112,16 +118,19 @@ class _ObjetivosState extends State<Objetivos> {
:
ListView
.
builder
(
:
ListView
.
builder
(
itemCount:
objectivesProvider
.
list
.
length
,
itemCount:
objectivesProvider
.
list
.
length
,
itemBuilder:
(
_
,
index
)
{
itemBuilder:
(
_
,
index
)
{
return
TextDisplay
(
return
Padding
(
message:
objectivesProvider
.
list
[
index
].
name
,
padding:
const
EdgeInsets
.
all
(
10.0
),
onDelete:
(
String
value
)
{
child:
TextDisplay
(
if
(
value
!=
null
)
{
message:
objectivesProvider
.
list
[
index
].
name
,
Provider
.
of
<
ObjectivesProvider
>(
context
,
onDelete:
(
String
value
)
{
listen:
false
)
if
(
value
!=
null
)
{
.
removerObjetivo
(
Provider
.
of
<
ObjectivesProvider
>(
context
,
objectivesProvider
.
list
[
index
]);
listen:
false
)
}
.
removerObjetivo
(
},
objectivesProvider
.
list
[
index
]);
}
},
),
);
);
},
},
);
);
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help