From 15de31d00ac77aa00a41476b3b9a5c404210b7d1 Mon Sep 17 00:00:00 2001 From: Mochamad Nizwar Syafuan Date: Mon, 16 Dec 2024 12:04:35 +0700 Subject: [PATCH] Prepare for update 4.4.0 --- CHANGELOG.md | 5 ++ lib/ndialog.dart | 6 +- ...ogExtension.dart => dialog_extension.dart} | 0 .../{ndialogBase.dart => ndialog_base.dart} | 81 +++++-------------- ...ogressDialog.dart => progress_dialog.dart} | 5 +- ...dart => multi_touch_gesture_detector.dart} | 0 lib/src/zoom_widget/zoom_widget.dart | 2 +- pubspec.yaml | 5 +- 8 files changed, 33 insertions(+), 71 deletions(-) rename lib/src/{dialogExtension.dart => dialog_extension.dart} (100%) rename lib/src/{ndialogBase.dart => ndialog_base.dart} (83%) rename lib/src/{progressDialog.dart => progress_dialog.dart} (99%) rename lib/src/zoom_widget/{MultiTouchGestureDetector.dart => multi_touch_gesture_detector.dart} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5f088..492a14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [4.4.0] +* Flutter 3.27.0 support (Thanks to JEuler 🍻) +* Some minors and deprecated adjustments +* Fix Web support + ## [4.3.1] * Update nullsafety examplen and adjustment * Fix Web support diff --git a/lib/ndialog.dart b/lib/ndialog.dart index 0c2d1e8..f1991d0 100644 --- a/lib/ndialog.dart +++ b/lib/ndialog.dart @@ -1,7 +1,7 @@ library ndialog; -export 'src/ndialogBase.dart'; -export 'src/progressDialog.dart'; -export 'src/dialogExtension.dart'; +export 'src/ndialog_base.dart'; +export 'src/progress_dialog.dart'; +export 'src/dialog_extension.dart'; export 'src/transition.dart'; export 'src/utils.dart'; diff --git a/lib/src/dialogExtension.dart b/lib/src/dialog_extension.dart similarity index 100% rename from lib/src/dialogExtension.dart rename to lib/src/dialog_extension.dart diff --git a/lib/src/ndialogBase.dart b/lib/src/ndialog_base.dart similarity index 83% rename from lib/src/ndialogBase.dart rename to lib/src/ndialog_base.dart index 100f9cd..227d834 100644 --- a/lib/src/ndialogBase.dart +++ b/lib/src/ndialog_base.dart @@ -23,9 +23,7 @@ class NDialog extends StatelessWidget { ///The (optional) set of actions that are displayed at the bottom of the dialog. final List? actions; - const NDialog( - {Key? key, this.dialogStyle, this.title, this.content, this.actions}) - : super(key: key); + const NDialog({Key? key, this.dialogStyle, this.title, this.content, this.actions}) : super(key: key); @override Widget build(BuildContext context) { @@ -58,9 +56,7 @@ class NDialog extends StatelessWidget { ) ], ), - style: (style.titleTextStyle ?? - (dialogTheme?.titleTextStyle)) ?? - (theme?.textTheme.titleLarge ?? TextStyle()), + style: (style.titleTextStyle ?? (dialogTheme.titleTextStyle)) ?? (theme!.textTheme.titleLarge ?? TextStyle()), ), ) : SizedBox.shrink(), @@ -70,9 +66,7 @@ class NDialog extends StatelessWidget { padding: style.contentPadding, child: DefaultTextStyle( child: Semantics(child: content), - style: (style.contentTextStyle ?? - dialogTheme?.contentTextStyle) ?? - (theme?.textTheme.titleMedium ?? TextStyle()), + style: (style.contentTextStyle ?? dialogTheme.contentTextStyle) ?? (theme?.textTheme.titleMedium ?? TextStyle()), ), ), ) @@ -82,8 +76,7 @@ class NDialog extends StatelessWidget { data: theme!.copyWith( textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.zero), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero), ), ), ), @@ -96,9 +89,7 @@ class NDialog extends StatelessWidget { children: List.generate( actions?.length ?? 0, (index) { - return Expanded( - child: - actions?[index] ?? SizedBox.shrink()); + return Expanded(child: actions?[index] ?? SizedBox.shrink()); }, ), ), @@ -125,8 +116,7 @@ class NDialog extends StatelessWidget { ); return Padding( - padding: MediaQuery.of(context).viewInsets + - const EdgeInsets.symmetric(horizontal: 20.0, vertical: 24.0), + padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 20.0, vertical: 24.0), child: Center( child: ConstrainedBox( constraints: const BoxConstraints(minWidth: 280.0), @@ -136,12 +126,8 @@ class NDialog extends StatelessWidget { elevation: style.elevation, color: style.backgroundColor ?? theme?.dialogBackgroundColor, shape: style.borderRadius != null - ? RoundedRectangleBorder( - borderRadius: - style.borderRadius ?? BorderRadius.circular(5)) - : style.shape ?? - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0)), + ? RoundedRectangleBorder(borderRadius: style.borderRadius ?? BorderRadius.circular(5)) + : style.shape ?? RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)), ), ), ), @@ -243,15 +229,7 @@ class ZoomDialog extends DialogBackground { ///Action before dialog dismissed final Function? onDismiss; - const ZoomDialog( - {Key? key, - this.backgroundColor, - @required this.child, - this.initZoomScale = 0, - this.blur, - this.zoomScale = 3, - this.onDismiss}) - : super(key: key); + const ZoomDialog({Key? key, this.backgroundColor, @required this.child, this.initZoomScale = 0, this.blur, this.zoomScale = 3, this.onDismiss}) : super(key: key); @override Widget build(BuildContext context) { @@ -305,27 +283,10 @@ class DialogBackground extends StatelessWidget { final Color? barrierColor; - @Deprecated("Use barrierColor instead") - final Color? color; - - const DialogBackground( - {Key? key, - this.dialog, - this.color, - this.dismissable, - this.blur, - this.onDismiss, - this.barrierColor}) - : super(key: key); + const DialogBackground({Key? key, this.dialog, this.dismissable, this.blur, this.onDismiss, this.barrierColor}) : super(key: key); ///Show dialog directly - // Future show(BuildContext context) => showDialog(context: context, builder: (context) => this, barrierColor: barrierColor, barrierDismissible: dismissable ?? true); - - Future show(BuildContext context, - {DialogTransitionType? transitionType, - bool? dismissable, - Duration? transitionDuration}) => - DialogUtils( + Future show(BuildContext context, {DialogTransitionType? transitionType, bool? dismissable, Duration? transitionDuration}) => DialogUtils( child: this, dialogTransitionType: transitionType, dismissable: dismissable, @@ -338,13 +299,13 @@ class DialogBackground extends StatelessWidget { return Material( type: MaterialType.canvas, color: Colors.transparent, - child: WillPopScope( - onWillPop: () async { - if (dismissable ?? true) { - if (onDismiss != null) onDismiss?.call(); - return true; + child: PopScope( + canPop: dismissable ?? true, + onPopInvokedWithResult: (didPop, result) { + if (didPop) { + onDismiss?.call(); + return; } - return false; }, child: Stack( clipBehavior: Clip.antiAlias, @@ -352,7 +313,7 @@ class DialogBackground extends StatelessWidget { fit: StackFit.expand, children: [ InkWell( - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStatePropertyAll(Colors.transparent), hoverColor: Colors.transparent, splashColor: Colors.transparent, highlightColor: Colors.transparent, @@ -422,10 +383,8 @@ class DialogStyle { this.titleDivider = false, this.borderRadius = const BorderRadius.all(Radius.circular(10)), this.semanticsLabel = "", - this.titlePadding = - const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - this.contentPadding = - const EdgeInsets.only(right: 15.0, left: 15.0, top: 0.0, bottom: 15.0), + this.titlePadding = const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), + this.contentPadding = const EdgeInsets.only(right: 15.0, left: 15.0, top: 0.0, bottom: 15.0), this.titleTextStyle, this.contentTextStyle, this.elevation = 24, diff --git a/lib/src/progressDialog.dart b/lib/src/progress_dialog.dart similarity index 99% rename from lib/src/progressDialog.dart rename to lib/src/progress_dialog.dart index 3baa7ba..00b9b7b 100644 --- a/lib/src/progressDialog.dart +++ b/lib/src/progress_dialog.dart @@ -6,9 +6,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ndialog/src/transition.dart'; import 'package:ndialog/src/utils.dart'; -import 'package:universal_io/io.dart'; -import 'ndialogBase.dart'; +import 'ndialog_base.dart'; ///Typedef of Progress while on Progress Error typedef OnProgressError(dynamic error); @@ -587,7 +586,7 @@ class _CustomProgressDialogWidgetState borderRadius: BorderRadius.circular(15), color: Theme.of(context).colorScheme.surface, ), - child: Platform.isIOS + child: Theme.of(context).platform == TargetPlatform.iOS ? CupertinoActivityIndicator() : CircularProgressIndicator(), ); diff --git a/lib/src/zoom_widget/MultiTouchGestureDetector.dart b/lib/src/zoom_widget/multi_touch_gesture_detector.dart similarity index 100% rename from lib/src/zoom_widget/MultiTouchGestureDetector.dart rename to lib/src/zoom_widget/multi_touch_gesture_detector.dart diff --git a/lib/src/zoom_widget/zoom_widget.dart b/lib/src/zoom_widget/zoom_widget.dart index 9808939..130392d 100644 --- a/lib/src/zoom_widget/zoom_widget.dart +++ b/lib/src/zoom_widget/zoom_widget.dart @@ -10,7 +10,7 @@ import 'package:flutter/material.dart'; -import 'MultiTouchGestureDetector.dart'; +import 'multi_touch_gesture_detector.dart'; class Zoom extends StatefulWidget { final double maxZoomWidth, maxZoomHeight; diff --git a/pubspec.yaml b/pubspec.yaml index a7a5cb5..322dd52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ndialog description: Customize your dialog's style much easier with NDialog, animate the show transition, or show the progress dialog most simply. -version: 4.3.1 +version: 4.4.0 homepage: https://nizwar.github.io/ndialog/ repository: https://github.com/nizwar/ndialog @@ -9,8 +9,7 @@ environment: dependencies: flutter: - sdk: flutter - universal_io: ^2.0.4 + sdk: flutter dev_dependencies: flutter_test: