show method

dynamic show({
  1. String message = '',
  2. bool barrierDismissible = false,
})

barrierDismissible Determines whether the dialog closes when the back button or screen is clicked. Default: false

Implementation

show({
  String message = '',
  bool barrierDismissible = false,
}) {
  _dialogIsOpen = true;
  _message.value = message;
  return showDialog(
    barrierDismissible: barrierDismissible,
    context: _context,
    builder: (context) => PopScope(
      child: AlertDialog(
        content: ValueListenableBuilder<double?>(
          valueListenable: _progress,
          builder: (BuildContext context, double? value, Widget? child) {
            return Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Row(
                  children: [
                    syncStyle == AtSyncStyle.material
                        ? AtSyncIndicator(
                            radius: 16,
                            value: value,
                            color: indicatorColor,
                          )
                        : cupertino.AtSyncIndicator(
                            radius: 16,
                            value: value,
                            color: indicatorColor,
                          ),
                    Expanded(
                      child: Padding(
                        padding: const EdgeInsets.only(
                          left: 15.0,
                          top: 8.0,
                          bottom: 8.0,
                        ),
                        child: Text(
                          _message.value,
                          overflow: TextOverflow.ellipsis,
                          style: messageStyle ??
                              const TextStyle(
                                fontWeight: FontWeight.bold,
                              ),
                        ),
                      ),
                    ),
                  ],
                ),
                Visibility(
                  visible: _progress.value != null,
                  child: Align(
                    alignment: Alignment.bottomRight,
                    child: Text(
                      '${((_progress.value ?? 0) * 100).toInt()}%',
                      style: valueStyle ?? const TextStyle(),
                    ),
                  ),
                ),
              ],
            );
          },
        ),
      ),
      // ignore: deprecated_member_use
      onPopInvoked: (didPop) => Future.value(
        barrierDismissible,
      ),
    ),
  );
}