From 26a5fdef923bc68b8cb6de4cc5bb99c1787122fa Mon Sep 17 00:00:00 2001 From: Yuri Petrov <48598325+petrovyuri@users.noreply.github.com> Date: Sat, 7 Jun 2025 18:28:31 +0300 Subject: [PATCH] =?UTF-8?q?refactor(app=5Fsnackbar):=20=D0=98=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=82=D1=8C=20=D1=81=D1=82=D0=B8=D0=BB=D1=8C?= =?UTF-8?q?=20=D1=81=D0=BD=D0=B5=D0=BA=D0=B1=D0=B0=D1=80=D0=B0,=20=D1=83?= =?UTF-8?q?=D0=BB=D1=83=D1=87=D1=88=D0=B8=D0=B2=20=D0=B5=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=B2=D0=BD=D0=B5=D1=88=D0=BD=D0=B8=D0=B9=20=D0=B2=D0=B8=D0=B4?= =?UTF-8?q?.=20(#11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: PetrovY --- .vscode/launch.json | 42 ++------------ lib/app/ui_kit/app_snackbar.dart | 58 ++++++++++---------- lib/features/debug/screens/debug_screen.dart | 7 +++ 3 files changed, 42 insertions(+), 65 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7f0c0a7..6cba823 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,47 +7,17 @@ "request": "launch", "program": "${workspaceFolder}/lib/targets/dev.dart" }, - { "name": "stage", "type": "dart", "request": "launch", "program": "${workspaceFolder}/lib/targets/stage.dart" }, - // { - // "name": "GMS_stage", - // "type": "dart", - // "request": "launch", - // "program": "${workspaceFolder}/lib/targets/stage.dart", - // "preLaunchTask": "switch_to_gms" - // }, - // { - // "name": "GMS_prod", - // "type": "dart", - // "request": "launch", - // "program": "${workspaceFolder}/lib/targets/prod.dart", - // "preLaunchTask": "switch_to_gms" - // }, - // { - // "name": "Aurora_dev", - // "type": "dart", - // "request": "launch", - // "program": "${workspaceFolder}/lib/targets/dev.dart", - // "preLaunchTask": "switch_to_aurora" - // }, - // { - // "name": "Aurora_stage", - // "type": "dart", - // "request": "launch", - // "program": "${workspaceFolder}/lib/targets/stage.dart", - // "preLaunchTask": "switch_to_aurora" - // }, - // { - // "name": "Aurora_prod", - // "type": "dart", - // "request": "launch", - // "program": "${workspaceFolder}/lib/targets/prod.dart", - // "preLaunchTask": "switch_to_aurora" - // }, + { + "name": "prod", + "type": "dart", + "request": "launch", + "program": "${workspaceFolder}/lib/targets/prod.dart" + }, ] } \ No newline at end of file diff --git a/lib/app/ui_kit/app_snackbar.dart b/lib/app/ui_kit/app_snackbar.dart index 668faa0..065b9bb 100644 --- a/lib/app/ui_kit/app_snackbar.dart +++ b/lib/app/ui_kit/app_snackbar.dart @@ -198,38 +198,37 @@ class _AppSnackBarState extends State animation: _slideAnimation, builder: (context, child) { return Positioned( + left: 0, + right: 0, top: _slideAnimation.value, child: Material( - color: Colors.transparent, - child: Center( - child: GestureDetector( - onTap: _dismiss, - behavior: HitTestBehavior.opaque, - child: Container( - constraints: const BoxConstraints(maxWidth: 350), - margin: const EdgeInsets.symmetric(horizontal: 16), - decoration: BoxDecoration( - color: _getBackgroundColor(widget.type), - borderRadius: BorderRadius.circular(16), - ), - padding: const EdgeInsets.symmetric( - vertical: 16, - horizontal: 16, - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - _Icon(type: widget.type), - const WBox(10), - Flexible( - child: Text( - widget.message, - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), + child: GestureDetector( + onTap: _dismiss, + behavior: HitTestBehavior.opaque, + child: Container( + constraints: const BoxConstraints(maxWidth: 350), + margin: const EdgeInsets.symmetric(horizontal: 16), + decoration: BoxDecoration( + color: _getBackgroundColor(widget.type), + borderRadius: BorderRadius.circular(16), + ), + padding: const EdgeInsets.symmetric( + vertical: 12, + horizontal: 16, + ), + child: Row( + children: [ + _Icon(type: widget.type), + const WBox(10), + Flexible( + child: Text( + widget.message, + style: TextStyle(color: Colors.white), + maxLines: 3, + overflow: TextOverflow.ellipsis, ), - ], - ), + ), + ], ), ), ), @@ -250,6 +249,7 @@ class _AppSnackBarState extends State }; } } + /// {@template _Icon} /// Виджет для отображения иконки в снекбаре /// Используется для отображения иконки в зависимости от типа снекбара diff --git a/lib/features/debug/screens/debug_screen.dart b/lib/features/debug/screens/debug_screen.dart index 47ebb25..ec070fb 100644 --- a/lib/features/debug/screens/debug_screen.dart +++ b/lib/features/debug/screens/debug_screen.dart @@ -67,6 +67,13 @@ class DebugScreen extends StatelessWidget { }, child: const Text('Экран локализации'), ), + const HBox(16), + ElevatedButton( + onPressed: () { + context.pushNamed(DebugRoutes.componentsScreenName); + }, + child: const Text('Экран компонентов'), + ), const HBox(22), const Text('Имитирование ошибок:'), const HBox(16),