refactor(iOS): Refactoring for iOS bundle

This commit is contained in:
2024-05-02 13:56:39 +03:00
parent 7c30667aec
commit 2b5da83e38
6 changed files with 34 additions and 4 deletions

View File

@@ -26,6 +26,13 @@
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>UserPhotoUpload</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>

View File

@@ -30,7 +30,11 @@ class AuthScreen extends StatelessWidget {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: _buildAppBar(context), appBar: _buildAppBar(context),
body: Container( body:GestureDetector(
onTap: () {
FocusScope.of(context).unfocus(); // Скрыть клавиатуру
},
child: Container(
width: double.maxFinite, width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: Column(children: [ child: Column(children: [
@@ -85,7 +89,7 @@ class AuthScreen extends StatelessWidget {
buttonStyle: CustomButtonStyles.outlinePrimaryTL15, buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapAuth(state, context)); onPressed: onTapAuth(state, context));
}), }),
]))); ]))));
} }
onTapAuth(AuthState state, BuildContext context) { onTapAuth(AuthState state, BuildContext context) {

View File

@@ -38,6 +38,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
on<SendModeration>(_sendModeration); on<SendModeration>(_sendModeration);
on<RefreshEvent>( on<RefreshEvent>(
reloadScreen); //пользователь нажимает "Добавить комментарий" reloadScreen); //пользователь нажимает "Добавить комментарий"
on<ClearInput>(_clearInput);
} }
Future<void> _onInitialize( Future<void> _onInitialize(
@@ -547,6 +548,17 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
} }
} }
FutureOr<void> _clearInput(
ClearInput event, Emitter<DiaryEditState> emit) {
if (state is DiaryEditLoadedState) {
var currentState = state as DiaryEditLoadedState;
DiaryEditLoadedState updatedState = currentState.copyWith(
);
emit(updatedState);
}
}
FutureOr<void> _changePortion( FutureOr<void> _changePortion(
ChangePortion event, Emitter<DiaryEditState> emit) { ChangePortion event, Emitter<DiaryEditState> emit) {
if (state is DiaryEditLoadedState) { if (state is DiaryEditLoadedState) {

View File

@@ -122,6 +122,15 @@ class ChangeMeal extends DiaryEditEvent {
List<Object?> get props => [value, meals]; List<Object?> get props => [value, meals];
} }
class ClearInput extends DiaryEditEvent {
ClearInput({required this.value});
TextEditingController value;
@override
List<Object?> get props => [value];
}
class ChangePortion extends DiaryEditEvent { class ChangePortion extends DiaryEditEvent {
ChangePortion({required this.value}); ChangePortion({required this.value});

View File

@@ -376,7 +376,6 @@ class DiaryEditScreen extends StatelessWidget {
) { ) {
if (state.isAdded) { if (state.isAdded) {
print("Clear"); print("Clear");
productEditingController.clear();
} }
return CustomTextFormField( return CustomTextFormField(
hintText: "Введите название продукта", hintText: "Введите название продукта",

View File

@@ -35,6 +35,5 @@ class AppbarTitleImage extends StatelessWidget {
} }
void onTapCall() { void onTapCall() {
onTap!.call();
} }
} }