Hourglass improved + projects delete

This commit is contained in:
Sewmina
2022-03-23 19:30:32 +05:30
parent aa72b5dc92
commit 9f976b1e33
7 changed files with 145 additions and 44 deletions

View File

@@ -13,10 +13,16 @@ DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat durationFormat = DateFormat("HH:mm:ss");
class NewProject extends StatefulWidget {
const NewProject({Key? key}) : super(key: key);
NewProject({Key? key,this.multiline,this.projectName,this.selectedCategory, this.m_steps}) : super(key: key);
late bool? multiline;
late String? projectName;
late String? selectedCategory;
late List<ProjectStep>? m_steps;
late int? m_eta;
@override
_NewProjectState createState() => _NewProjectState();
_NewProjectState createState() => _NewProjectState(multiline: multiline, pname: projectName, selectedCategory: selectedCategory, m_steps: m_steps);
}
List<String> getCategoryNames() {
@@ -27,11 +33,22 @@ List<String> getCategoryNames() {
});
return _cats;
}
bool editing = false;
bool multiLine = true;
String selectedCat = User.categories[0].name;
class _NewProjectState extends State<NewProject> {
_NewProjectState({bool? multiline, String? pname, String? selectedCategory, List<ProjectStep>? m_steps, int? m_eta}){
multiLine=multiline ?? true;
nameController.text = pname ?? '';
if(selectedCategory!=null){selectedCat = selectedCategory;}
if(m_steps!=null){steps=m_steps;}else{print('no steps?');}
if(multiline!=null && pname != null && selectedCategory != null && m_steps!=null){
editing=true;
}
}
TextEditingController nameController = TextEditingController();
bool productive = true;
Color pickerColor = Colors.blue;
@@ -664,7 +681,11 @@ class _NewProject2State extends State<NewProject2> {
void OnClickAdd() async{
if(projectName==null || deadline.isBefore(DateTime.now())){showAlertDialog(context, 'Error', 'Please make sure you have entered correct information'); return;}
User.UserOperations.addProject(projectName!, selectedCat, steps, deadline);
User.UserOperations.addProject(projectName!, selectedCat, steps,etaHours, deadline);
Navigator.of(navigatorKey.currentContext!).popUntil((route){
return route.isFirst;
});
}
}