forked from eatvio/eatvio_app
feat(diet): add diet editing
This commit is contained in:
@@ -11,7 +11,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
class StatusDropDownWidget extends StatefulWidget {
|
||||
const StatusDropDownWidget({super.key});
|
||||
final DietState? dietState;
|
||||
|
||||
const StatusDropDownWidget({super.key, this.dietState});
|
||||
|
||||
@override
|
||||
State<StatusDropDownWidget> createState() => _StatusDropDownWidgetState();
|
||||
@@ -19,6 +21,7 @@ class StatusDropDownWidget extends StatefulWidget {
|
||||
|
||||
class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
|
||||
final List<String> dietStateTitles = [];
|
||||
String? currentState;
|
||||
// late final List<DietState> dietStates = DietState.values;
|
||||
|
||||
@override
|
||||
@@ -39,6 +42,13 @@ class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (widget.dietState != null) {
|
||||
if (widget.dietState == DietState.active) {
|
||||
currentState = dietStateTitles[0];
|
||||
} else if (widget.dietState == DietState.personal) {
|
||||
currentState = dietStateTitles[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -77,7 +87,7 @@ class _StatusDropDownWidgetState extends State<StatusDropDownWidget> {
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
value: state.dietState == DietState.active ? dietStateTitles[0] : state.dietState == DietState.personal ? dietStateTitles[1] : null,
|
||||
value: currentState,
|
||||
),
|
||||
if (state.dietStateError != null) ...[
|
||||
const SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user