UI tweaks for Samsung
This commit is contained in:
parent
03382d2cb9
commit
b110ea0cb9
28
.vscode/launch.json
vendored
Normal file
28
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ltx_flutter",
|
||||
"cwd": "ltx_flutter",
|
||||
"request": "launch",
|
||||
"type": "dart"
|
||||
},
|
||||
{
|
||||
"name": "ltx_flutter (profile mode)",
|
||||
"cwd": "ltx_flutter",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "profile"
|
||||
},
|
||||
{
|
||||
"name": "ltx_flutter (release mode)",
|
||||
"cwd": "ltx_flutter",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "release"
|
||||
}
|
||||
]
|
||||
}
|
||||
18
.vscode/tasks.json
vendored
Normal file
18
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "flutter",
|
||||
"command": "flutter",
|
||||
"args": [
|
||||
"build",
|
||||
"apk",
|
||||
"--split-per-abi"
|
||||
],
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"label": "flutter: flutter build apk",
|
||||
"detail": "ltx_flutter"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -159,6 +159,8 @@ class DatabaseAPI extends ChangeNotifier {
|
||||
data: {'hours': hours, 'mood': mood, 'comments': comments},
|
||||
);
|
||||
|
||||
print("Updated $date.");
|
||||
|
||||
_entries.removeAt(entryIndex);
|
||||
_entries.add(newEntry);
|
||||
notifyListeners();
|
||||
@ -173,8 +175,6 @@ class DatabaseAPI extends ChangeNotifier {
|
||||
if (hours.length == index) {
|
||||
hours.add(num.parse(value));
|
||||
} else {
|
||||
print(List.generate(index - hours.length, (i) => -1));
|
||||
|
||||
hours.addAll(List.generate(index - hours.length, (i) => -1));
|
||||
hours.add(num.parse(value));
|
||||
}
|
||||
|
||||
@ -97,6 +97,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
obscureText: true,
|
||||
onSubmitted: (str) => signIn(),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
|
||||
@ -21,7 +21,7 @@ class _DayViewState extends State<DayView> {
|
||||
late CategoriesAPI categories;
|
||||
|
||||
late List<Document> entries = [];
|
||||
late Document? dayEntry = null;
|
||||
late Document? dayEntry;
|
||||
late List<num> hours = [];
|
||||
late num? mood = 0;
|
||||
late String comments = "";
|
||||
@ -59,13 +59,13 @@ class _DayViewState extends State<DayView> {
|
||||
dayEntry = entries.singleWhere((element) => element.$id == formattedDate);
|
||||
String date = formatDate(
|
||||
format: "LLL d", dateISO: dayEntry?.data['date'].toString());
|
||||
print("Got entry for $date");
|
||||
// print("Got entry for $date");
|
||||
} catch (e) {
|
||||
database.getOne(date: formattedDate).then((value) {
|
||||
dayEntry = value;
|
||||
});
|
||||
}
|
||||
print(entries.length);
|
||||
// print(entries.length);
|
||||
|
||||
setState(() {
|
||||
if (dayEntry != null) {
|
||||
@ -110,42 +110,47 @@ class _DayViewState extends State<DayView> {
|
||||
lastDate: DateTime.now().add(Duration(days: 7)),
|
||||
).then((value) => _setDate(value));
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: "Previous day",
|
||||
icon: Icon(Icons.arrow_left),
|
||||
onPressed: () => _incrementDate(-1),
|
||||
),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
),
|
||||
formatDate(
|
||||
format: 'EEEEE, LLLL dd, yyyy',
|
||||
dateISO: _date.toIso8601String()),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: "Previous day",
|
||||
icon: Icon(Icons.arrow_left),
|
||||
onPressed: () => _incrementDate(-1),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: "Next day",
|
||||
icon: Icon(Icons.arrow_right),
|
||||
onPressed: () => _incrementDate(1),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(width: 5),
|
||||
),
|
||||
Text("Edit"),
|
||||
Switch(
|
||||
value: _editable,
|
||||
onChanged: (value) => setState(() {
|
||||
_editable = !_editable;
|
||||
}),
|
||||
),
|
||||
],
|
||||
SizedBox(
|
||||
width: 0.5 * MediaQuery.of(context).size.width,
|
||||
child: Text(
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
),
|
||||
formatDate(
|
||||
format: 'EEEEE, LLLL dd, yyyy',
|
||||
dateISO: _date.toIso8601String()),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: "Next day",
|
||||
icon: Icon(Icons.arrow_right),
|
||||
onPressed: () => _incrementDate(1),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(width: 5),
|
||||
),
|
||||
Text("Edit"),
|
||||
Switch(
|
||||
value: _editable,
|
||||
onChanged: (value) => setState(() {
|
||||
_editable = !_editable;
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -208,28 +213,33 @@ class _DayViewState extends State<DayView> {
|
||||
),
|
||||
SizedBox(width: 30),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(hintText: "Comments"),
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
smartQuotesType: SmartQuotesType.enabled,
|
||||
enableInteractiveSelection: true,
|
||||
controller: commentsController,
|
||||
minLines: 2,
|
||||
maxLines: 4,
|
||||
onFieldSubmitted: (value) {
|
||||
database.updateEntry(
|
||||
dateISO: dayEntry!.data['date'], comments: value);
|
||||
},
|
||||
),
|
||||
child: _editable
|
||||
? TextFormField(
|
||||
decoration: InputDecoration(hintText: "Comments"),
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
smartQuotesType: SmartQuotesType.enabled,
|
||||
enableInteractiveSelection: true,
|
||||
controller: commentsController,
|
||||
minLines: 2,
|
||||
maxLines: 4,
|
||||
onFieldSubmitted: (value) {
|
||||
database.updateEntry(
|
||||
dateISO: dayEntry!.data['date'],
|
||||
comments: value);
|
||||
},
|
||||
)
|
||||
: Text(comments.isEmpty ? "No comments yet." : comments),
|
||||
),
|
||||
SizedBox(width: 30),
|
||||
IconButton(
|
||||
tooltip: "Save",
|
||||
onPressed: () => database.updateEntry(
|
||||
dateISO: dayEntry!.data['date'],
|
||||
comments: commentsController.value.text.toString()),
|
||||
icon: Icon(Icons.save),
|
||||
)
|
||||
_editable
|
||||
? IconButton(
|
||||
tooltip: "Save",
|
||||
onPressed: () => database.updateEntry(
|
||||
dateISO: dayEntry!.data['date'],
|
||||
comments: commentsController.value.text.toString()),
|
||||
icon: Icon(Icons.save),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -460,7 +470,10 @@ class _HourGeneratorState extends State<HourGenerator> {
|
||||
return hourWidgets;
|
||||
}
|
||||
|
||||
return ListView(children: generateHours(widget.dayEntry, widget.editable));
|
||||
return FocusTraversalGroup(
|
||||
child:
|
||||
ListView(children: generateHours(widget.dayEntry, widget.editable)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,6 +499,18 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
String catNum = "";
|
||||
|
||||
String catName = "[Empty]";
|
||||
FocusNode _node = FocusNode();
|
||||
late TextEditingController _controller;
|
||||
@override
|
||||
void initState() {
|
||||
_node.addListener(() {
|
||||
if (_node.hasFocus) {
|
||||
_controller.selection =
|
||||
TextSelection(baseOffset: 0, extentOffset: _controller.text.length);
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -495,6 +520,12 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
catName = widget.category!.name;
|
||||
}
|
||||
|
||||
_controller = TextEditingController.fromValue(
|
||||
TextEditingValue(
|
||||
text: catNum,
|
||||
),
|
||||
);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
@ -505,8 +536,13 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
child: Consumer<DatabaseAPI>(builder: (context, database, child) {
|
||||
return TextFormField(
|
||||
showCursor: false,
|
||||
onFieldSubmitted: (value) {
|
||||
key: Key(
|
||||
"hourField-${widget.dayEntry.$id}-${widget.index.toString()}"),
|
||||
onTap: () {},
|
||||
onEditingComplete: () {
|
||||
String value = _controller.value.text;
|
||||
database.updateHours(widget.dayEntry, widget.index, value);
|
||||
_node.nextFocus();
|
||||
},
|
||||
style: TextStyle(
|
||||
color: fgColor, fontFamily: "Monospace", height: 35),
|
||||
@ -514,8 +550,8 @@ class _HourFormFieldState extends State<HourFormField> {
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false,
|
||||
),
|
||||
controller: TextEditingController.fromValue(
|
||||
TextEditingValue(text: catNum)),
|
||||
controller: _controller,
|
||||
focusNode: _node,
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user