Обновлен проект. Добавлена БД

This commit is contained in:
2025-03-03 23:57:55 +03:00
parent 273e68557a
commit cb6ce05059
726 changed files with 9424 additions and 478 deletions

View File

@@ -0,0 +1,162 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:oktoast/oktoast.dart' show dismissAllToast;
import 'package:remever/common/resources.dart';
import 'package:remever/common/widgets/typography.dart';
import 'package:remever/common/widgets/wspace.dart';
import 'package:remever/components/extensions/context.dart';
// Project imports:
import 'package:remever/gen/assets.gen.dart';
enum ToastType {
///
/// Стандартный тост
///
DEFAULT,
///
/// Закрываемый вручную тост
///
DISMISSIBLE,
}
class InfoToast extends StatelessWidget {
///
/// Виджет отображающийся при использовании [Toast.show]
///
const InfoToast({required this.child, super.key})
: toastType = ToastType.DEFAULT,
message = '',
type = null,
textColor = null,
bgColor = null;
const InfoToast.dismissible({
required this.message,
this.type,
this.textColor,
this.bgColor,
super.key,
}) : toastType = ToastType.DISMISSIBLE,
child = const SizedBox();
/// Сообщение в [ToastType.DISMISSIBLE]
final String message;
/// Сообщение в [ToastType.DEFAULT]
final Widget child;
/// Тип тоста
final ToastType toastType;
/// Тип типографии
final TypographyType? type;
/// Цвет текста
final Color? textColor;
/// Фоновый цвет
final Color? bgColor;
@override
Widget build(BuildContext context) {
return switch (toastType) {
ToastType.DEFAULT => _Toast(child: child),
ToastType.DISMISSIBLE => _DismissibleToast(
message: message,
type: type,
textColor: textColor,
bgColor: bgColor,
),
};
}
}
class _DismissibleToast extends StatelessWidget {
const _DismissibleToast({
required this.message,
this.type,
this.textColor,
this.bgColor,
});
final String message;
final TypographyType? type;
final Color? textColor;
final Color? bgColor;
@override
Widget build(BuildContext context) {
return Material(
child: SizedBox(
width: MediaQuery.sizeOf(context).width * 0.9,
// height: 60.h,
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 60.h),
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(8)).r,
color: bgColor ?? AppColors.white,
border: Border.all(color: AppColors.gray, width: 0.5.w),
),
child: Padding(
padding: const EdgeInsets.all(12).r,
child: Row(
children: <Widget>[
Assets.icons.typeDanger.image(height: 24.h, width: 24.w),
const WSpace(8),
Flexible(
fit: FlexFit.tight,
child: AppTypography(
message,
type: type,
color: textColor ?? AppColors.white,
textAlign: TextAlign.start,
maxLines: 3,
),
),
InkWell(
onTap: dismissAllToast,
child: SizedBox.square(
dimension: 24.r,
child: const DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.gray_bg,
),
child: Icon(Icons.close, color: AppColors.disabled),
),
),
),
],
),
),
),
),
),
);
}
}
class _Toast extends StatelessWidget {
const _Toast({required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return Material(
child: SizedBox(
height: 40,
width: MediaQuery.sizeOf(context).width * 0.6,
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(15)).r,
child: child,
),
),
);
}
}

View File

@@ -1,9 +1,10 @@
// Flutter imports:
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
// Package imports:
import 'package:google_fonts/google_fonts.dart';
import 'package:remever/common/resources.dart';
import 'package:remever/components/extensions/context.dart';
export '../../common/typography.dart';
@@ -31,6 +32,7 @@ abstract class TypographyTypeRegular extends TypographyType {
fontWeight: FontWeight.w400,
fontSize: size.sp,
height: height,
color: AppColors.text_black,
);
}
}
@@ -47,6 +49,7 @@ abstract class TypographyTypeMedium extends TypographyType {
fontWeight: FontWeight.w500,
fontSize: size.sp,
height: height,
color: AppColors.text_black,
);
}
}
@@ -63,6 +66,7 @@ abstract class TypographyTypeSemiBold extends TypographyType {
fontWeight: FontWeight.w600,
fontSize: size.sp,
height: height,
color: AppColors.text_black,
);
}
}
@@ -79,6 +83,7 @@ abstract class TypographyTypeBold extends TypographyType {
fontWeight: FontWeight.w700,
fontSize: size.sp,
height: height,
color: AppColors.text_black,
);
}
}
@@ -95,6 +100,7 @@ abstract class TypographyTypeHeadBold extends TypographyType {
fontWeight: FontWeight.w700,
fontSize: size.sp,
height: height,
color: AppColors.text_black,
);
}
}
@@ -218,7 +224,7 @@ class AppTypography extends StatelessWidget {
type == null
? textStyle.style
: type!.style.copyWith(
color: color ?? textStyle.style.color,
color: color ?? Colors.black,
fontWeight: fontWeight,
height: height,
decoration: textDecoration,