forked from eatvio/eatvio_app
Fixed dialog layout
This commit is contained in:
@@ -11,13 +11,12 @@ import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:math';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
|
||||
class MyProfileScreen extends StatelessWidget {
|
||||
const MyProfileScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
return BlocProvider<MyProfileBloc>(
|
||||
create: (context) =>
|
||||
@@ -28,6 +27,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
mediaQueryData = MediaQuery.of(context);
|
||||
return BlocBuilder<MyProfileBloc, MyProfileState>(
|
||||
builder: (context, state) {
|
||||
return SafeArea(
|
||||
@@ -107,78 +107,67 @@ class MyProfileScreen extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
final digitsOnly =
|
||||
FilteringTextInputFormatter
|
||||
.digitsOnly;
|
||||
return AlertDialog(
|
||||
title: Text("Добавить замер"),
|
||||
content: Column(
|
||||
children: [
|
||||
BlocSelector<
|
||||
MyProfileBloc,
|
||||
MyProfileState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state
|
||||
title: Center(
|
||||
child: Text("Добавить замер")),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Text("chest_circumference".tr,
|
||||
style: theme
|
||||
.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
CustomTextFormField(
|
||||
controller: state
|
||||
.chestCircumferenceController,
|
||||
builder: (context,
|
||||
chestCircumferenceController) {
|
||||
return TextField(
|
||||
controller:
|
||||
chestCircumferenceController,
|
||||
keyboardType:
|
||||
TextInputType
|
||||
.number,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
"chest_circumference"
|
||||
.tr),
|
||||
);
|
||||
}),
|
||||
BlocSelector<
|
||||
MyProfileBloc,
|
||||
MyProfileState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state
|
||||
keyboardType:
|
||||
TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
digitsOnly // Ограничение ввода только цифрами
|
||||
],
|
||||
),
|
||||
SizedBox(height: 15.v),
|
||||
Text("waist_circumference".tr,
|
||||
style: theme
|
||||
.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
CustomTextFormField(
|
||||
controller: state
|
||||
.waistCircumferenceController,
|
||||
builder: (context,
|
||||
waistCircumferenceController) {
|
||||
return TextField(
|
||||
controller:
|
||||
waistCircumferenceController,
|
||||
keyboardType:
|
||||
TextInputType
|
||||
.number,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
"waist_circumference"
|
||||
.tr),
|
||||
);
|
||||
}),
|
||||
BlocSelector<
|
||||
MyProfileBloc,
|
||||
MyProfileState,
|
||||
TextEditingController?>(
|
||||
selector: (state) => state
|
||||
keyboardType:
|
||||
TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
digitsOnly // Ограничение ввода только цифрами
|
||||
],
|
||||
),
|
||||
SizedBox(height: 15.v),
|
||||
Text("hip_circumference".tr,
|
||||
style: theme
|
||||
.textTheme.bodyLarge),
|
||||
SizedBox(height: 5.v),
|
||||
CustomTextFormField(
|
||||
controller: state
|
||||
.hipCircumferenceController,
|
||||
builder: (context,
|
||||
hipCircumferenceController) {
|
||||
return TextField(
|
||||
controller:
|
||||
hipCircumferenceController,
|
||||
keyboardType:
|
||||
TextInputType
|
||||
.number,
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
"hip_circumference"
|
||||
.tr),
|
||||
);
|
||||
}),
|
||||
],
|
||||
keyboardType:
|
||||
TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
digitsOnly // Ограничение ввода только цифрами
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Отмена"),
|
||||
child: Text("Отмена",
|
||||
style: theme
|
||||
.textTheme.bodyLarge),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
@@ -186,9 +175,17 @@ class MyProfileScreen extends StatelessWidget {
|
||||
// Закрытие диалогового окна
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Изменить"),
|
||||
child: Text("Изменить",
|
||||
style: CustomTextStyles
|
||||
.titleMediumBlack
|
||||
.copyWith(
|
||||
color: Colors.blue,
|
||||
)),
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.white,
|
||||
titlePadding: EdgeInsets.all(
|
||||
20.0), // Можете настроить отступы по вашему желанию
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -27,6 +27,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.fillColor,
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.keyboardType,
|
||||
this.onSaved,
|
||||
}) : super(
|
||||
key: key,
|
||||
@@ -74,6 +75,8 @@ class CustomTextFormField extends StatelessWidget {
|
||||
|
||||
final bool? filled;
|
||||
|
||||
final TextInputType? keyboardType;
|
||||
|
||||
final FormFieldValidator<String>? validator;
|
||||
|
||||
final void Function(String?)? onSaved;
|
||||
@@ -97,10 +100,10 @@ class CustomTextFormField extends StatelessWidget {
|
||||
style: textStyle ?? theme.textTheme.titleMedium,
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
keyboardType: textInputType,
|
||||
maxLines: maxLines ?? 1,
|
||||
decoration: decoration,
|
||||
validator: validator,
|
||||
keyboardType: keyboardType,
|
||||
onSaved: onSaved,
|
||||
inputFormatters: inputFormatters,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user