feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -12,8 +12,7 @@ part of 'calendar_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CalendarState {
@@ -23,14 +22,16 @@ mixin _$CalendarState {
required TResult Function() loading,
required TResult Function(List<CalendarModel> calendarList) loaded,
required TResult Function(String errorMessage) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<CalendarModel> calendarList)? loaded,
TResult? Function(String errorMessage)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
TResult Function()? $default, {
@@ -38,21 +39,24 @@ mixin _$CalendarState {
TResult Function(List<CalendarModel> calendarList)? loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>(
TResult Function(_CalendarState value) $default, {
required TResult Function(CalendarStateLoading value) loading,
required TResult Function(CalendarStateLoaded value) loaded,
required TResult Function(CalendarStateError value) error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_CalendarState value)? $default, {
TResult? Function(CalendarStateLoading value)? loading,
TResult? Function(CalendarStateLoaded value)? loaded,
TResult? Function(CalendarStateError value)? error,
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>(
TResult Function(_CalendarState value)? $default, {
@@ -60,15 +64,15 @@ mixin _$CalendarState {
TResult Function(CalendarStateLoaded value)? loaded,
TResult Function(CalendarStateError value)? error,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CalendarStateCopyWith<$Res> {
factory $CalendarStateCopyWith(
CalendarState value,
$Res Function(CalendarState) then,
) = _$CalendarStateCopyWithImpl<$Res, CalendarState>;
CalendarState value, $Res Function(CalendarState) then) =
_$CalendarStateCopyWithImpl<$Res, CalendarState>;
}
/// @nodoc
@@ -88,9 +92,8 @@ class _$CalendarStateCopyWithImpl<$Res, $Val extends CalendarState>
/// @nodoc
abstract class _$$CalendarStateImplCopyWith<$Res> {
factory _$$CalendarStateImplCopyWith(
_$CalendarStateImpl value,
$Res Function(_$CalendarStateImpl) then,
) = __$$CalendarStateImplCopyWithImpl<$Res>;
_$CalendarStateImpl value, $Res Function(_$CalendarStateImpl) then) =
__$$CalendarStateImplCopyWithImpl<$Res>;
}
/// @nodoc
@@ -98,9 +101,8 @@ class __$$CalendarStateImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateImpl>
implements _$$CalendarStateImplCopyWith<$Res> {
__$$CalendarStateImplCopyWithImpl(
_$CalendarStateImpl _value,
$Res Function(_$CalendarStateImpl) _then,
) : super(_value, _then);
_$CalendarStateImpl _value, $Res Function(_$CalendarStateImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -206,20 +208,18 @@ abstract class _CalendarState implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateLoadingImplCopyWith<$Res> {
factory _$$CalendarStateLoadingImplCopyWith(
_$CalendarStateLoadingImpl value,
$Res Function(_$CalendarStateLoadingImpl) then,
) = __$$CalendarStateLoadingImplCopyWithImpl<$Res>;
factory _$$CalendarStateLoadingImplCopyWith(_$CalendarStateLoadingImpl value,
$Res Function(_$CalendarStateLoadingImpl) then) =
__$$CalendarStateLoadingImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$CalendarStateLoadingImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadingImpl>
implements _$$CalendarStateLoadingImplCopyWith<$Res> {
__$$CalendarStateLoadingImplCopyWithImpl(
_$CalendarStateLoadingImpl _value,
$Res Function(_$CalendarStateLoadingImpl) _then,
) : super(_value, _then);
__$$CalendarStateLoadingImplCopyWithImpl(_$CalendarStateLoadingImpl _value,
$Res Function(_$CalendarStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -326,10 +326,9 @@ abstract class CalendarStateLoading implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateLoadedImplCopyWith<$Res> {
factory _$$CalendarStateLoadedImplCopyWith(
_$CalendarStateLoadedImpl value,
$Res Function(_$CalendarStateLoadedImpl) then,
) = __$$CalendarStateLoadedImplCopyWithImpl<$Res>;
factory _$$CalendarStateLoadedImplCopyWith(_$CalendarStateLoadedImpl value,
$Res Function(_$CalendarStateLoadedImpl) then) =
__$$CalendarStateLoadedImplCopyWithImpl<$Res>;
@useResult
$Res call({List<CalendarModel> calendarList});
}
@@ -338,34 +337,32 @@ abstract class _$$CalendarStateLoadedImplCopyWith<$Res> {
class __$$CalendarStateLoadedImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateLoadedImpl>
implements _$$CalendarStateLoadedImplCopyWith<$Res> {
__$$CalendarStateLoadedImplCopyWithImpl(
_$CalendarStateLoadedImpl _value,
$Res Function(_$CalendarStateLoadedImpl) _then,
) : super(_value, _then);
__$$CalendarStateLoadedImplCopyWithImpl(_$CalendarStateLoadedImpl _value,
$Res Function(_$CalendarStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? calendarList = null}) {
return _then(
_$CalendarStateLoadedImpl(
calendarList:
null == calendarList
? _value._calendarList
: calendarList // ignore: cast_nullable_to_non_nullable
as List<CalendarModel>,
),
);
$Res call({
Object? calendarList = null,
}) {
return _then(_$CalendarStateLoadedImpl(
calendarList: null == calendarList
? _value._calendarList
: calendarList // ignore: cast_nullable_to_non_nullable
as List<CalendarModel>,
));
}
}
/// @nodoc
class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
const _$CalendarStateLoadedImpl({
required final List<CalendarModel> calendarList,
}) : _calendarList = calendarList;
const _$CalendarStateLoadedImpl(
{required final List<CalendarModel> calendarList})
: _calendarList = calendarList;
final List<CalendarModel> _calendarList;
@override
@@ -385,17 +382,13 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CalendarStateLoadedImpl &&
const DeepCollectionEquality().equals(
other._calendarList,
_calendarList,
));
const DeepCollectionEquality()
.equals(other._calendarList, _calendarList));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_calendarList),
);
runtimeType, const DeepCollectionEquality().hash(_calendarList));
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@@ -404,9 +397,7 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
@pragma('vm:prefer-inline')
_$$CalendarStateLoadedImplCopyWith<_$CalendarStateLoadedImpl> get copyWith =>
__$$CalendarStateLoadedImplCopyWithImpl<_$CalendarStateLoadedImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs
@@ -484,9 +475,9 @@ class _$CalendarStateLoadedImpl implements CalendarStateLoaded {
}
abstract class CalendarStateLoaded implements CalendarState {
const factory CalendarStateLoaded({
required final List<CalendarModel> calendarList,
}) = _$CalendarStateLoadedImpl;
const factory CalendarStateLoaded(
{required final List<CalendarModel> calendarList}) =
_$CalendarStateLoadedImpl;
List<CalendarModel> get calendarList;
@@ -499,10 +490,9 @@ abstract class CalendarStateLoaded implements CalendarState {
/// @nodoc
abstract class _$$CalendarStateErrorImplCopyWith<$Res> {
factory _$$CalendarStateErrorImplCopyWith(
_$CalendarStateErrorImpl value,
$Res Function(_$CalendarStateErrorImpl) then,
) = __$$CalendarStateErrorImplCopyWithImpl<$Res>;
factory _$$CalendarStateErrorImplCopyWith(_$CalendarStateErrorImpl value,
$Res Function(_$CalendarStateErrorImpl) then) =
__$$CalendarStateErrorImplCopyWithImpl<$Res>;
@useResult
$Res call({String errorMessage});
}
@@ -511,25 +501,23 @@ abstract class _$$CalendarStateErrorImplCopyWith<$Res> {
class __$$CalendarStateErrorImplCopyWithImpl<$Res>
extends _$CalendarStateCopyWithImpl<$Res, _$CalendarStateErrorImpl>
implements _$$CalendarStateErrorImplCopyWith<$Res> {
__$$CalendarStateErrorImplCopyWithImpl(
_$CalendarStateErrorImpl _value,
$Res Function(_$CalendarStateErrorImpl) _then,
) : super(_value, _then);
__$$CalendarStateErrorImplCopyWithImpl(_$CalendarStateErrorImpl _value,
$Res Function(_$CalendarStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? errorMessage = null}) {
return _then(
_$CalendarStateErrorImpl(
errorMessage:
null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? errorMessage = null,
}) {
return _then(_$CalendarStateErrorImpl(
errorMessage: null == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -565,9 +553,7 @@ class _$CalendarStateErrorImpl implements CalendarStateError {
@pragma('vm:prefer-inline')
_$$CalendarStateErrorImplCopyWith<_$CalendarStateErrorImpl> get copyWith =>
__$$CalendarStateErrorImplCopyWithImpl<_$CalendarStateErrorImpl>(
this,
_$identity,
);
this, _$identity);
@override
@optionalTypeArgs

View File

@@ -12,8 +12,9 @@ import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
class CalendarScreen extends StatelessWidget {
CalendarScreen({Key? key}) : super(key: key);
const CalendarScreen({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider<CalendarCubit>(
create: (context) => sl<CalendarCubit>()..loadCalendarList(),
@@ -22,8 +23,8 @@ class CalendarScreen extends StatelessWidget {
if (state is CalendarStateLoaded) {
return _buildCalendar(context, state);
} else if (state is CalendarStateLoading) {
return Scaffold(
body: const Loader(),
return const Scaffold(
body: Loader(),
);
} else if (state is CalendarStateError) {
return Scaffold(
@@ -34,15 +35,15 @@ class CalendarScreen extends StatelessWidget {
),
),
);
} else
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: Center(
child: Text("Неопределенная ошибка"),
),
}
return const Scaffold(
body: Padding(
padding: EdgeInsets.all(16),
child: Center(
child: Text("Неопределенная ошибка"),
),
);
),
);
},
),
);
@@ -55,7 +56,7 @@ class CalendarScreen extends StatelessWidget {
FormBuilder(
child: Scaffold(
appBar: AppBar(
title: Text(
title: const Text(
'Календарь',
),
),
@@ -68,12 +69,12 @@ class CalendarScreen extends StatelessWidget {
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.only(bottom: 8),
child: Column(
children: [
SizedBox(height: 24),
const SizedBox(height: 24),
_buildCalendarBody(context, state),
SizedBox(height: 24),
const SizedBox(height: 24),
],
),
),
@@ -90,11 +91,11 @@ class CalendarScreen extends StatelessWidget {
_buildCalendarBody(BuildContext context, CalendarStateLoaded state) {
return ListView.separated(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
separatorBuilder: (context, index) {
return SizedBox(
return const SizedBox(
height: 4,
);
},
@@ -106,12 +107,12 @@ class CalendarScreen extends StatelessWidget {
return InkWell(
borderRadius: BorderRadiusStyle.circleBorder8,
child: Ink(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadiusStyle.circleBorder8,
color: state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression
? Color.fromRGBO(59, 130, 246, .2)
: Color.fromRGBO(126, 136, 151, .1),
color: state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression
? const Color.fromRGBO(59, 130, 246, .2)
: const Color.fromRGBO(126, 136, 151, .1),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -125,12 +126,12 @@ class CalendarScreen extends StatelessWidget {
formatDate(state.calendarList[index].date),
style: theme.textTheme.titleMedium,
),
SizedBox(height: 4),
if (state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression)
const SizedBox(height: 4),
if (state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression)
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -138,11 +139,11 @@ class CalendarScreen extends StatelessWidget {
style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый
),
),
if (!state.calendarList[index].is_current_day_included_in_the_chosen_diet_progression)
if (!state.calendarList[index].isCurrentDayIncludedInTheChosenDietProgression)
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(108, 117, 125, 1),
color: const Color.fromRGBO(108, 117, 125, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -166,7 +167,7 @@ class CalendarScreen extends StatelessWidget {
extra: diary['id'].toString(),
),
child: Ink(
padding: EdgeInsets.all(8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadiusStyle.circleBorder8,
color: getBackgroundColor(diary['state']),
@@ -183,13 +184,13 @@ class CalendarScreen extends StatelessWidget {
formatDate(state.calendarList[index].date),
style: theme.textTheme.titleMedium,
),
SizedBox(height: 4),
const SizedBox(height: 4),
Row(
children: [
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: diary['state'] == 'finished' ? Color.fromRGBO(1, 154, 62, 1) : Color.fromRGBO(154, 74, 1, 1),
color: diary['state'] == 'finished' ? const Color.fromRGBO(1, 154, 62, 1) : const Color.fromRGBO(154, 74, 1, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -197,12 +198,12 @@ class CalendarScreen extends StatelessWidget {
style: CustomTextStyles.titleSmallBold, // Предполагается, что текст белый
),
),
SizedBox(width: 4),
const SizedBox(width: 4),
if (diary['state'] == 'started')
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -212,9 +213,9 @@ class CalendarScreen extends StatelessWidget {
),
if (diary['state'] == 'finished')
Container(
padding: EdgeInsets.all(4.0), // Отступы внутри контейнера
padding: const EdgeInsets.all(4.0), // Отступы внутри контейнера
decoration: BoxDecoration(
color: Color.fromRGBO(13, 110, 253, 1),
color: const Color.fromRGBO(13, 110, 253, 1),
borderRadius: BorderRadius.circular(24.0), // Закругленные углы
),
child: Text(
@@ -256,16 +257,16 @@ String formatDate(String dateString) {
String formattedDate = DateFormat('d MMMM', 'ru_RU').format(dateTime);
// Возвращаем результат в нужном формате
return '$formattedDate';
return formattedDate;
}
Color getBackgroundColor(String? status) {
switch (status) {
case 'finished':
return Color.fromRGBO(1, 154, 62, .1);
return const Color.fromRGBO(1, 154, 62, .1);
case 'started':
return Color.fromRGBO(154, 74, 1, .1);
return const Color.fromRGBO(154, 74, 1, .1);
default:
return Color.fromRGBO(126, 136, 151, .1);
return const Color.fromRGBO(126, 136, 151, .1);
}
}