rollback to material + app usage init

This commit is contained in:
2023-01-27 18:50:44 +05:30
parent fd60fca746
commit ecb59d8b52
8 changed files with 1915 additions and 992 deletions

View File

@@ -11,20 +11,20 @@ class BehaviourSettings extends StatefulWidget {
}
class _BehaviourSettingsState extends State<BehaviourSettings> {
bool untracked_unprod = true;
bool autoUsage = true;
@override void initState() {
@override
void initState() {
// TODO: implement initState
super.initState();
init();
}
void init() async{
untracked_unprod=await Settings.getUntrackedUnproductive();
setState(() {
});
void init() async {
untracked_unprod = await Settings.getUntrackedUnproductive();
autoUsage = await Settings.getAutoLog();
setState(() {});
}
TextEditingController untrackedGapSettings = TextEditingController();
@@ -36,65 +36,77 @@ class _BehaviourSettingsState extends State<BehaviourSettings> {
appBar: AppBar(title: Text('Behaviour Settings')),
body: SafeArea(
child: Container(
child:Column(
children: [
ListTile(
title:Text("Count untracked time as unproductive"),
subtitle: Text("Not tracking = Not productive"),
trailing: Switch.adaptive(value: untracked_unprod, onChanged: (val){
untracked_unprod=val;
setState(() {
Settings.setUntrackedUnproductive(val);
});
setState(() {
});
}),
),
//TODO
ListTile(
title:Text("Untracked Delay Threshold"),
subtitle: Text("Makes it easier to fill in the gaps"),
trailing:
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
if(untrackedGapValue> 0)InkWell(onTap: (){
untrackedGapSettings.text = (untrackedGapValue-1).toString();
setState(() {
});
},
child : Container(margin: EdgeInsets.all(10),child: Text('-')),),
SizedBox(
width: 25,
height: 30,
child: TextField(
textAlign: TextAlign.center,
controller: untrackedGapSettings,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],),
child: Column(
children: [
ListTile(
title: Text("Count untracked time as unproductive"),
subtitle: Text("Not tracking = Not productive"),
trailing: Switch.adaptive(
value: untracked_unprod,
onChanged: (val) {
untracked_unprod = val;
setState(() {
Settings.setUntrackedUnproductive(val);
});
setState(() {});
}),
),
//TODO
ListTile(
title: Text("Untracked Delay Threshold"),
subtitle: Text("Makes it easier to fill in the gaps"),
trailing: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
if (untrackedGapValue > 0)
InkWell(
onTap: () {
untrackedGapSettings.text =
(untrackedGapValue - 1).toString();
setState(() {});
},
child: Container(
margin: EdgeInsets.all(10), child: Text('-')),
),
InkWell(onTap: (){
untrackedGapSettings.text = (untrackedGapValue+1).toString();
setState(() {
});
SizedBox(
width: 25,
height: 30,
child: TextField(
textAlign: TextAlign.center,
controller: untrackedGapSettings,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],
),
),
InkWell(
onTap: () {
untrackedGapSettings.text =
(untrackedGapValue + 1).toString();
setState(() {});
},
child: Container(margin:EdgeInsets.all(10),child: Text('+')),
child: Container(
margin: EdgeInsets.all(10), child: Text('+')),
)
],
),
)
],
),
),
ListTile(
title: Text("Automatically add tasks from Usage Data"),
subtitle: Text("Requires App Usage access"),
trailing: Switch.adaptive(
value: autoUsage,
onChanged: (val) {
autoUsage = val;
Settings.setAutoLog(val);
],
)
),
)
);
setState(() {});
}),
),
],
)),
));
}
}
}