fix: исправил ширину строки

This commit is contained in:
Artem Luzin m
2025-06-17 20:25:24 +07:00
parent 3895b9a7fc
commit f64f63641e
3 changed files with 36 additions and 16 deletions

View File

@@ -56,13 +56,19 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
Color? infoSnackbarBackground, Color? infoSnackbarBackground,
}) => AppColors( }) => AppColors(
testColor: testColor ?? this.testColor, testColor: testColor ?? this.testColor,
errorSnackbarBackground: errorSnackbarBackground ?? this.errorSnackbarBackground, errorSnackbarBackground:
successSnackbarBackground: successSnackbarBackground ?? this.successSnackbarBackground, errorSnackbarBackground ?? this.errorSnackbarBackground,
infoSnackbarBackground: infoSnackbarBackground ?? this.infoSnackbarBackground, successSnackbarBackground:
successSnackbarBackground ?? this.successSnackbarBackground,
infoSnackbarBackground:
infoSnackbarBackground ?? this.infoSnackbarBackground,
); );
@override @override
ThemeExtension<AppColors> lerp(covariant ThemeExtension<AppColors>? other, double t) { ThemeExtension<AppColors> lerp(
covariant ThemeExtension<AppColors>? other,
double t,
) {
if (other is! AppColors) return this; if (other is! AppColors) return this;
return AppColors( return AppColors(
@@ -77,7 +83,11 @@ class AppColors extends ThemeExtension<AppColors> with DiagnosticableTreeMixin {
other.successSnackbarBackground, other.successSnackbarBackground,
t, t,
)!, )!,
infoSnackbarBackground: Color.lerp(infoSnackbarBackground, other.infoSnackbarBackground, t)!, infoSnackbarBackground: Color.lerp(
infoSnackbarBackground,
other.infoSnackbarBackground,
t,
)!,
); );
} }
} }

View File

@@ -4,10 +4,12 @@ import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
/// Класс для конфигурации светлой/темной темы приложения /// Класс для конфигурации светлой/темной темы приложения
abstract class AppTheme { abstract class AppTheme {
/// Геттер для получения светлой темы /// Геттер для получения светлой темы
static ThemeData get light => static ThemeData get light => ThemeData.light().copyWith(
ThemeData.light().copyWith(extensions: <ThemeExtension<Object?>>[AppColors.light]); extensions: <ThemeExtension<Object?>>[AppColors.light],
);
/// Геттер для получения темной темы /// Геттер для получения темной темы
static ThemeData get dark => static ThemeData get dark => ThemeData.dark().copyWith(
ThemeData.dark().copyWith(extensions: <ThemeExtension<Object?>>[AppColors.dark]); extensions: <ThemeExtension<Object?>>[AppColors.dark],
);
} }

View File

@@ -139,7 +139,8 @@ class AppSnackBar extends StatefulWidget {
} }
} }
class _AppSnackBarState extends State<AppSnackBar> with SingleTickerProviderStateMixin { class _AppSnackBarState extends State<AppSnackBar>
with SingleTickerProviderStateMixin {
late AnimationController _animationController; late AnimationController _animationController;
late Animation<double> _slideAnimation; late Animation<double> _slideAnimation;
Timer? _dismissTimer; Timer? _dismissTimer;
@@ -174,10 +175,10 @@ class _AppSnackBarState extends State<AppSnackBar> with SingleTickerProviderStat
// Конечная позиция снекбара - 15 пикселей ниже верхнего отступа // Конечная позиция снекбара - 15 пикселей ниже верхнего отступа
final endPosition = topPadding + 15; final endPosition = topPadding + 15;
// Создание анимации с использованием Tween // Создание анимации с использованием Tween
_slideAnimation = Tween<double>( _slideAnimation = Tween<double>(begin: startPosition, end: endPosition)
begin: startPosition, .animate(
end: endPosition, CurvedAnimation(parent: _animationController, curve: Curves.easeOut),
).animate(CurvedAnimation(parent: _animationController, curve: Curves.easeOut)); );
_animationController.forward(); _animationController.forward();
} }
@@ -231,7 +232,10 @@ class _AppSnackBarState extends State<AppSnackBar> with SingleTickerProviderStat
color: _getBackgroundColor(widget.type), color: _getBackgroundColor(widget.type),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), padding: const EdgeInsets.symmetric(
vertical: 12,
horizontal: 16,
),
child: Row( child: Row(
children: [ children: [
_Icon(type: widget.type), _Icon(type: widget.type),
@@ -284,7 +288,11 @@ class _Icon extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return switch (type) { return switch (type) {
TypeSnackBar.success => Icon(Icons.check_circle, color: Colors.white, size: 32), TypeSnackBar.success => Icon(
Icons.check_circle,
color: Colors.white,
size: 32,
),
TypeSnackBar.error => Icon(Icons.error, color: Colors.white, size: 32), TypeSnackBar.error => Icon(Icons.error, color: Colors.white, size: 32),
TypeSnackBar.info => Icon(Icons.info, color: Colors.white, size: 32), TypeSnackBar.info => Icon(Icons.info, color: Colors.white, size: 32),
}; };