mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 17:40:45 +00:00
refactor(app, debug): заменил использование расширение контекста
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
|
|
||||||
import 'package:friflex_starter/app/theme/theme_notifier.dart';
|
import 'package:friflex_starter/app/theme/theme_notifier.dart';
|
||||||
import 'package:friflex_starter/di/di_container.dart';
|
import 'package:friflex_starter/di/di_container.dart';
|
||||||
import 'package:friflex_starter/l10n/gen/app_localizations.dart';
|
import 'package:friflex_starter/l10n/gen/app_localizations.dart';
|
||||||
@@ -11,9 +10,6 @@ extension AppContextExt on BuildContext {
|
|||||||
/// Метод для получения экземпляра DIContainer
|
/// Метод для получения экземпляра DIContainer
|
||||||
DiContainer get di => read<DiContainer>();
|
DiContainer get di => read<DiContainer>();
|
||||||
|
|
||||||
/// Геттер для получения цветовой схемы
|
|
||||||
AppColors get colors => Theme.of(this).extension<AppColors>()!;
|
|
||||||
|
|
||||||
/// Геттер для получения темы
|
/// Геттер для получения темы
|
||||||
ThemeNotifier get theme => read<ThemeNotifier>();
|
ThemeNotifier get theme => read<ThemeNotifier>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:friflex_starter/app/app_context_ext.dart';
|
import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
|
||||||
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
||||||
|
|
||||||
/// {@template app_snackbar}
|
/// {@template app_snackbar}
|
||||||
@@ -264,9 +264,9 @@ class _AppSnackBarState extends State<AppSnackBar>
|
|||||||
/// [TypeSnackBar.error] - цвет ошибки
|
/// [TypeSnackBar.error] - цвет ошибки
|
||||||
Color _getBackgroundColor(TypeSnackBar type) {
|
Color _getBackgroundColor(TypeSnackBar type) {
|
||||||
return switch (type) {
|
return switch (type) {
|
||||||
TypeSnackBar.success => context.colors.successSnackbarBackground,
|
TypeSnackBar.success => context.appColors.successSnackbarBackground,
|
||||||
TypeSnackBar.error => context.colors.errorSnackbarBackground,
|
TypeSnackBar.error => context.appColors.errorSnackbarBackground,
|
||||||
TypeSnackBar.info => context.colors.infoSnackbarBackground,
|
TypeSnackBar.info => context.appColors.infoSnackbarBackground,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:friflex_starter/app/app_context_ext.dart';
|
import 'package:friflex_starter/app/app_context_ext.dart';
|
||||||
|
import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
|
||||||
import 'package:friflex_starter/gen/assets.gen.dart';
|
import 'package:friflex_starter/gen/assets.gen.dart';
|
||||||
import 'package:friflex_starter/gen/fonts.gen.dart';
|
import 'package:friflex_starter/gen/fonts.gen.dart';
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ class LangScreen extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'Тестовое слово bold: ${context.l10n.helloWorld}',
|
'Тестовое слово bold: ${context.l10n.helloWorld}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: context.colors.testColor,
|
color: context.appColors.testColor,
|
||||||
fontFamily: Assets.fonts.montserratBold,
|
fontFamily: Assets.fonts.montserratBold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -44,7 +45,7 @@ class LangScreen extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'Тестовое слово medium: ${context.l10n.helloWorld}',
|
'Тестовое слово medium: ${context.l10n.helloWorld}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: context.colors.testColor,
|
color: context.appColors.testColor,
|
||||||
fontFamily: FontFamily.montserrat,
|
fontFamily: FontFamily.montserrat,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:friflex_starter/app/app_context_ext.dart';
|
import 'package:friflex_starter/app/app_context_ext.dart';
|
||||||
|
import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
|
||||||
|
|
||||||
/// {@template ThemeScreen}
|
/// {@template ThemeScreen}
|
||||||
/// Экран для отладки темы приложения
|
/// Экран для отладки темы приложения
|
||||||
@@ -10,7 +11,7 @@ class ThemeScreen extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final colors = context.colors;
|
final colors = context.appColors;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Theme')),
|
appBar: AppBar(title: const Text('Theme')),
|
||||||
body: Center(
|
body: Center(
|
||||||
@@ -25,7 +26,7 @@ class ThemeScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
ColoredBox(
|
ColoredBox(
|
||||||
color: context.colors.testColor,
|
color: context.appColors.testColor,
|
||||||
child: const SizedBox(height: 100, width: 100),
|
child: const SizedBox(height: 100, width: 100),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|||||||
Reference in New Issue
Block a user