forked from eatvio/eatvio_app
Finish comlipling JSON file from screens
This commit is contained in:
@@ -8,15 +8,19 @@ import 'package:eatvio_app/widgets/next_step_button.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class AdditionalInformationScreen extends StatefulWidget {
|
||||
const AdditionalInformationScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
return BlocProvider<AdditionalInformationBloc>(
|
||||
create: (context) => AdditionalInformationBloc(
|
||||
AdditionalInformationState(
|
||||
additionalInformationModelObj: AdditionalInformationModel()))
|
||||
additionalInformationModelObj:
|
||||
AdditionalInformationModel(userRegistrationSheet: sheet)))
|
||||
..add(AdditionalInformationInitialEvent()),
|
||||
child: AdditionalInformationScreen());
|
||||
}
|
||||
@@ -59,12 +63,23 @@ class _AdditionalInformationScreenState
|
||||
SizedBox(height: 73.v),
|
||||
_buildTextFormField(context),
|
||||
Spacer(),
|
||||
NextStepButton(
|
||||
text: "finish".tr.toUpperCase(),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
showSuccessMessage(context);
|
||||
}),
|
||||
BlocBuilder<AdditionalInformationBloc,
|
||||
AdditionalInformationState>(builder: (context, state) {
|
||||
return NextStepButton(
|
||||
text: "finish".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () {
|
||||
var message;
|
||||
UserRegistrationSheet sheet = state
|
||||
.additionalInformationModelObj!
|
||||
.userRegistrationSheet;
|
||||
sheet.additionalInfo = state.editTextController!.text;
|
||||
message = sheet.toJson();
|
||||
print(message);
|
||||
});
|
||||
}),
|
||||
SizedBox(height: 17.v),
|
||||
]))));
|
||||
}
|
||||
@@ -120,13 +135,12 @@ class _AdditionalInformationScreenState
|
||||
|
||||
/// Displays an alert dialog when the action is triggered.
|
||||
/// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения`
|
||||
showSuccessMessage(BuildContext context) {
|
||||
showSuccessMessage(BuildContext context, String text) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Регистрация завершена!'),
|
||||
content: const Text(
|
||||
'Теперь вы можете пользоваться полным функционалом приложения'),
|
||||
content: const Text(text),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
// ignore_for_file: must_be_immutable
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
||||
|
||||
/// This class defines the variables used in the [additional_information_screen],
|
||||
/// and is typically used to hold data that is passed between different parts of the application.
|
||||
class AdditionalInformationModel extends Equatable {
|
||||
AdditionalInformationModel();
|
||||
UserRegistrationSheet userRegistrationSheet;
|
||||
AdditionalInformationModel({required this.userRegistrationSheet});
|
||||
|
||||
AdditionalInformationModel copyWith() {
|
||||
return AdditionalInformationModel();
|
||||
return AdditionalInformationModel(
|
||||
userRegistrationSheet:
|
||||
userRegistrationSheet ?? this.userRegistrationSheet,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
List<Object?> get props => [userRegistrationSheet];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user