Skip to content

Commit

Permalink
Prepare for update 4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nizwar committed Dec 16, 2024
1 parent 6a70e8b commit 15de31d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 71 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/ndialog.dart
Original file line number Diff line number Diff line change
@@ -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';
File renamed without changes.
81 changes: 20 additions & 61 deletions lib/src/ndialogBase.dart → lib/src/ndialog_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class NDialog extends StatelessWidget {
///The (optional) set of actions that are displayed at the bottom of the dialog.
final List<Widget>? 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) {
Expand Down Expand Up @@ -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(),
Expand All @@ -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()),
),
),
)
Expand All @@ -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),
),
),
),
Expand All @@ -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());
},
),
),
Expand All @@ -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),
Expand All @@ -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)),
),
),
),
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<T>(BuildContext context) => showDialog<T>(context: context, builder: (context) => this, barrierColor: barrierColor, barrierDismissible: dismissable ?? true);

Future<T?> show<T>(BuildContext context,
{DialogTransitionType? transitionType,
bool? dismissable,
Duration? transitionDuration}) =>
DialogUtils(
Future<T?> show<T>(BuildContext context, {DialogTransitionType? transitionType, bool? dismissable, Duration? transitionDuration}) => DialogUtils(
child: this,
dialogTransitionType: transitionType,
dismissable: dismissable,
Expand All @@ -338,21 +299,21 @@ 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,
alignment: Alignment.center,
fit: StackFit.expand,
children: <Widget>[
InkWell(
overlayColor: MaterialStateProperty.all(Colors.transparent),
overlayColor: WidgetStatePropertyAll(Colors.transparent),
hoverColor: Colors.transparent,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions lib/src/progressDialog.dart → lib/src/progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/zoom_widget/zoom_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -9,8 +9,7 @@ environment:

dependencies:
flutter:
sdk: flutter
universal_io: ^2.0.4
sdk: flutter

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 15de31d

Please sign in to comment.