mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 01:20:46 +00:00
feat(app): Добавить снекбар
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:friflex_starter/features/debug/screens/components_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/debug_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/icons_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/lang_screen.dart';
|
||||
@@ -18,6 +19,7 @@ abstract final class DebugRoutes {
|
||||
static const String iconsScreenName = 'icons_screen';
|
||||
static const String themeScreenName = 'theme_screen';
|
||||
static const String langScreenName = 'lang_screen';
|
||||
static const String componentsScreenName = 'components_screen';
|
||||
|
||||
/// Пути к экранам
|
||||
static const String debugScreenPath = '/debug';
|
||||
@@ -26,6 +28,7 @@ abstract final class DebugRoutes {
|
||||
static const String iconsScreenPath = 'debug/icons';
|
||||
static const String themeScreenPath = 'debug/theme';
|
||||
static const String langScreenPath = 'debug/lang';
|
||||
static const String componentsScreenPath = 'debug/components';
|
||||
|
||||
/// Метод для создания роутов для отладки
|
||||
///
|
||||
@@ -62,6 +65,11 @@ abstract final class DebugRoutes {
|
||||
name: langScreenName,
|
||||
builder: (context, state) => const LangScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: componentsScreenPath,
|
||||
name: componentsScreenName,
|
||||
builder: (context, state) => const ComponentsScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
52
lib/features/debug/screens/components_screen.dart
Normal file
52
lib/features/debug/screens/components_screen.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
||||
import 'package:friflex_starter/app/ui_kit/app_snackbar.dart';
|
||||
|
||||
/// {@template ComponentsScreen}
|
||||
/// Экран для демонстрации компонентов приложения.
|
||||
/// {@endtemplate}
|
||||
class ComponentsScreen extends StatefulWidget {
|
||||
/// {@macro ComponentsScreen}
|
||||
const ComponentsScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ComponentsScreen> createState() => _ComponentsScreenState();
|
||||
}
|
||||
|
||||
class _ComponentsScreenState extends State<ComponentsScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Компоненты')),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const HBox(16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AppSnackBar.showError(
|
||||
context,
|
||||
message:
|
||||
'Произошла ошибка, это просто длинное сообщение, для проверки, которое занимает 3 строчки',
|
||||
);
|
||||
},
|
||||
child: const Text('Показать снекбар с ошибкой'),
|
||||
),
|
||||
const HBox(16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AppSnackBar.showSuccess(
|
||||
context: context,
|
||||
message:
|
||||
'Все супер, это просто длинное сообщение, для проверки, которое занимает 3 строчки',
|
||||
);
|
||||
},
|
||||
child: const Text('Показать снекбар с успехом'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:friflex_starter/app/app_box.dart';
|
||||
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
||||
import 'package:friflex_starter/app/app_context_ext.dart';
|
||||
import 'package:friflex_starter/features/debug/debug_routes.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
/// {@template debug_screen}
|
||||
/// Экран для отладки приложения
|
||||
/// {@endtemplate}
|
||||
class DebugScreen extends StatelessWidget {
|
||||
const DebugScreen({super.key});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:friflex_starter/app/app_box.dart';
|
||||
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
||||
import 'package:friflex_starter/gen/assets.gen.dart';
|
||||
|
||||
/// {@template IconsScreen}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:friflex_starter/app/app_box.dart';
|
||||
import 'package:friflex_starter/app/ui_kit/app_box.dart';
|
||||
import 'package:friflex_starter/features/main/presentation/main_routes.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user