Skip to content

Commit

Permalink
fixed bug with edditing task
Browse files Browse the repository at this point in the history
  • Loading branch information
medvalna committed Jul 7, 2023
1 parent 4025efd commit b43f88c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/ui/pages/add_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ import '../../models/todo.dart';
*
* */

/*
* TODO: исправить баг с демонстрацией выбора важности в dropdown widget
*
* */
class AddScreen extends StatefulWidget {
const AddScreen({super.key, required this.editing, required this.item});

Expand All @@ -31,8 +27,14 @@ class AddScreen extends StatefulWidget {
class _AddScreenState extends State<AddScreen> {
final TextEditingController _controller = TextEditingController();
bool _getDate = false;
late String dropdownValue = AppLocalizations.of(context).no;
String date = "";
late String dropdownValue = !widget.editing
? AppLocalizations.of(context).no
: widget.item?.importance == 0
? AppLocalizations.of(context).no
: widget.item?.importance == 1
? AppLocalizations.of(context).low
: AppLocalizations.of(context).high;
late String? date = !widget.editing ? "" : widget.item?.date;
int importance = 0;

@override
Expand Down Expand Up @@ -118,15 +120,15 @@ class _AddScreenState extends State<AddScreen> {
context.read<TileListBloc>().add(ChangeTile(
item: widget.item!,
text: _controller.text,
date: date,
date: date!,
importance: importance)),
_onGoBack(),
}
else
{
context.read<TileListBloc>().add(AddTile(
text: _controller.text,
date: date,
date: date!,
importance: importance)),
_onGoBack(),
}
Expand Down Expand Up @@ -232,7 +234,7 @@ class _AddScreenState extends State<AddScreen> {
color: mainText, fontSize: body),
),
Text(
date,
date!,
style:
const TextStyle(color: add, fontSize: subhead),
),
Expand Down

0 comments on commit b43f88c

Please sign in to comment.