Todo summary
This commit is contained in:
@@ -152,6 +152,8 @@ List<CatMapData> dailyData = <CatMapData>[
|
||||
|
||||
List<CatMapData> hourglassCatData = <CatMapData>[];
|
||||
|
||||
List<Todo> relativeTodos = [];
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({Key? key}) : super(key: key);
|
||||
|
||||
@@ -293,6 +295,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
}
|
||||
}
|
||||
bool loadingStats = false;
|
||||
|
||||
DateFormat dFormat = DateFormat("yyyy-MM-dd");
|
||||
void LoadStats() async {
|
||||
// return;
|
||||
@@ -482,6 +485,22 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
catsData.add(CatMapData(key.name, value, barCol));
|
||||
});
|
||||
catsData.sort((a, b) => a.time.compareTo(b.time));
|
||||
|
||||
|
||||
//relative TOdos
|
||||
List<String> relativeTodoDays = [];
|
||||
relativeTodos=[];
|
||||
for(int i =0; i < 2; i++){
|
||||
relativeTodoDays.add(dFormat.format(DateTime.now().add(Duration(days: i))));
|
||||
}
|
||||
|
||||
User.todos.forEach((element) {
|
||||
if(relativeTodoDays.contains(dFormat.format(element.dueDate))){
|
||||
//Suitaable
|
||||
relativeTodos.add(element);
|
||||
}
|
||||
});
|
||||
|
||||
//curDay = days[0];
|
||||
if (this.mounted) {
|
||||
setState(() {
|
||||
@@ -642,6 +661,68 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Card(
|
||||
color: Colors.white10,
|
||||
elevation: 20,
|
||||
shadowColor: Colors.black,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Close To-Do',style: TextStyle(fontSize: 16)),
|
||||
MaterialButton(height: 30,
|
||||
color: Colors.green,
|
||||
onPressed: (){
|
||||
Navigator.of(context).pushNamed('/Todos');
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text('More'),
|
||||
Icon(Icons.keyboard_arrow_right)
|
||||
],
|
||||
),
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
LimitedBox(
|
||||
maxHeight: 250,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: relativeTodos.length,
|
||||
itemBuilder: (context, index){
|
||||
return Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black26,
|
||||
borderRadius: BorderRadius.circular(10)
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
FittedBox(child: Text('${relativeTodos[index].task!.name} -> ${relativeTodos[index].metadata}')),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: Colors.blue),
|
||||
child: Text(DateFormat('MM/dd').format(relativeTodos[index].dueDate))
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Card(
|
||||
|
||||
Reference in New Issue
Block a user