File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # 0.8.0
2+
3+ ## Feat
4+
5+ - Added ` padding ` to ` Snacky `
6+ - Added ` openUntilClosed ` and ` canBeClosed ` as an option for a ` Snacky.widget `
7+
18# 0.7.0
29
310## Feat
Original file line number Diff line number Diff line change @@ -141,6 +141,26 @@ class SnackyExampleScreen extends StatelessWidget {
141141 controller.showMessage ((context) => snacky);
142142 },
143143 ),
144+ ImpaktfullButton .accent (
145+ label: 'show custom widget that will still open until closed' ,
146+ onTap: () {
147+ final snacky = Snacky .widget (
148+ builder: (context, cancelabelSnacky) => Container (
149+ color: const Color (0xFF7D64F2 ),
150+ padding: const EdgeInsets .all (16 ),
151+ child: const Text (
152+ 'This is a custom widget' ,
153+ style: TextStyle (color: Colors .white),
154+ ),
155+ ),
156+ location: SnackyLocation .bottom,
157+ canBeClosed: true ,
158+ openUntillClosed: true ,
159+ padding: const EdgeInsets .only (bottom: kBottomNavigationBarHeight),
160+ );
161+ controller.showMessage ((context) => snacky);
162+ },
163+ ),
144164 ImpaktfullButton .primary (
145165 label: 'cancel all snackies' ,
146166 onTap: () => controller.cancelAll (),
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ class Snacky {
1818 final Duration transitionDuration;
1919 final Curve transitionCurve;
2020 final SnackyLocation ? location;
21+ final EdgeInsets ? padding;
2122
2223 final Widget Function (BuildContext , CancelableSnacky )? builder;
2324 final EdgeInsetsGeometry ? margin;
@@ -43,6 +44,7 @@ class Snacky {
4344 this .transitionCurve = Curves .easeInOut,
4445 this .margin,
4546 this .location,
47+ this .padding,
4648 }) : builder = null ,
4749 _showDuration = showDuration;
4850
@@ -53,14 +55,15 @@ class Snacky {
5355 this .transitionCurve = Curves .easeInOut,
5456 this .margin,
5557 this .location,
58+ this .openUntillClosed = false ,
59+ this .canBeClosed = false ,
60+ this .padding,
5661 }) : title = '' ,
5762 _showDuration = showDuration,
5863 type = SnackyType .info,
5964 subtitle = null ,
6065 leadingWidgetBuilder = null ,
6166 trailingWidgetBuilder = null ,
6267 bottomWidgetBuilder = null ,
63- onTap = null ,
64- canBeClosed = false ,
65- openUntillClosed = false ;
68+ onTap = null ;
6669}
Original file line number Diff line number Diff line change @@ -55,17 +55,20 @@ class _SnackyConfiguratorWidgetState extends State<SnackyConfiguratorWidget>
5555 final snackyLocation =
5656 layoutConfig.getSnackyLocation (context, activeSnacky.snacky);
5757 return Builder (
58- builder: (context) => Stack (
59- key: ValueKey (activeSnacky.hashCode),
60- alignment: snackyLocation.alignment,
61- children: [
62- widget.snackyBuilder.build (
63- context,
64- layoutConfig,
65- activeSnacky,
66- snackyController,
67- ),
68- ],
58+ builder: (context) => Padding (
59+ padding: activeSnacky.snacky.padding ?? EdgeInsets .zero,
60+ child: Stack (
61+ key: ValueKey (activeSnacky.hashCode),
62+ alignment: snackyLocation.alignment,
63+ children: [
64+ widget.snackyBuilder.build (
65+ context,
66+ layoutConfig,
67+ activeSnacky,
68+ snackyController,
69+ ),
70+ ],
71+ ),
6972 ),
7073 );
7174 }
You can’t perform that action at this time.
0 commit comments