1
1
// ignore_for_file: deprecated_member_use, use_build_context_synchronously
2
-
3
- import 'package:date_format/date_format.dart' ;
4
2
import 'package:flutter/material.dart' ;
5
3
import 'package:google_fonts/google_fonts.dart' ;
6
4
import 'package:intl/intl.dart' ;
7
- import 'package:taskwarrior/api_service.dart' ;
8
5
import 'package:taskwarrior/app/utils/app_settings/app_settings.dart' ;
9
6
import 'package:taskwarrior/app/utils/constants/taskwarrior_colors.dart' ;
10
7
import 'package:taskwarrior/app/utils/constants/utilites.dart' ;
11
8
import 'package:taskwarrior/app/utils/themes/theme_extension.dart' ;
12
9
import 'package:taskwarrior/app/utils/language/sentence_manager.dart' ;
10
+ import 'package:taskwarrior/app/v3/db/task_database.dart' ;
11
+ import 'package:taskwarrior/app/v3/models/task.dart' ;
12
+ import 'package:taskwarrior/app/v3/net/modify.dart' ;
13
13
14
14
class TaskDetails extends StatefulWidget {
15
- final Tasks task;
15
+ final TaskForC task;
16
16
const TaskDetails ({super .key, required this .task});
17
17
18
18
@override
@@ -53,7 +53,8 @@ class _TaskDetailsState extends State<TaskDetails> {
53
53
54
54
@override
55
55
Widget build (BuildContext context) {
56
- TaskwarriorColorTheme tColors = Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
56
+ TaskwarriorColorTheme tColors =
57
+ Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
57
58
return WillPopScope (
58
59
onWillPop: () async {
59
60
if (hasChanges) {
@@ -123,10 +124,18 @@ class _TaskDetailsState extends State<TaskDetails> {
123
124
});
124
125
}),
125
126
_buildDetail ('UUID:' , widget.task.uuid! ),
126
- _buildDetail ('${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageUrgency }:' , widget.task.urgency.toString ()),
127
- _buildDetail ('${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageEnd }:' , _buildDate (widget.task.end)),
128
- _buildDetail ('${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageEntry }:' , _buildDate (widget.task.entry)),
129
- _buildDetail ('${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageModified }:' , _buildDate (widget.task.modified)),
127
+ _buildDetail (
128
+ '${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageUrgency }:' ,
129
+ widget.task.urgency.toString ()),
130
+ _buildDetail (
131
+ '${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageEnd }:' ,
132
+ _buildDate (widget.task.end)),
133
+ _buildDetail (
134
+ '${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageEntry }:' ,
135
+ _buildDate (widget.task.entry)),
136
+ _buildDetail (
137
+ '${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .detailPageModified }:' ,
138
+ _buildDate (widget.task.modified)),
130
139
],
131
140
),
132
141
),
@@ -206,7 +215,8 @@ class _TaskDetailsState extends State<TaskDetails> {
206
215
}
207
216
208
217
Widget _buildDetail (String label, String value) {
209
- TaskwarriorColorTheme tColors = Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
218
+ TaskwarriorColorTheme tColors =
219
+ Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
210
220
return Container (
211
221
width: double .infinity,
212
222
decoration: BoxDecoration (
@@ -251,7 +261,8 @@ class _TaskDetailsState extends State<TaskDetails> {
251
261
252
262
Future <String ?> _showEditDialog (
253
263
BuildContext context, String label, String initialValue) async {
254
- TaskwarriorColorTheme tColors = Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
264
+ TaskwarriorColorTheme tColors =
265
+ Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
255
266
final TextEditingController controller =
256
267
TextEditingController (text: initialValue);
257
268
return await showDialog <String >(
@@ -260,21 +271,15 @@ class _TaskDetailsState extends State<TaskDetails> {
260
271
return Utils .showAlertDialog (
261
272
title: Text (
262
273
'${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .edit } $label ' ,
263
- style: TextStyle (
264
- color: tColors.primaryTextColor
265
- ),
274
+ style: TextStyle (color: tColors.primaryTextColor),
266
275
),
267
276
content: TextField (
268
- style: TextStyle (
269
- color: tColors.primaryTextColor
270
- ),
277
+ style: TextStyle (color: tColors.primaryTextColor),
271
278
controller: controller,
272
279
decoration: InputDecoration (
273
280
hintText:
274
281
'${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .enterNew } $label ' ,
275
- hintStyle: TextStyle (
276
- color: tColors.primaryTextColor
277
- ),
282
+ hintStyle: TextStyle (color: tColors.primaryTextColor),
278
283
),
279
284
),
280
285
actions: [
@@ -286,9 +291,7 @@ class _TaskDetailsState extends State<TaskDetails> {
286
291
SentenceManager (currentLanguage: AppSettings .selectedLanguage)
287
292
.sentences
288
293
.cancel,
289
- style: TextStyle (
290
- color: tColors.primaryTextColor
291
- ),
294
+ style: TextStyle (color: tColors.primaryTextColor),
292
295
),
293
296
),
294
297
TextButton (
@@ -299,9 +302,7 @@ class _TaskDetailsState extends State<TaskDetails> {
299
302
SentenceManager (currentLanguage: AppSettings .selectedLanguage)
300
303
.sentences
301
304
.save,
302
- style: TextStyle (
303
- color: tColors.primaryTextColor
304
- ),
305
+ style: TextStyle (color: tColors.primaryTextColor),
305
306
),
306
307
),
307
308
],
@@ -312,26 +313,23 @@ class _TaskDetailsState extends State<TaskDetails> {
312
313
313
314
Future <String ?> _showSelectDialog (BuildContext context, String label,
314
315
String initialValue, List <String > options) async {
315
- TaskwarriorColorTheme tColors = Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
316
+ TaskwarriorColorTheme tColors =
317
+ Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
316
318
return await showDialog <String >(
317
319
context: context,
318
320
builder: (context) {
319
321
return Utils .showAlertDialog (
320
322
title: Text (
321
323
'${SentenceManager (currentLanguage : AppSettings .selectedLanguage ).sentences .select } $label ' ,
322
- style: TextStyle (
323
- color: tColors.primaryTextColor
324
- ),
324
+ style: TextStyle (color: tColors.primaryTextColor),
325
325
),
326
326
content: Column (
327
327
mainAxisSize: MainAxisSize .min,
328
328
children: options.map ((option) {
329
329
return RadioListTile <String >(
330
330
title: Text (
331
331
option,
332
- style: TextStyle (
333
- color: tColors.primaryTextColor
334
- ),
332
+ style: TextStyle (color: tColors.primaryTextColor),
335
333
),
336
334
value: option,
337
335
groupValue: initialValue,
@@ -362,7 +360,8 @@ class _TaskDetailsState extends State<TaskDetails> {
362
360
363
361
Future <UnsavedChangesAction ?> _showUnsavedChangesDialog (
364
362
BuildContext context) async {
365
- TaskwarriorColorTheme tColors = Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
363
+ TaskwarriorColorTheme tColors =
364
+ Theme .of (context).extension < TaskwarriorColorTheme > ()! ;
366
365
return showDialog <UnsavedChangesAction >(
367
366
context: context,
368
367
barrierDismissible: false ,
@@ -372,16 +371,13 @@ class _TaskDetailsState extends State<TaskDetails> {
372
371
SentenceManager (currentLanguage: AppSettings .selectedLanguage)
373
372
.sentences
374
373
.unsavedChanges,
375
- style: TextStyle (
376
- color: tColors.primaryTextColor),
374
+ style: TextStyle (color: tColors.primaryTextColor),
377
375
),
378
376
content: Text (
379
377
SentenceManager (currentLanguage: AppSettings .selectedLanguage)
380
378
.sentences
381
379
.unsavedChangesWarning,
382
- style: TextStyle (
383
- color: tColors.primaryTextColor
384
- ),
380
+ style: TextStyle (color: tColors.primaryTextColor),
385
381
),
386
382
actions: < Widget > [
387
383
TextButton (
0 commit comments