Showing
3 changed files
with
45 additions
and
35 deletions
1 | +## [2.2.6] | ||
2 | +- Fix cancel button on defaultDialog don't appear when widget implementation usage | ||
3 | + | ||
4 | +## [2.2.5] | ||
5 | +- Refator defaultDialog | ||
6 | + | ||
7 | +## [2.2.4] | ||
8 | +- Clean code | ||
9 | +- Fix Get.LazyPut | ||
10 | + | ||
11 | +## [2.2.3] | ||
12 | +- Remove defaultDialog type | ||
13 | + | ||
1 | ## [2.2.2] | 14 | ## [2.2.2] |
2 | - Fix GetRoute not found | 15 | - Fix GetRoute not found |
3 | 16 |
@@ -251,26 +251,36 @@ class Get { | @@ -251,26 +251,36 @@ class Get { | ||
251 | double radius = 20.0, | 251 | double radius = 20.0, |
252 | List<Widget> actions, | 252 | List<Widget> actions, |
253 | }) { | 253 | }) { |
254 | - Widget cancelButton = cancel ?? (onCancel != null || textCancel != null) | ||
255 | - ? FlatButton( | ||
256 | - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, | ||
257 | - onPressed: () { | ||
258 | - onCancel?.call(); | ||
259 | - Get.back(); | ||
260 | - }, | ||
261 | - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), | ||
262 | - child: Text(textConfirm ?? "Cancel"), | ||
263 | - shape: RoundedRectangleBorder( | ||
264 | - side: BorderSide( | ||
265 | - color: buttonColor ?? Get.theme.accentColor, | ||
266 | - width: 2, | ||
267 | - style: BorderStyle.solid), | ||
268 | - borderRadius: BorderRadius.circular(100)), | ||
269 | - ) | ||
270 | - : null; | 254 | + bool leanCancel = onCancel != null || textCancel != null; |
255 | + bool leanConfirm = onConfirm != null || textConfirm != null; | ||
256 | + actions ??= []; | ||
271 | 257 | ||
272 | - Widget confirmButton = confirm ?? (onConfirm != null || textConfirm != null) | ||
273 | - ? FlatButton( | 258 | + if (cancel != null) { |
259 | + actions.add(cancel); | ||
260 | + } else { | ||
261 | + if (leanCancel) { | ||
262 | + actions.add(FlatButton( | ||
263 | + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, | ||
264 | + onPressed: () { | ||
265 | + onCancel?.call(); | ||
266 | + Get.back(); | ||
267 | + }, | ||
268 | + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8), | ||
269 | + child: Text(textCancel ?? "Cancel"), | ||
270 | + shape: RoundedRectangleBorder( | ||
271 | + side: BorderSide( | ||
272 | + color: buttonColor ?? Get.theme.accentColor, | ||
273 | + width: 2, | ||
274 | + style: BorderStyle.solid), | ||
275 | + borderRadius: BorderRadius.circular(100)), | ||
276 | + )); | ||
277 | + } | ||
278 | + } | ||
279 | + if (confirm != null) { | ||
280 | + actions.add(confirm); | ||
281 | + } else { | ||
282 | + if (leanConfirm) { | ||
283 | + actions.add(FlatButton( | ||
274 | materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, | 284 | materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, |
275 | color: buttonColor ?? Get.theme.accentColor, | 285 | color: buttonColor ?? Get.theme.accentColor, |
276 | shape: RoundedRectangleBorder( | 286 | shape: RoundedRectangleBorder( |
@@ -278,15 +288,7 @@ class Get { | @@ -278,15 +288,7 @@ class Get { | ||
278 | child: Text(textConfirm ?? "Ok"), | 288 | child: Text(textConfirm ?? "Ok"), |
279 | onPressed: () { | 289 | onPressed: () { |
280 | onConfirm?.call(); | 290 | onConfirm?.call(); |
281 | - }) | ||
282 | - : null; | ||
283 | - if (actions == null) { | ||
284 | - actions = []; | ||
285 | - if (cancelButton != null) { | ||
286 | - actions.add(cancelButton); | ||
287 | - } | ||
288 | - if (confirmButton != null) { | ||
289 | - actions.add(confirmButton); | 291 | + })); |
290 | } | 292 | } |
291 | } | 293 | } |
292 | return Get.dialog(AlertDialog( | 294 | return Get.dialog(AlertDialog( |
@@ -596,12 +598,7 @@ class Get { | @@ -596,12 +598,7 @@ class Get { | ||
596 | 598 | ||
597 | Map<dynamic, _FcBuilderFunc> _factory = {}; | 599 | Map<dynamic, _FcBuilderFunc> _factory = {}; |
598 | 600 | ||
599 | - static void lazyPut<S>(Object instance) { | ||
600 | - final lazy = () => instance; | ||
601 | - Get()._factory.putIfAbsent(S, () => lazy); | ||
602 | - } | ||
603 | - | ||
604 | - static void lazyPutBuilder<S>(_FcBuilderFunc function) { | 601 | + static void lazyPut<S>(_FcBuilderFunc function) { |
605 | Get()._factory.putIfAbsent(S, () => function); | 602 | Get()._factory.putIfAbsent(S, () => function); |
606 | } | 603 | } |
607 | 604 |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get. | 2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get. |
3 | -version: 2.2.2 | 3 | +version: 2.2.6 |
4 | homepage: https://github.com/jonataslaw/get | 4 | homepage: https://github.com/jonataslaw/get |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment