Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
custom_snackbar.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3
4abstract class CustomSnackBar {
5 static ScaffoldFeatureController<SnackBar, SnackBarClosedReason> display(
6 final BuildContext context,
7 final Color color,
8 final String message,
9 ) {
10 return ScaffoldMessenger.of(context).showSnackBar(
12 context: context,
13 color: color,
15 ),
16 );
17 }
18}
19
20SnackBar _buildSnackBar({
21 required String message,
22 required Color color,
23 required BuildContext context,
24}) {
25 return SnackBar(
26 content: Row(
27 children: [
28 Container(
29 height: 40.h,
30 width: 4.w,
31 decoration: BoxDecoration(
32 color: color,
33 borderRadius: BorderRadius.circular(10.r),
34 boxShadow: [
35 BoxShadow(
36 color: color.withValues(alpha: 0.3),
37 blurRadius: 4,
38 spreadRadius: 1,
39 ),
40 ],
41 ),
42 ),
43 SizedBox(width: 12.sp),
44 Expanded(
46 mainAxisSize: MainAxisSize.min,
47 crossAxisAlignment: CrossAxisAlignment.start,
48 children: [
49 Text(
50 message,
51 style: Theme.of(context).textTheme.bodyMedium?.copyWith(
52 fontWeight: FontWeight.w500,
53 letterSpacing: 0.2,
54 ),
55 maxLines: 2,
56 overflow: TextOverflow.ellipsis,
57 ),
58 ],
59 ),
60 ),
61 Container(
62 decoration: BoxDecoration(
63 color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.1),
64 borderRadius: BorderRadius.circular(8.r),
65 ),
66 child: IconButton(
67 icon: Icon(
68 Icons.close_rounded,
69 color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
70 size: 18.sp,
71 ),
72 onPressed: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(),
73 padding: EdgeInsets.all(4.sp),
74 constraints: BoxConstraints(
75 minWidth: 24.w,
76 minHeight: 24.h,
77 ),
78 splashRadius: 20.r,
79 ),
80 ),
81 ],
82 ),
83 backgroundColor: Theme.of(context).colorScheme.surface,
84 elevation: 4.0,
85 duration: const Duration(milliseconds: 2100),
86 padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 14.sp),
87 margin: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 16.sp),
88 behavior: SnackBarBehavior.floating,
89 shape: RoundedRectangleBorder(
90 borderRadius: BorderRadius.circular(14.r),
91 side: BorderSide(
92 color: color.withValues(alpha: 0.2),
93 width: 1,
94 ),
95 ),
96 dismissDirection: DismissDirection.horizontal,
97 animation: CurvedAnimation(
98 parent: const AlwaysStoppedAnimation(1),
99 curve: Curves.fastOutSlowIn,
100 ),
101 );
102}
static ScaffoldFeatureController< SnackBar, SnackBarClosedReason > display(final BuildContext context, final Color color, final String message,)
final Widget child
final EdgeInsets padding
abstract class CustomSnackBar _buildSnackBar({ required String message, required Color color, required BuildContext context, })
class Partner String
final Color color
Definition failures.dart:1
final String message
Definition failures.dart:0
final VoidCallback onPressed
style Text( '${ 'scheduling.reference'.tr()}:${collection.internalCode}', style:Theme.of(context).textTheme.bodySmall,)
style SizedBox(height:2.h)
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)