Committed by
GitHub
Merge pull request #2022 from jonataslaw/4.5.1
bump to 4.5.1
Showing
4 changed files
with
40 additions
and
6 deletions
1 | +## [4.5.1] - Big Update | ||
2 | +Fix Snackbar when it have action and icon the same time | ||
3 | + | ||
1 | ## [4.5.0] - Big Update | 4 | ## [4.5.0] - Big Update |
2 | To have a context-free, page-agnostic snackbar, we used OverlayRoute to display a partial route. | 5 | To have a context-free, page-agnostic snackbar, we used OverlayRoute to display a partial route. |
3 | However this had several problems: | 6 | However this had several problems: |
@@ -560,7 +560,7 @@ You need to either use message[String], or messageText[Widget] or define a userI | @@ -560,7 +560,7 @@ You need to either use message[String], or messageText[Widget] or define a userI | ||
560 | mainAxisSize: MainAxisSize.max, | 560 | mainAxisSize: MainAxisSize.max, |
561 | children: [ | 561 | children: [ |
562 | _buildLeftBarIndicator(), | 562 | _buildLeftBarIndicator(), |
563 | - if (_rowStyle == RowStyle.icon) | 563 | + if (_rowStyle == RowStyle.icon || _rowStyle == RowStyle.all) |
564 | ConstrainedBox( | 564 | ConstrainedBox( |
565 | constraints: | 565 | constraints: |
566 | BoxConstraints.tightFor(width: 42.0 + iconPadding), | 566 | BoxConstraints.tightFor(width: 42.0 + iconPadding), |
@@ -608,7 +608,7 @@ You need to either use message[String], or messageText[Widget] or define a userI | @@ -608,7 +608,7 @@ You need to either use message[String], or messageText[Widget] or define a userI | ||
608 | ], | 608 | ], |
609 | ), | 609 | ), |
610 | ), | 610 | ), |
611 | - if (_rowStyle == RowStyle.action) | 611 | + if (_rowStyle == RowStyle.action || _rowStyle == RowStyle.all) |
612 | Padding( | 612 | Padding( |
613 | padding: EdgeInsets.only(right: buttonPadding), | 613 | padding: EdgeInsets.only(right: buttonPadding), |
614 | child: widget.mainButton, | 614 | child: widget.mainButton, |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. | 2 | description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. |
3 | -version: 4.5.0 | 3 | +version: 4.5.1 |
4 | homepage: https://github.com/jonataslaw/getx | 4 | homepage: https://github.com/jonataslaw/getx |
5 | 5 | ||
6 | environment: | 6 | environment: |
@@ -115,9 +115,6 @@ void main() { | @@ -115,9 +115,6 @@ void main() { | ||
115 | onTap: () { | 115 | onTap: () { |
116 | getBar = GetSnackBar( | 116 | getBar = GetSnackBar( |
117 | message: 'bar1', | 117 | message: 'bar1', |
118 | - icon: Icon(Icons.alarm), | ||
119 | - mainButton: | ||
120 | - TextButton(onPressed: () {}, child: Text('button')), | ||
121 | duration: const Duration(seconds: 2), | 118 | duration: const Duration(seconds: 2), |
122 | isDismissible: true, | 119 | isDismissible: true, |
123 | dismissDirection: dismissDirection, | 120 | dismissDirection: dismissDirection, |
@@ -212,4 +209,38 @@ void main() { | @@ -212,4 +209,38 @@ void main() { | ||
212 | await tester.pump(const Duration(milliseconds: 3000)); | 209 | await tester.pump(const Duration(milliseconds: 3000)); |
213 | await getBarController.close(withAnimations: false); | 210 | await getBarController.close(withAnimations: false); |
214 | }); | 211 | }); |
212 | + | ||
213 | + testWidgets("Get test actions and icon", (tester) async { | ||
214 | + final icon = Icon(Icons.alarm); | ||
215 | + final action = TextButton(onPressed: () {}, child: Text('button')); | ||
216 | + | ||
217 | + late final GetSnackBar getBar; | ||
218 | + | ||
219 | + await tester.pumpWidget(GetMaterialApp(home: Scaffold())); | ||
220 | + | ||
221 | + expect(Get.isSnackbarOpen, false); | ||
222 | + expect(find.text('bar1'), findsNothing); | ||
223 | + | ||
224 | + getBar = GetSnackBar( | ||
225 | + message: 'bar1', | ||
226 | + icon: icon, | ||
227 | + mainButton: action, | ||
228 | + leftBarIndicatorColor: Colors.yellow, | ||
229 | + showProgressIndicator: true, | ||
230 | + // maxWidth: 100, | ||
231 | + borderColor: Colors.red, | ||
232 | + duration: const Duration(seconds: 1), | ||
233 | + isDismissible: false, | ||
234 | + ); | ||
235 | + Get.showSnackbar(getBar); | ||
236 | + | ||
237 | + expect(Get.isSnackbarOpen, true); | ||
238 | + await tester.pump(const Duration(milliseconds: 500)); | ||
239 | + expect(find.byWidget(getBar), findsOneWidget); | ||
240 | + expect(find.byWidget(icon), findsOneWidget); | ||
241 | + expect(find.byWidget(action), findsOneWidget); | ||
242 | + await tester.pump(const Duration(milliseconds: 500)); | ||
243 | + | ||
244 | + expect(Get.isSnackbarOpen, false); | ||
245 | + }); | ||
215 | } | 246 | } |
-
Please register or login to post a comment