refactor(app_snackbar): Изменить стиль снекбара, улучшив его внешний вид. (#11)

Co-authored-by: PetrovY <y.petrov@friflex.com>
This commit is contained in:
Yuri Petrov
2025-06-07 18:28:31 +03:00
committed by GitHub
parent 9ddeb73852
commit 26a5fdef92
3 changed files with 42 additions and 65 deletions

42
.vscode/launch.json vendored
View File

@@ -7,47 +7,17 @@
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/lib/targets/dev.dart" "program": "${workspaceFolder}/lib/targets/dev.dart"
}, },
{ {
"name": "stage", "name": "stage",
"type": "dart", "type": "dart",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/lib/targets/stage.dart" "program": "${workspaceFolder}/lib/targets/stage.dart"
}, },
// { {
// "name": "GMS_stage", "name": "prod",
// "type": "dart", "type": "dart",
// "request": "launch", "request": "launch",
// "program": "${workspaceFolder}/lib/targets/stage.dart", "program": "${workspaceFolder}/lib/targets/prod.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"
// },
] ]
} }

View File

@@ -198,38 +198,37 @@ class _AppSnackBarState extends State<AppSnackBar>
animation: _slideAnimation, animation: _slideAnimation,
builder: (context, child) { builder: (context, child) {
return Positioned( return Positioned(
left: 0,
right: 0,
top: _slideAnimation.value, top: _slideAnimation.value,
child: Material( child: Material(
color: Colors.transparent, child: GestureDetector(
child: Center( onTap: _dismiss,
child: GestureDetector( behavior: HitTestBehavior.opaque,
onTap: _dismiss, child: Container(
behavior: HitTestBehavior.opaque, constraints: const BoxConstraints(maxWidth: 350),
child: Container( margin: const EdgeInsets.symmetric(horizontal: 16),
constraints: const BoxConstraints(maxWidth: 350), decoration: BoxDecoration(
margin: const EdgeInsets.symmetric(horizontal: 16), color: _getBackgroundColor(widget.type),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(16),
color: _getBackgroundColor(widget.type), ),
borderRadius: BorderRadius.circular(16), padding: const EdgeInsets.symmetric(
), vertical: 12,
padding: const EdgeInsets.symmetric( horizontal: 16,
vertical: 16, ),
horizontal: 16, child: Row(
), children: [
child: Row( _Icon(type: widget.type),
mainAxisSize: MainAxisSize.min, const WBox(10),
children: [ Flexible(
_Icon(type: widget.type), child: Text(
const WBox(10), widget.message,
Flexible( style: TextStyle(color: Colors.white),
child: Text( maxLines: 3,
widget.message, overflow: TextOverflow.ellipsis,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
), ),
], ),
), ],
), ),
), ),
), ),
@@ -250,6 +249,7 @@ class _AppSnackBarState extends State<AppSnackBar>
}; };
} }
} }
/// {@template _Icon} /// {@template _Icon}
/// Виджет для отображения иконки в снекбаре /// Виджет для отображения иконки в снекбаре
/// Используется для отображения иконки в зависимости от типа снекбара /// Используется для отображения иконки в зависимости от типа снекбара

View File

@@ -67,6 +67,13 @@ class DebugScreen extends StatelessWidget {
}, },
child: const Text('Экран локализации'), child: const Text('Экран локализации'),
), ),
const HBox(16),
ElevatedButton(
onPressed: () {
context.pushNamed(DebugRoutes.componentsScreenName);
},
child: const Text('Экран компонентов'),
),
const HBox(22), const HBox(22),
const Text('Имитирование ошибок:'), const Text('Имитирование ошибок:'),
const HBox(16), const HBox(16),