Skip to content

Commit

Permalink
Ajustes
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrcode committed Sep 22, 2022
1 parent de28574 commit b1cf601
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 37 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/TarefaController.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class TarefaController extends Base {
tarefaCor(String? value) => model.cor = value.toString();

var controllerNome = TextEditingController();
var controllerDataehora = TextEditingController();
var controllerObservacao = TextEditingController();
var controllerPrioridade = TextEditingController();
var controllerCor = TextEditingController();
var controllerDataehora = TextEditingController();

Future<bool> saveTarefa() async {
if (!formKey.currentState!.validate()) {
Expand Down
9 changes: 6 additions & 3 deletions lib/components/dialogs/tarefaDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ Future<dynamic> criarTarefa(BuildContext context) {
label: 'nome',
),
),
SelectData(tarefaController: tarefaController),
SelectData(
controller: tarefaController.controllerDataehora,
onSaved: tarefaController.tarefaDataehora),
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: input(
Expand All @@ -51,8 +53,9 @@ Future<dynamic> criarTarefa(BuildContext context) {
label: 'observação',
),
),
SelectPrioridade(tarefaController: tarefaController),
SelectCor(tarefaController: tarefaController),
SelectPrioridade(
prioridade: tarefaController.tarefaPrioridade),
SelectCor(cor: tarefaController.tarefaCor),
Botao(
texto: 'Cadastrar',
cor: const Color(0xFF6385C3),
Expand Down
3 changes: 1 addition & 2 deletions lib/components/navigation/bottom_navigation_bar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:organizei/components/navigation/menu.dart';

Expand Down Expand Up @@ -50,7 +49,7 @@ class _ButtonNavigatorBarState extends State<ButtonNavigatorBar>
offset: offset,
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut,
child: Container(child: Menu(customFunction: _slideDown)),
child: Container(child: Menu(fecharMenu: _slideDown)),
),
Box(
radius: 30,
Expand Down
21 changes: 4 additions & 17 deletions lib/components/navigation/menu.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
//import 'package:intl/intl.dart';
import 'package:organizei/Repository/TarefaRepository.dart';
import 'package:organizei/components/botao.dart';
import 'package:organizei/components/box.dart';
import 'package:organizei/components/dialog_personalizado.dart';
import 'package:organizei/components/dialogs/tarefaDialog.dart';
import 'package:organizei/components/input.dart';
import 'package:organizei/components/texto_contornado.dart';
import 'package:organizei/home_page.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart' as intl;

import '../../Controller/TarefaController.dart';

class Menu extends StatefulWidget {
const Menu({Key? key, this.customFunction}) : super(key: key);
const Menu({Key? key, this.fecharMenu}) : super(key: key);

final customFunction;
final fecharMenu;

@override
State<Menu> createState() => _MenuState();
}

class _MenuState extends State<Menu> {
late TarefaController tarefaController;

@override
Widget build(BuildContext context) {
return Column(
Expand Down Expand Up @@ -53,7 +39,7 @@ class _MenuState extends State<Menu> {
children: [
GestureDetector(
onTap: () {
widget.customFunction();
widget.fecharMenu();
showDialog(
barrierDismissible: false,
barrierColor: Colors.white.withOpacity(0),
Expand Down Expand Up @@ -184,6 +170,7 @@ class _MenuState extends State<Menu> {
GestureDetector(
onTap: () {
criarTarefa(context);
widget.fecharMenu();
},
child: AbsorbPointer(
child: Row(
Expand Down
7 changes: 3 additions & 4 deletions lib/components/selectCor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:organizei/Controller/TarefaController.dart';

class SelectCor extends StatefulWidget {
final TarefaController tarefaController;
const SelectCor({Key? key, required this.tarefaController}) : super(key: key);
final dynamic cor;
const SelectCor({Key? key, required this.cor}) : super(key: key);

@override
State<SelectCor> createState() => _SelectCorState();
Expand Down Expand Up @@ -48,8 +48,7 @@ class _SelectCorState extends State<SelectCor> {
setState(() {
corSelected = strone;
});
widget.tarefaController
.tarefaCor(corSelected.toString());
widget.cor(corSelected.toString());
},
child: Container(
width: 60,
Expand Down
14 changes: 7 additions & 7 deletions lib/components/selectData.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:organizei/Controller/TarefaController.dart';
import 'package:organizei/components/input.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart' as intl;

class SelectData extends StatefulWidget {
final TarefaController tarefaController;
const SelectData({Key? key, required this.tarefaController})
final dynamic onSaved;
final TextEditingController? controller;
const SelectData({Key? key, required this.onSaved, this.controller})
: super(key: key);

@override
Expand All @@ -29,8 +29,8 @@ class _SelectDataState extends State<SelectData> {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: input(
onSaved: widget.tarefaController.tarefaDataehora,
textController: widget.tarefaController.controllerDataehora,
onSaved: widget.onSaved,
textController: widget.controller,
label: 'data e hora',
placeholder: 'Selecione a data e hora',
readOnly: true,
Expand Down Expand Up @@ -119,14 +119,14 @@ class _SelectDataState extends State<SelectData> {
date = newDate;
});

widget.tarefaController.tarefaDataehora(newDateTime.toString());
widget.onSaved(newDateTime.toString());

intl.Intl.defaultLocale = 'pt_BR';
initializeDateFormatting('pt_BR');

intl.DateFormat('dd/MM/yyyy HH:mm').format(newDateTime);

widget.tarefaController.controllerDataehora.text =
widget.controller!.text =
intl.DateFormat('dd/MM/yyyy HH:mm').format(newDateTime);
}),
);
Expand Down
6 changes: 3 additions & 3 deletions lib/components/selectPrioridade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import '../Controller/TarefaController.dart';
const List<String> list = <String>['baixa', 'média', 'alta'];

class SelectPrioridade extends StatefulWidget {
final TarefaController? tarefaController;
const SelectPrioridade({Key? key, this.tarefaController}) : super(key: key);
final dynamic prioridade;
const SelectPrioridade({Key? key, this.prioridade}) : super(key: key);

@override
State<SelectPrioridade> createState() => _DropdownButtonExampleState();
Expand Down Expand Up @@ -50,7 +50,7 @@ class _DropdownButtonExampleState extends State<SelectPrioridade> {
borderRadius: BorderRadius.circular(16.0),
),
),
onSaved: widget.tarefaController!.tarefaPrioridade,
onSaved: widget.prioridade,
value: dropdownValue,
elevation: 16,
style: const TextStyle(color: Colors.grey),
Expand Down

0 comments on commit b1cf601

Please sign in to comment.