Todo basics added
This commit is contained in:
@@ -310,6 +310,60 @@ class Dialogs{
|
||||
}
|
||||
}
|
||||
|
||||
static showJournalLink(DateTime date) async{
|
||||
context=navigatorKey.currentContext;
|
||||
|
||||
if(context!=null) {
|
||||
int journalId = -1;
|
||||
for (int i =0; i < User.journal.length; i++) {
|
||||
print('${User.journal[i].day } : $date');
|
||||
if(DateFormat('yyyy-MM-dd').format(User.journal[i].day) == DateFormat('yyyy-MM-dd').format(date)){
|
||||
journalId = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(journalId < 0){return;}
|
||||
String title= '${(User.journal[journalId].title!= null && User.journal[journalId].title!.isNotEmpty) ? User.journal[journalId].title : DateFormat('MMMM-dd').format(date)}';
|
||||
String description = User.journal[journalId].description ?? '';
|
||||
if(description.length > 60){
|
||||
description = description.substring(0,60) + '...(click more for more)';
|
||||
}
|
||||
return showDialog(
|
||||
context: context!,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
backgroundColor: Color(0xFF1C1C1C),
|
||||
title: Text(title),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(description)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
MaterialButton(
|
||||
onPressed: (){
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('No', style:TextStyle(color: Colors.red)),
|
||||
),
|
||||
MaterialButton(
|
||||
onPressed: (){
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('Yes', style:TextStyle(color: Colors.green)),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
}else{
|
||||
print('context is null');
|
||||
}
|
||||
}
|
||||
|
||||
static hide(){
|
||||
showing=false;
|
||||
Navigator.of(navigatorKey.currentContext!).popUntil((route){
|
||||
|
||||
Reference in New Issue
Block a user