some polishings

This commit is contained in:
Sewmina
2022-03-18 01:31:38 +05:30
parent 68c9d1a280
commit 1467b9bd40
3 changed files with 40 additions and 40 deletions

View File

@@ -424,24 +424,22 @@ class _ActivitiesState extends State<Activities> {
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
child: Column( child: Column(
children: [ children: [
Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, children: [
Row(mainAxisSize: MainAxisSize.max,children: [
Text(name + " [$timeSpan]", style: TextStyle(fontSize: 17)), Text(name + " [$timeSpan]", style: TextStyle(fontSize: 17)),
if (containsMetadata) if (containsMetadata)Row(mainAxisAlignment:MainAxisAlignment.start,mainAxisSize: MainAxisSize.max,children: [
Icon( Icon(
Icons.arrow_forward_outlined, Icons.arrow_forward_outlined,
size: 20, size: 20,
), ),
if (containsMetadata)
SizedBox( SizedBox(
width: 150, width: MediaQuery.of(context).size.width/3,
child: Text( child: Text(
activity.metadata ?? '', activity.metadata ?? '',
), ),
), ),
]), ]),
// Icon(Icons.analytics, color: color, size: 20,), // Icon(Icons.analytics, color: color, size: 20,),
]), ]),
SizedBox( SizedBox(

View File

@@ -176,20 +176,6 @@ class _NewProjectState extends State<NewProject> {
) )
]), ]),
)); ));
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) { String _printDuration(Duration duration) {
@@ -207,12 +193,11 @@ class NewProject2 extends StatefulWidget {
@override @override
State<NewProject2> createState() => _NewProject2State(pName: projectName); State<NewProject2> createState() => _NewProject2State(pName: projectName);
} }
bool knowEta = false;
int etaHours = 1;
List<ProjectStep> steps = [];
DateTime deadline = DateTime.now().add(Duration(days: 7));
class _NewProject2State extends State<NewProject2> { class _NewProject2State extends State<NewProject2> {
bool knowEta = false;
int etaHours = 1;
List<ProjectStep> steps = [];
DateTime deadline = DateTime.now().add(Duration(days: 7));
late String? projectName; late String? projectName;
_NewProject2State({String? pName}) { _NewProject2State({String? pName}) {
projectName = pName; projectName = pName;
@@ -222,9 +207,8 @@ class _NewProject2State extends State<NewProject2> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> stepsWidgets = printSteps(); List<Widget> stepsWidgets = printSteps();
int totalHours = 0;
steps.forEach((element) { steps.forEach((element) {
totalHours+=element.eta; etaHours+=element.eta;
}); });
return Scaffold( return Scaffold(
@@ -355,7 +339,7 @@ class _NewProject2State extends State<NewProject2> {
), ),
child: Column( child: Column(
children: [ children: [
Text("Total time : $totalHours Hours"), Text("Total time : $etaHours Hours"),
], ],
), ),
), ),
@@ -674,3 +658,9 @@ class _NewProject2State extends State<NewProject2> {
); );
} }
} }
void OnClickedAdd(){
}

View File

@@ -174,6 +174,7 @@ class _MyHomePageState extends State<MyHomePage> {
await User.refreshUserData(); await User.refreshUserData();
} }
DateTime? lastProductive = null;
@override @override
void dispose() { void dispose() {
// TODO: implement dispose // TODO: implement dispose
@@ -193,6 +194,7 @@ class _MyHomePageState extends State<MyHomePage> {
firstDay = null; firstDay = null;
lastDay = null; lastDay = null;
String lastDate = ""; String lastDate = "";
lastProductive=null;
days = []; days = [];
for (var element in User.activities) { for (var element in User.activities) {
if (lastDay == null) { if (lastDay == null) {
@@ -228,6 +230,7 @@ class _MyHomePageState extends State<MyHomePage> {
} }
if (element.taskType.cat?.productive ?? false) { if (element.taskType.cat?.productive ?? false) {
if(lastProductive==null){lastProductive = element.trueEndTime;}
if (productivtyActs.containsKey(thisDate)) { if (productivtyActs.containsKey(thisDate)) {
productivtyActs[thisDate] = (productivtyActs[thisDate]! + thisMinutes); productivtyActs[thisDate] = (productivtyActs[thisDate]! + thisMinutes);
} else { } else {
@@ -415,7 +418,7 @@ class _MyHomePageState extends State<MyHomePage> {
) )
: Container(), : Container(),
Container( Container(
height: 300, height: 350,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 8, elevation: 8,
@@ -470,7 +473,16 @@ class _MyHomePageState extends State<MyHomePage> {
dataLabelSettings: DataLabelSettings(overflowMode: OverflowMode.hide, showZeroValue: false, isVisible: true), dataLabelSettings: DataLabelSettings(overflowMode: OverflowMode.hide, showZeroValue: false, isVisible: true),
color: Colors.green) color: Colors.green)
]), ]),
) ),
SizedBox(height: 20,),
if(lastProductive!=null && DateTime.now().difference(lastProductive!).inMinutes > 60)RichText(text: TextSpan(
children: <TextSpan>[
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))
]
))
], ],
), ),
)), )),