forked from eatvio/eatvio_app
refactor: remove unused elements
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import 'package:eatvio_app/theme/app_decoration.dart';
|
||||
import 'package:eatvio_app/widgets/custom_image_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppbarTitleCircleimage extends StatelessWidget {
|
||||
const AppbarTitleCircleimage({
|
||||
this.imagePath,
|
||||
this.margin,
|
||||
});
|
||||
|
||||
final String? imagePath;
|
||||
final EdgeInsetsGeometry? margin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
borderRadius: BorderRadiusStyle.circleBorder8,
|
||||
child: Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: CustomImageView(
|
||||
imagePath: imagePath,
|
||||
height: 40,
|
||||
width: 40,
|
||||
fit: BoxFit.contain,
|
||||
radius: BorderRadius.circular(
|
||||
20,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExitButton extends StatelessWidget {
|
||||
const ExitButton({
|
||||
required this.text,
|
||||
this.margin,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final EdgeInsetsGeometry? margin;
|
||||
final Function? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTapCall,
|
||||
child: Padding(
|
||||
padding: margin ?? EdgeInsets.zero,
|
||||
child: Text(
|
||||
text,
|
||||
style: CustomTextStyles.titleSmallRed200.copyWith(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onTapCall() {
|
||||
onTap!.call();
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/*import 'package:flutter/material.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
|
||||
buildChart(
|
||||
BuildContext context, List<double> chartPoints, List<String>? dates) {
|
||||
// Определение осей графика
|
||||
List<FlSpot> spots = [];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
spots.add(
|
||||
FlSpot((i * 10 / 10) + 1, chartPoints[i]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget bottomTitleWidgets(
|
||||
double value, TitleMeta meta, double chartWidth, List<String>? dates) {
|
||||
if (value % 1 != 0) {
|
||||
return Container();
|
||||
}
|
||||
final style = TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: min(13, 13 * chartWidth / 300),
|
||||
);
|
||||
int index = value.toInt();
|
||||
if (index >= 0 && index < dates!.length) {
|
||||
// Проверка на допустимый индекс в массиве dates
|
||||
String formattedDate =
|
||||
DateFormat('dd.MM').format(DateTime.parse(dates[index]));
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
space: 16,
|
||||
child: Text(formattedDate, style: style),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
Widget leftTitleWidgets(double value, TitleMeta meta, double chartWidth) {
|
||||
final style = TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: min(18, 18 * chartWidth / 300),
|
||||
);
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
space: 16,
|
||||
child: Text(meta.formattedValue, style: style),
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 12,
|
||||
right: 20,
|
||||
),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return LineChart(
|
||||
LineChartData(
|
||||
lineTouchData: LineTouchData(
|
||||
touchTooltipData: LineTouchTooltipData(
|
||||
maxContentWidth: 100,
|
||||
tooltipBgColor: Colors.black,
|
||||
getTooltipItems: mapSpots(),
|
||||
),
|
||||
handleBuiltInTouches: true,
|
||||
getTouchLineStart: (data, index) => 0,
|
||||
),
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
color: Colors.pink,
|
||||
spots: spots,
|
||||
isCurved: true,
|
||||
isStrokeCapRound: true,
|
||||
barWidth: 3,
|
||||
belowBarData: BarAreaData(
|
||||
show: false,
|
||||
),
|
||||
dotData: const FlDotData(show: false),
|
||||
),
|
||||
],
|
||||
minY: chartPoints.reduce(
|
||||
(value, element) => value < element ? value : element),
|
||||
maxY: chartPoints.reduce(
|
||||
(value, element) => value > element ? value : element),
|
||||
minX: 1,
|
||||
maxX: 4,
|
||||
titlesData: FlTitlesData(
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, meta) =>
|
||||
leftTitleWidgets(value, meta, constraints.maxWidth),
|
||||
reservedSize: 56,
|
||||
),
|
||||
drawBelowEverything: true,
|
||||
),
|
||||
rightTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: (value, meta) => bottomTitleWidgets(
|
||||
value, meta, constraints.maxWidth, dates),
|
||||
reservedSize: 36,
|
||||
interval: 1,
|
||||
),
|
||||
drawBelowEverything: true,
|
||||
),
|
||||
topTitles: const AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
drawHorizontalLine: true,
|
||||
drawVerticalLine: true,
|
||||
horizontalInterval: 1.5,
|
||||
verticalInterval: 5,
|
||||
checkToShowHorizontalLine: valuteToInt(),
|
||||
getDrawingHorizontalLine: (_) => FlLine(
|
||||
color: Colors.blue.withOpacity(1),
|
||||
dashArray: [8, 2],
|
||||
strokeWidth: 0.8,
|
||||
),
|
||||
getDrawingVerticalLine: (_) => FlLine(
|
||||
color: Colors.blue.withOpacity(1),
|
||||
dashArray: [8, 2],
|
||||
strokeWidth: 0.8,
|
||||
),
|
||||
checkToShowVerticalLine: valuteToInt(),
|
||||
),
|
||||
borderData: FlBorderData(show: false),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
*/
|
||||
@@ -1,79 +0,0 @@
|
||||
/*import 'package:flutter/material.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Nutrition Chart'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 300,
|
||||
width: 300,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
barTouchData: BarTouchData(enabled: false),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTextStyles: (value) =>
|
||||
const TextStyle(color: Colors.black, fontSize: 14),
|
||||
margin: 10,
|
||||
showTitles: (double value) {
|
||||
switch (value.toInt()) {
|
||||
case 0:
|
||||
return 'Calories';
|
||||
case 1:
|
||||
return 'Protein';
|
||||
case 2:
|
||||
return 'Fat';
|
||||
case 3:
|
||||
return 'Carbs';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
},
|
||||
),
|
||||
leftTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
borderData: FlBorderData(show: false),
|
||||
barGroups: [
|
||||
BarChartGroupData(x: 0, barRods: [
|
||||
BarChartRodData(y: 200, color: Colors.blue),
|
||||
BarChartRodData(y: 150, color: Colors.blueAccent),
|
||||
]),
|
||||
BarChartGroupData(x: 1, barRods: [
|
||||
BarChartRodData(y: 50, color: Colors.red),
|
||||
BarChartRodData(y: 60, color: Colors.deepOrange),
|
||||
]),
|
||||
BarChartGroupData(x: 2, barRods: [
|
||||
BarChartRodData(y: 80, color: Colors.green),
|
||||
BarChartRodData(y: 70, color: Colors.lightGreen),
|
||||
]),
|
||||
BarChartGroupData(x: 3, barRods: [
|
||||
BarChartRodData(y: 100, color: Colors.orange),
|
||||
BarChartRodData(y: 120, color: Colors.orangeAccent),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
class CustomTextFormField extends StatelessWidget {
|
||||
// ...
|
||||
|
||||
final AutocompleteOptions<String> autocompleteOptions;
|
||||
|
||||
const CustomTextFormField({
|
||||
// ... (остальные параметры)
|
||||
required this.autocompleteOptions,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: autocompleteFieldWidget,
|
||||
)
|
||||
: autocompleteFieldWidget;
|
||||
}
|
||||
|
||||
Widget get autocompleteFieldWidget => SizedBox(
|
||||
width: width ?? double.maxFinite,
|
||||
child: Autocomplete<String>(
|
||||
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||
if (textEditingValue.text == '') {
|
||||
return const Iterable<String>.empty();
|
||||
}
|
||||
return autocompleteOptions.options.where((String option) {
|
||||
return option
|
||||
.toLowerCase()
|
||||
.contains(textEditingValue.text.toLowerCase());
|
||||
});
|
||||
},
|
||||
onSelected: (String value) {
|
||||
controller?.text = value;
|
||||
onChanged?.call(value);
|
||||
},
|
||||
fieldViewBuilder: (BuildContext context,
|
||||
TextEditingController textEditingController,
|
||||
FocusNode focusNode,
|
||||
VoidCallback onFieldSubmitted) {
|
||||
return TextFormField(
|
||||
controller: textEditingController,
|
||||
focusNode: focusNode,
|
||||
autofocus: autofocus!,
|
||||
style: textStyle ?? theme.textTheme.titleMedium,
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
maxLines: maxLines ?? 1,
|
||||
decoration: decoration,
|
||||
validator: validator,
|
||||
keyboardType: keyboardType,
|
||||
onSaved: onSaved,
|
||||
onChanged: onChanged,
|
||||
inputFormatters: inputFormatters,
|
||||
initialValue: initialValue,
|
||||
onFieldSubmitted: (_) => onFieldSubmitted(),
|
||||
);
|
||||
},
|
||||
optionsViewBuilder: (BuildContext context,
|
||||
AutocompleteOnSelected<String> onSelected,
|
||||
Iterable<String> options) {
|
||||
return Material(
|
||||
elevation: 4.0,
|
||||
child: ListView(
|
||||
children: options.map((String option) {
|
||||
return ListTile(
|
||||
title: Text(option),
|
||||
onTap: () {
|
||||
onSelected(option);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}*/
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/token_storage.dart';
|
||||
import 'package:eatvio_app/localization/app_localization.dart';
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomIconButton extends StatelessWidget {
|
||||
CustomIconButton({
|
||||
Key? key,
|
||||
this.alignment,
|
||||
this.height,
|
||||
this.width,
|
||||
this.padding,
|
||||
this.decoration,
|
||||
this.child,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
|
||||
final Alignment? alignment;
|
||||
final double? height;
|
||||
final double? width;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final BoxDecoration? decoration;
|
||||
final Widget? child;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: _buildIconButtonWidget(),
|
||||
)
|
||||
: _buildIconButtonWidget();
|
||||
}
|
||||
|
||||
_buildIconButtonWidget() {
|
||||
return SizedBox(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
child: IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Container(
|
||||
height: height ?? 0,
|
||||
width: width ?? 0,
|
||||
padding: padding ?? EdgeInsets.zero,
|
||||
decoration: decoration ??
|
||||
BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(9)),
|
||||
border: const Border.fromBorderSide(
|
||||
BorderSide(color: Colors.blueGrey, width: 1),
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
onPressed: onTap,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension on [CustomIconButton] to facilitate inclusion of all types of border style etc
|
||||
extension IconButtonStyleHelper on CustomIconButton {
|
||||
static BoxDecoration get fillBlueA => BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(14)),
|
||||
);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/widgets/custom_image_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MenuItem extends StatelessWidget {
|
||||
final String icon;
|
||||
final String text;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const MenuItem({
|
||||
required this.icon,
|
||||
required this.text,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center, // Выравнивание по центру вертикально
|
||||
children: <Widget>[
|
||||
CustomImageView(
|
||||
color: appTheme.blueA400,
|
||||
imagePath: icon,
|
||||
height: 24.0,
|
||||
width: 24.0,
|
||||
),
|
||||
SizedBox(
|
||||
width: 8.0,
|
||||
), // Добавляем небольшой отступ между иконкой и текстом
|
||||
Text(text),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user