fix: remove old unused features and widgets

This commit is contained in:
mso7nueh
2024-11-20 14:20:15 +03:00
parent 63dc72bd7a
commit 537ced583e
24 changed files with 29 additions and 596 deletions

View File

@@ -5,7 +5,6 @@ import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/image_constant.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -45,7 +44,11 @@ class _AuthScreenState extends State<AuthScreen> {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
title: Image.asset(
ImageConstant.imgLogoEatvio,
height: 48,
fit: BoxFit.contain,
),
),
body: SafeArea(
child: Padding(

View File

@@ -8,7 +8,6 @@ import 'package:eatvio_app/features/consultant/become_consultant/presentation/pa
import 'package:eatvio_app/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@@ -215,7 +214,11 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
title: Image.asset(
ImageConstant.imgLogoEatvio,
height: 48,
fit: BoxFit.contain,
),
actions: [
Padding(
padding: const EdgeInsets.only(right: 16),

View File

@@ -1,4 +1,4 @@
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
import 'package:eatvio_app/features/recipes/presentation/bloc/recipe_create_state.dart';

View File

@@ -1,12 +1,10 @@
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/recipes/models/recipe_model.dart';
import 'package:eatvio_app/features/recipes/models/ingredient.dart';
import 'package:eatvio_app/features/recipes/models/product.dart';
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:image_picker/image_picker.dart';
import '../../../../data/models/selectionPopupModel/selection_popup_model.dart';
part 'recipe_create_state.freezed.dart';
@freezed

View File

@@ -1,10 +1,9 @@
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/utils/image_constant.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/registration/models/user_registration_model.dart';
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/widgets/custom_drop_down.dart';
import 'package:eatvio_app/widgets/custom_image_view.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -93,8 +92,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
child: Image.asset(
ImageConstant.imgFavorite,
height: 16,
width: 16,
),
@@ -119,8 +118,8 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
),
child: CustomImageView(
imagePath: ImageConstant.imgFavorite,
child: Image.asset(
ImageConstant.imgFavorite,
height: 16,
width: 16,
),

View File

@@ -1,4 +1,4 @@
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/registration/models/user_registration_model.dart';
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/theme/theme_helper.dart';

View File

@@ -1,4 +1,4 @@
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/registration/models/user_registration_model.dart';
import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart';
import 'package:eatvio_app/generated/l10n.dart';

View File

@@ -19,11 +19,10 @@ import 'package:eatvio_app/features/registration/presentation/pages/weight_scree
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/locator_service.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'package:rive/rive.dart' as rive;
import 'package:validators/validators.dart';
class RegistrationScreen extends StatefulWidget {
@@ -116,7 +115,11 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
),
),
centerTitle: true,
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio),
title: Image.asset(
ImageConstant.imgLogoEatvio,
height: 48,
fit: BoxFit.contain,
),
actions: [
Padding(
padding: const EdgeInsets.only(right: 16),
@@ -322,7 +325,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
child: SizedBox(
height: 32,
width: 32,
child: RiveAnimation.asset(
child: rive.RiveAnimation.asset(
'assets/rive_animations/loading.riv',
),
),

View File

@@ -1,5 +1,5 @@
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/utils/date_time_utils.dart';
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
import 'package:eatvio_app/generated/l10n.dart';

View File

@@ -1,4 +1,4 @@
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_state.dart';
import 'package:eatvio_app/generated/l10n.dart';

View File

@@ -1,34 +0,0 @@
import 'package:eatvio_app/widgets/custom_image_view.dart';
import 'package:flutter/material.dart';
class AppbarLeadingImage extends StatelessWidget {
const AppbarLeadingImage({
this.imagePath,
this.margin,
this.onTap,
});
final String? imagePath;
final EdgeInsetsGeometry? margin;
final Function? onTap;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTapCall,
child: Padding(
padding: margin ?? EdgeInsets.zero,
child: CustomImageView(
imagePath: imagePath,
height: 26,
width: 13,
fit: BoxFit.contain,
),
),
);
}
void onTapCall() {
onTap!.call();
}
}

View File

@@ -1,30 +0,0 @@
import 'package:eatvio_app/theme/custom_text_style.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class AppbarSubtitle extends StatelessWidget {
const AppbarSubtitle({
required this.text,
this.margin,
this.onTap,
});
final String text;
final EdgeInsetsGeometry? margin;
final Function? onTap;
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Padding(
padding: margin ?? EdgeInsets.zero,
child: Text(
text,
style: CustomTextStyles.titleMediumBlack.copyWith(
color: appTheme.black900,
),
),
),
);
}
}

View File

@@ -1,17 +0,0 @@
import 'package:eatvio_app/widgets/custom_image_view.dart';
import 'package:flutter/material.dart';
class AppbarTitleImage extends StatelessWidget {
const AppbarTitleImage({required this.imagePath, super.key});
final String? imagePath;
@override
Widget build(BuildContext context) {
return CustomImageView(
imagePath: imagePath,
height: 48,
fit: BoxFit.contain,
);
}
}

View File

@@ -1,39 +0,0 @@
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
CustomAppBar({
Key? key,
this.height,
this.leadingWidth,
this.leading,
this.title,
this.centerTitle,
this.actions,
}) : super(key: key);
final double? height;
final double? leadingWidth;
final Widget? leading;
final Widget? title;
final bool? centerTitle;
final List<Widget>? actions;
@override
Widget build(BuildContext context) {
return AppBar(
toolbarHeight: height ?? 56,
automaticallyImplyLeading: false,
backgroundColor: Colors.transparent,
leadingWidth: leadingWidth ?? 0,
leading: leading,
title: title,
titleSpacing: 0,
centerTitle: centerTitle ?? false,
actions: actions,
);
}
@override
Size get preferredSize => Size(double.infinity, height ?? 56);
}

View File

@@ -1,58 +0,0 @@
import 'package:flutter/material.dart';
class AboutList extends StatefulWidget {
final String title;
final List<String> items;
AboutList(this.title, this.items);
@override
_AboutListState createState() => _AboutListState();
}
class _AboutListState extends State<AboutList> {
bool isExpanded = false;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
GestureDetector(
onTap: toggleList(),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.title,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down),
],
),
),
if (isExpanded)
Padding(
padding: const EdgeInsets.only(left: 16.0),
child: Column(
//children: widget.items.map((item) => Text(item)).toList(),
children: [Text(widget.items.join('\n'))],
),
),
Divider(),
],
);
}
toggleList() {
return () {
setState(() {
isExpanded = !isExpanded;
});
};
}
}

View File

@@ -1,4 +1,4 @@
import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart';
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:flutter/material.dart';
class CustomDropDown extends StatelessWidget {

View File

@@ -1,162 +0,0 @@
// ignore_for_file: must_be_immutable
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class CustomImageView extends StatelessWidget {
///[imagePath] is required parameter for showing image
String? imagePath;
double? height;
double? width;
Color? color;
BoxFit? fit;
final String placeHolder;
Alignment? alignment;
VoidCallback? onTap;
EdgeInsetsGeometry? margin;
BorderRadius? radius;
BoxBorder? border;
///a [CustomImageView] it can be used for showing any type of images
/// it will shows the placeholder image if image is not found on network image
CustomImageView({
this.imagePath,
this.height,
this.width,
this.color,
this.fit,
this.alignment,
this.onTap,
this.radius,
this.margin,
this.border,
this.placeHolder = 'assets/images/image_not_found.png',
});
@override
Widget build(BuildContext context) {
return alignment != null
? Align(
alignment: alignment!,
child: Padding(
padding: margin ?? EdgeInsets.zero,
child: InkWell(
onTap: onTap,
child: _buildCircleImage(),
),
),
)
: Padding(
padding: margin ?? EdgeInsets.zero,
child: InkWell(
onTap: onTap,
child: _buildCircleImage(),
),
);
}
///build the image with border radius
_buildCircleImage() {
if (radius != null) {
return ClipRRect(
borderRadius: radius ?? BorderRadius.zero,
child: _buildImageWithBorder(),
);
} else {
return _buildImageWithBorder();
}
}
///build the image with border and border radius style
_buildImageWithBorder() {
if (border != null) {
return Container(
decoration: BoxDecoration(
border: border,
borderRadius: radius,
),
child: _buildImageView(),
);
} else {
return _buildImageView();
}
}
_buildImageView() {
if (imagePath != null) {
switch (imagePath!.imageType) {
case ImageType.svg:
return Container(
height: height,
width: width,
child: SvgPicture.asset(
imagePath!,
height: height,
width: width,
fit: fit ?? BoxFit.contain,
),
);
case ImageType.file:
return Image.file(
File(imagePath!),
height: height,
width: width,
fit: fit ?? BoxFit.cover,
color: color,
);
case ImageType.network:
return CachedNetworkImage(
height: height,
width: width,
fit: fit,
imageUrl: imagePath!,
color: color,
placeholder: (context, url) => Container(
height: 30,
width: 30,
child: LinearProgressIndicator(
color: Colors.grey.shade200,
backgroundColor: Colors.grey.shade100,
),
),
errorWidget: (context, url, error) => Image.asset(
placeHolder,
height: height,
width: width,
fit: fit ?? BoxFit.cover,
),
);
case ImageType.png:
default:
return Image.asset(
imagePath!,
height: height,
width: width,
fit: fit ?? BoxFit.cover,
color: color,
);
}
}
return SizedBox();
}
}
extension ImageTypeExtension on String {
ImageType get imageType {
if (this.startsWith('http') || this.startsWith('https')) {
return ImageType.network;
} else if (this.endsWith('.svg')) {
return ImageType.svg;
} else if (this.startsWith('file://')) {
return ImageType.file;
} else {
return ImageType.png;
}
}
}
enum ImageType { svg, png, network, file, unknown }

View File

@@ -1,49 +0,0 @@
import 'package:flutter/material.dart';
class LanguageDropdown extends StatefulWidget {
@override
_LanguageDropdownState createState() => _LanguageDropdownState();
}
class _LanguageDropdownState extends State<LanguageDropdown> {
String selectedLanguage = 'Русский';
@override
Widget build(BuildContext context) {
return DropdownButton<String>(
value: selectedLanguage,
onChanged: selectLanguage(),
isDense: false,
// Установите isDense в false
selectedItemBuilder: getList(),
items: ['Русский'].map((String language) {
return DropdownMenuItem<String>(
value: language,
child: Text(language),
);
}).toList(),
);
}
getList() {
return (BuildContext context) {
return ['Русский'].map<Widget>((String language) {
return Align(
alignment: Alignment.center, // Выравнивание текста по центру
child: Text(
language,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
);
}).toList();
};
}
selectLanguage() {
return (newValue) {
setState(() {
selectedLanguage = newValue!;
});
};
}
}

View File

@@ -1,48 +0,0 @@
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class NotificationSwitch extends StatefulWidget {
final String title;
NotificationSwitch(this.title);
@override
_NotificationSwitchState createState() => _NotificationSwitchState();
}
class _NotificationSwitchState extends State<NotificationSwitch> {
bool switchValue = false;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.title,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
Switch(
value: switchValue,
onChanged: toggleSwitch(),
inactiveThumbColor: appTheme.blueA400,
inactiveTrackColor: Colors.white,
activeTrackColor: appTheme.blueA400,
activeColor: Colors.white,
),
],
);
}
toggleSwitch() {
return (value) {
setState(() {
switchValue = value;
});
};
}
}

View File

@@ -1,28 +0,0 @@
import 'package:flutter/material.dart';
class ScaleElement extends StatelessWidget {
final Color color;
final bool isSelected;
final VoidCallback onTap;
const ScaleElement({
required this.color,
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: isSelected ? 40 : 20,
height: isSelected ? 40 : 20,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
),
),
);
}
}

View File

@@ -1,19 +0,0 @@
import 'package:flutter/material.dart';
class SectionTitle extends StatelessWidget {
final String title;
SectionTitle(this.title);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text(
title,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18),
),
);
}
}

View File

@@ -1,89 +0,0 @@
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:eatvio_app/widgets/base_button.dart';
import 'package:flutter/material.dart';
class NextStepButton extends BaseButton {
NextStepButton({
Key? key,
this.decoration,
this.leftIcon,
this.rightIcon,
this.label,
VoidCallback? onPressed,
ButtonStyle? buttonStyle,
TextStyle? buttonTextStyle,
bool? isDisabled,
Alignment? alignment,
double? height,
double? width,
EdgeInsets? margin,
required String text,
}) : super(
text: text,
onPressed: onPressed,
buttonStyle: buttonStyle,
isDisabled: isDisabled,
buttonTextStyle: buttonTextStyle,
height: height,
alignment: alignment,
width: width,
margin: margin,
);
final BoxDecoration? decoration;
final Widget? leftIcon;
final Widget? rightIcon;
final Widget? label;
@override
Widget build(BuildContext context) {
return (alignment != null)
? Align(
alignment: alignment!,
child: Container(
height: this.height ?? 30,
width: this.width ?? double.maxFinite,
margin: margin,
decoration: decoration,
child: OutlinedButton(
style: buttonStyle,
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
leftIcon ?? const SizedBox.shrink(),
Text(
text,
style: buttonTextStyle ?? theme.textTheme.titleSmall,
),
rightIcon ?? const SizedBox.shrink(),
],
),
),
),
)
: Container(
height: this.height ?? 30,
width: this.width ?? double.maxFinite,
margin: margin,
decoration: decoration,
child: OutlinedButton(
style: buttonStyle,
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
leftIcon ?? const SizedBox.shrink(),
Text(
text,
style: buttonTextStyle ?? theme.textTheme.titleSmall,
),
rightIcon ?? const SizedBox.shrink(),
],
),
),
);
}
}