From 1467b9bd40f4e8c3ccf3a319130eb26bc39cfb6c Mon Sep 17 00:00:00 2001 From: Sewmina Date: Fri, 18 Mar 2022 01:31:38 +0530 Subject: [PATCH] some polishings --- lib/Activities.dart | 30 ++++++++++++++---------------- lib/NewProject.dart | 34 ++++++++++++---------------------- lib/main.dart | 16 ++++++++++++++-- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/Activities.dart b/lib/Activities.dart index 0642e73..12561d0 100644 --- a/lib/Activities.dart +++ b/lib/Activities.dart @@ -424,24 +424,22 @@ class _ActivitiesState extends State { padding: EdgeInsets.all(15), child: Column( children: [ - Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row(mainAxisSize: MainAxisSize.max,children: [ - Text(name + " [$timeSpan]", style: TextStyle(fontSize: 17)), - if (containsMetadata) - Icon( - Icons.arrow_forward_outlined, - size: 20, - ), - if (containsMetadata) - SizedBox( - width: 150, - child: Text( - activity.metadata ?? '', - ), - ), + Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, children: [ + Text(name + " [$timeSpan]", style: TextStyle(fontSize: 17)), + if (containsMetadata)Row(mainAxisAlignment:MainAxisAlignment.start,mainAxisSize: MainAxisSize.max,children: [ - ]), + Icon( + Icons.arrow_forward_outlined, + size: 20, + ), + SizedBox( + width: MediaQuery.of(context).size.width/3, + child: Text( + activity.metadata ?? '', + ), + ), + ]), // Icon(Icons.analytics, color: color, size: 20,), ]), SizedBox( diff --git a/lib/NewProject.dart b/lib/NewProject.dart index 4136e02..121949d 100644 --- a/lib/NewProject.dart +++ b/lib/NewProject.dart @@ -176,20 +176,6 @@ class _NewProjectState extends State { ) ]), )); - - void add_action() async { - String catName = nameController.value.text; - - if (catName.length < 2) { - Dialogs.showAlertDialog(context, 'Category needs a name', 'Please enter a name for this category'); - return; - } - var hex = '#${pickerColor.value.toRadixString(16)}'; - await User.UserOperations.addCategory(catName, hex, productive); - Navigator.of(context).popUntil((route) { - return route.isFirst; - }); - } } String _printDuration(Duration duration) { @@ -207,12 +193,11 @@ class NewProject2 extends StatefulWidget { @override State createState() => _NewProject2State(pName: projectName); } - +bool knowEta = false; +int etaHours = 1; +List steps = []; +DateTime deadline = DateTime.now().add(Duration(days: 7)); class _NewProject2State extends State { - bool knowEta = false; - int etaHours = 1; - List steps = []; - DateTime deadline = DateTime.now().add(Duration(days: 7)); late String? projectName; _NewProject2State({String? pName}) { projectName = pName; @@ -222,9 +207,8 @@ class _NewProject2State extends State { Widget build(BuildContext context) { List stepsWidgets = printSteps(); - int totalHours = 0; steps.forEach((element) { - totalHours+=element.eta; + etaHours+=element.eta; }); return Scaffold( @@ -355,7 +339,7 @@ class _NewProject2State extends State { ), child: Column( children: [ - Text("Total time : $totalHours Hours"), + Text("Total time : $etaHours Hours"), ], ), ), @@ -674,3 +658,9 @@ class _NewProject2State extends State { ); } } + + + +void OnClickedAdd(){ + +} diff --git a/lib/main.dart b/lib/main.dart index 06c1d8e..b7d92ed 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -174,6 +174,7 @@ class _MyHomePageState extends State { await User.refreshUserData(); } + DateTime? lastProductive = null; @override void dispose() { // TODO: implement dispose @@ -193,6 +194,7 @@ class _MyHomePageState extends State { firstDay = null; lastDay = null; String lastDate = ""; + lastProductive=null; days = []; for (var element in User.activities) { if (lastDay == null) { @@ -228,6 +230,7 @@ class _MyHomePageState extends State { } if (element.taskType.cat?.productive ?? false) { + if(lastProductive==null){lastProductive = element.trueEndTime;} if (productivtyActs.containsKey(thisDate)) { productivtyActs[thisDate] = (productivtyActs[thisDate]! + thisMinutes); } else { @@ -415,7 +418,7 @@ class _MyHomePageState extends State { ) : Container(), Container( - height: 300, + height: 350, padding: EdgeInsets.all(10), child: Card( elevation: 8, @@ -470,7 +473,16 @@ class _MyHomePageState extends State { dataLabelSettings: DataLabelSettings(overflowMode: OverflowMode.hide, showZeroValue: false, isVisible: true), color: Colors.green) ]), - ) + ), + SizedBox(height: 20,), + if(lastProductive!=null && DateTime.now().difference(lastProductive!).inMinutes > 60)RichText(text: TextSpan( + children: [ + TextSpan(text: "You haven't been productive in last",style: TextStyle(color:Colors.orange)), + TextSpan(text:" ${MinutesToTimeString(DateTime.now().difference(lastProductive!).inMinutes)}",style: TextStyle(color:Colors.redAccent,fontWeight: FontWeight.bold)) + ] + )) + + ], ), )),