ajuste do calendário
This commit is contained in:
@@ -5,11 +5,11 @@ import '../utils/cores.dart';
|
||||
|
||||
class ItemAgenda extends StatelessWidget {
|
||||
|
||||
String data;
|
||||
int cor;
|
||||
String titulo;
|
||||
|
||||
ItemAgenda({
|
||||
required this.data,
|
||||
required this.cor,
|
||||
required this.titulo,
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ class ItemAgenda extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
width: Dimensoes.width*0.2,
|
||||
child: TextCustom(text: data,size: 14.0,fontWeight: FontWeight.normal,color: PaletaCores.cinzaClaro,)
|
||||
child: Icon(Icons.circle,color: Color(cor),)
|
||||
),
|
||||
TextCustom(text: titulo),
|
||||
],
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
class EventoModelo{
|
||||
String titulo;
|
||||
String data;
|
||||
int cor;
|
||||
|
||||
EventoModelo({
|
||||
required this.titulo,
|
||||
required this.data,
|
||||
this.cor = 0
|
||||
});
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import 'package:rkm_educa_app/modelos/evento_modelo.dart';
|
||||
import 'package:rkm_educa_app/utils/cores.dart';
|
||||
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../controllers/main_controllers.dart';
|
||||
|
||||
class TelaAgenda extends StatefulWidget {
|
||||
@@ -81,20 +80,34 @@ class _TelaAgendaState extends State<TelaAgenda> {
|
||||
// print(map);
|
||||
if(map!=false){
|
||||
List list = map;
|
||||
List titulo = [];
|
||||
List<EventoModelo> listD = [];
|
||||
for(int i = 0; list.length>i;i++){
|
||||
List data = list[i]['DT_CALENDARIO'].toString().split('-');
|
||||
listDatas.add(EventoModelo(titulo: list[i]['NO_EVENTO'], data: '${data[2]}/${data[1]}/${data[0]}'));
|
||||
|
||||
titulo.add(list[i]['NO_EVENTO'].toString().trim());
|
||||
|
||||
listD.add(EventoModelo(
|
||||
titulo: list[i]['NO_EVENTO'].toString().trim(),
|
||||
data: '${data[2]}/${data[1]}/${data[0]}',
|
||||
cor: int.parse(list[i]['NO_COR'].toString().trim()=='#0ff'?'0xffe1e1a1':'0xff'+list[i]['NO_COR'].toString().replaceAll("#", ''))));
|
||||
|
||||
_markedDateMap.add(
|
||||
DateTime(int.parse(data[0]),int.parse(data[1]),int.parse(data[2])),
|
||||
Event(
|
||||
date: DateTime(int.parse(data[0]),int.parse(data[1]),int.parse(data[2])),
|
||||
icon: _eventIcon(data[2],list[i]['NO_COR'].toString().trim()=='#0ff'?Color(0xffe1e1e1)
|
||||
icon: _eventIcon(data[2],list[i]['NO_COR'].toString().trim()=='#0ff'?Color(0xffe1e1a1)
|
||||
:Color(int.parse('0xff'+list[i]['NO_COR'].toString().replaceAll("#", '')))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
List limpando = titulo.toSet().toList();
|
||||
|
||||
for(int i = 0; limpando.length>i;i++){
|
||||
int index = 0;
|
||||
index = titulo.indexOf(limpando[i]);
|
||||
listDatas.add(listD[index]);
|
||||
}
|
||||
}
|
||||
carregandoEventos = false;
|
||||
setState(() {});
|
||||
@@ -118,7 +131,7 @@ class _TelaAgendaState extends State<TelaAgenda> {
|
||||
selectedDayButtonColor: Colors.red,
|
||||
weekendTextStyle: textStyleFDS,
|
||||
markedDatesMap: _markedDateMap,
|
||||
height: Dimensoes.height*0.40,
|
||||
height: Dimensoes.height*0.45,
|
||||
targetDateTime: dataAtual,
|
||||
markedDateCustomTextStyle: textStyle,
|
||||
markedDateMoreShowTotal: null,
|
||||
@@ -183,15 +196,7 @@ class _TelaAgendaState extends State<TelaAgenda> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: Dimensoes.width*0.2,
|
||||
child: TextCustom(text: 'DATA',size: 14.0,fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextCustom(text: 'TÍTULO',size: 14.0,fontWeight: FontWeight.bold),
|
||||
],
|
||||
),
|
||||
child: TextCustom(text: 'LEGENDA',size: 14.0,fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
Container(width: double.infinity,height: 2,color: PaletaCores.divider,),
|
||||
@@ -201,7 +206,7 @@ class _TelaAgendaState extends State<TelaAgenda> {
|
||||
child: ListView.builder(
|
||||
itemCount: listDatas.length,
|
||||
itemBuilder: (context,index){
|
||||
return ItemAgenda(data: listDatas[index].data, titulo: listDatas[index].titulo);
|
||||
return ItemAgenda(cor: listDatas[index].cor, titulo: listDatas[index].titulo);
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user