New screen names

This commit is contained in:
2023-12-18 14:47:54 +03:00
parent 402f1ff5a4
commit 2a89da4ea7
181 changed files with 6105 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import '/core/app_export.dart';
import 'package:eatvio_app/presentation/weight_screen/models/weight_model.dart';
part 'weight_event.dart';
part 'weight_state.dart';
/// A bloc that manages the state of a Weight according to the event that is dispatched to it.
class WeightBloc extends Bloc<WeightEvent, WeightState> {
WeightBloc(WeightState initialState) : super(initialState) {
on<WeightInitialEvent>(_onInitialize);
on<ChangeDropDownEvent>(_changeDropDown);
}
_onInitialize(
WeightInitialEvent event,
Emitter<WeightState> emit,
) async {
emit(state.copyWith(
weightModelObj: state.weightModelObj
?.copyWith(dropdownItemList: fillDropdownItemList())));
}
_changeDropDown(
ChangeDropDownEvent event,
Emitter<WeightState> emit,
) {
emit(state.copyWith(selectedDropDownValue: event.value));
}
List<SelectionPopupModel> fillDropdownItemList() {
return [
SelectionPopupModel(id: 1, title: "Item One", isSelected: true),
SelectionPopupModel(id: 2, title: "Item Two"),
SelectionPopupModel(id: 3, title: "Item Three")
];
}
}

View File

@@ -0,0 +1,28 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Abstract class for all events that can be dispatched from the
///Weight widget.
///
/// Events must be immutable and implement the [Equatable] interface.
@immutable
abstract class WeightEvent extends Equatable {}
/// Event that is dispatched when the Weight widget is first created.
class WeightInitialEvent extends WeightEvent {
@override
List<Object?> get props => [];
}
///event for dropdown selection
class ChangeDropDownEvent extends WeightEvent {
ChangeDropDownEvent({required this.value});
SelectionPopupModel value;
@override
List<Object?> get props => [
value,
];
}

View File

@@ -0,0 +1,31 @@
// ignore_for_file: must_be_immutable
part of 'weight_bloc.dart';
/// Represents the state of Weight in the application.
class WeightState extends Equatable {
WeightState({
this.selectedDropDownValue,
this.weightModelObj,
});
SelectionPopupModel? selectedDropDownValue;
WeightModel? weightModelObj;
@override
List<Object?> get props => [
selectedDropDownValue,
weightModelObj,
];
WeightState copyWith({
SelectionPopupModel? selectedDropDownValue,
WeightModel? weightModelObj,
}) {
return WeightState(
selectedDropDownValue:
selectedDropDownValue ?? this.selectedDropDownValue,
weightModelObj: weightModelObj ?? this.weightModelObj,
);
}
}