Обновлен проект. Добавлена БД
This commit is contained in:
@@ -16,10 +16,10 @@ extension NotificationEventTypeExtension on NotificationEventType {
|
||||
return AppColors.gray;
|
||||
|
||||
case NotificationEventType.ERROR:
|
||||
return AppColors.red;
|
||||
return AppColors.info_red;
|
||||
|
||||
case NotificationEventType.WARNING:
|
||||
return AppColors.yellowL;
|
||||
return AppColors.info_yellow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,42 +90,25 @@ abstract class AppColors {
|
||||
static const Color disabled = Color(0xFF8B8B8B);
|
||||
static const Color gray = Color(0xFFE0E0E0);
|
||||
static const Color body_text = Color(0xFF080514);
|
||||
static const Color gray_bg = Color(0xFFEFEFF4);
|
||||
static const Color secondary = Color(0xFFDBD7F4);
|
||||
static const Color danger = Color(0xFFFF5C69);
|
||||
static const Color question = Color(0xFFF4D7E2);
|
||||
static const Color answer = Color(0xFFD7F4EA);
|
||||
|
||||
static const Color secondary = Color(0xFF1F1F1F);
|
||||
static const Color navigationL = Color(0xFF5C5C5C);
|
||||
static const Color navigationD = Color(0xFFE6E6E6);
|
||||
static const Gradient primaryGradient = LinearGradient(
|
||||
stops: <double>[0.52, 1.0],
|
||||
colors: <Color>[Color(0xFFFFD12D), Color(0xFFFF922D)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
static const Color black = Color(0xFF282828);
|
||||
static const Color secondaryL = Color(0xFF282828);
|
||||
static const Color green = Color(0xFF3EBF81);
|
||||
static const Color yellowText = Color(0xFFCEBC13);
|
||||
static const Color purple = Color(0xFF923EFF);
|
||||
static const Color red = Color(0xFFDA4E4E);
|
||||
static const Color blueL = Color(0xFFE1F1FD);
|
||||
static const Color blueD = Color(0xFF22333F);
|
||||
static const Color greenD = Color(0xFF24372E);
|
||||
static const Color purpleD = Color(0xFF2B2235);
|
||||
static const Color redD = Color(0xFF3B2626);
|
||||
static const Color yellowD = Color(0xFF413A21);
|
||||
static const Color greenL = Color(0xFFE2F5EC);
|
||||
static const Color purpleL = Color(0xFFF4ECFF);
|
||||
static const Color redL = Color(0xFFF9E4E4);
|
||||
static const Color yellowL = Color(0xFFFFF8E0);
|
||||
static const Color backgroundLD1 = Color(0xFFF2F2F2);
|
||||
static const Color backgroundL = Color(0xFFF8F8F8);
|
||||
static const Color secondaryLL1 = Color(0xFF303030);
|
||||
static const Color backgroundLL1 = Color(0xFFFBFBFB);
|
||||
static const Color primary_blue = Color(0xFF1837B4);
|
||||
static const Color additional_blue = Color(0xFF1837B4);
|
||||
static const Color primary_gray = Color(0xFFF1F2F4);
|
||||
static const Color primary_red = Color(0xFFFF543D);
|
||||
static const Color secondary_red = Color(0xFFFFF2F1);
|
||||
|
||||
static const Color app_blue = Color(0xFF0b84f6);
|
||||
static const Color app_grey = Color(0xFFF7F7F9);
|
||||
static const Color app_dark_grey = Color(0xFF7C7C7C);
|
||||
static const Color app_border = Color(0xFFE5E5E8);
|
||||
static const Color app_dark_blue = Color(0xFF888B98);
|
||||
static const Color app_err = Color(0xFFFF4D49);
|
||||
static const Color app_overlay = Color(0xFFF3F3FF);
|
||||
static const Color text_gray = Color(0xFF80899C);
|
||||
static const Color text_black = Color(0xFF0B0C0E);
|
||||
static const Color text_white = Color(0xFFFFFFFF);
|
||||
|
||||
static const Color grayscale_100 = Color(0xFFE2E4E9);
|
||||
|
||||
static const Color info_red = Color(0xFFDA4E4E);
|
||||
static const Color info_yellow = Color(0xFFFFF8E0);
|
||||
static const Color info_gray = Color(0xFFA8A8A8);
|
||||
}
|
||||
|
||||
37
lib/common/toast.dart
Normal file
37
lib/common/toast.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:oktoast/oktoast.dart' show ToastPosition, showToastWidget;
|
||||
import 'package:remever/common/resources.dart';
|
||||
import 'package:remever/common/widgets/info_toast.dart';
|
||||
|
||||
// Project imports:
|
||||
|
||||
///
|
||||
/// Класс для отображения тостов
|
||||
///
|
||||
final class Toast {
|
||||
///
|
||||
/// Показать информационный тост
|
||||
///
|
||||
static void show(Widget child, {Duration? duration}) {
|
||||
showToastWidget(
|
||||
InfoToast(child: child),
|
||||
duration: duration,
|
||||
handleTouch: true,
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Показать тост с иконкой для закрытия
|
||||
///
|
||||
static void showDismissible(String message, {Duration? duration}) {
|
||||
showToastWidget(
|
||||
InfoToast.dismissible(message: message, bgColor: AppColors.white),
|
||||
position: ToastPosition.top.copyWith(offset: 50),
|
||||
duration: duration,
|
||||
handleTouch: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// Project imports:
|
||||
import 'package:remever/common/widgets/typography.dart';
|
||||
|
||||
/// -- Regular --
|
||||
@@ -7,11 +8,6 @@ class Regular12px extends TypographyTypeRegular {
|
||||
double get size => 12;
|
||||
}
|
||||
|
||||
class Regular13px extends TypographyTypeRegular {
|
||||
@override
|
||||
double get size => 13;
|
||||
}
|
||||
|
||||
class Regular14px extends TypographyTypeRegular {
|
||||
@override
|
||||
double get size => 14;
|
||||
@@ -76,14 +72,9 @@ class SemiBold14px extends TypographyTypeSemiBold {
|
||||
double get size => 14;
|
||||
}
|
||||
|
||||
class SemiBold18px extends TypographyTypeSemiBold {
|
||||
class SemiBold20px extends TypographyTypeSemiBold {
|
||||
@override
|
||||
double get size => 18;
|
||||
}
|
||||
|
||||
class SemiBold22px extends TypographyTypeSemiBold {
|
||||
@override
|
||||
double get size => 22;
|
||||
double get size => 20;
|
||||
}
|
||||
|
||||
class SemiBold24px extends TypographyTypeSemiBold {
|
||||
@@ -95,7 +86,6 @@ class SemiBold28px extends TypographyTypeSemiBold {
|
||||
@override
|
||||
double get size => 28;
|
||||
}
|
||||
|
||||
// -- Bold --
|
||||
|
||||
class Bold10px extends TypographyTypeBold {
|
||||
@@ -108,29 +98,14 @@ class Bold12px extends TypographyTypeBold {
|
||||
double get size => 12;
|
||||
}
|
||||
|
||||
class Bold13px extends TypographyTypeBold {
|
||||
@override
|
||||
double get size => 13;
|
||||
}
|
||||
|
||||
class Bold14px extends TypographyTypeBold {
|
||||
@override
|
||||
double get size => 14;
|
||||
}
|
||||
|
||||
class Bold16px extends TypographyTypeBold {
|
||||
class Bold34px extends TypographyTypeBold {
|
||||
@override
|
||||
double get size => 16;
|
||||
}
|
||||
|
||||
class Bold18px extends TypographyTypeBold {
|
||||
@override
|
||||
double get size => 18;
|
||||
}
|
||||
|
||||
class Bold24px extends TypographyTypeBold {
|
||||
@override
|
||||
double get size => 24;
|
||||
double get size => 34;
|
||||
}
|
||||
|
||||
// -- HeadBold --
|
||||
@@ -139,8 +114,3 @@ class HeadBold20px extends TypographyTypeHeadBold {
|
||||
@override
|
||||
double get size => 20;
|
||||
}
|
||||
|
||||
class HeadBold28px extends TypographyTypeHeadBold {
|
||||
@override
|
||||
double get size => 28;
|
||||
}
|
||||
|
||||
162
lib/common/widgets/info_toast.dart
Normal file
162
lib/common/widgets/info_toast.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user