mirror of
https://github.com/kphanipavan/modal_progress_hud_nsn.git
synced 2025-10-29 06:42:50 -07:00
added blur support
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
## 0.3.0
|
||||
|
||||
- Added blur option for background blur
|
||||
- Attempted a fix for missed dart formatting
|
||||
|
||||
## 0.2.1
|
||||
|
||||
- Minor fixes in README file.
|
||||
|
||||
16
README.md
16
README.md
@@ -4,13 +4,13 @@ A simple widget wrapper to enable modal progress HUD (a modal progress indicator
|
||||
|
||||
[](https://pub.dartlang.org/packages/modal_progress_hud_nsn)
|
||||
|
||||
Inspired by [this](https://codingwithjoe.com/flutter-how-to-build-a-modal-progress-indicator/) article.
|
||||
~~Inspired by [this](https://codingwithjoe.com/flutter-how-to-build-a-modal-progress-indicator/) article.~~ Link broken, Dont click.
|
||||
|
||||
A fork of [this](https://github.com/mmcc007/modal_progress_hud) with support for Null Safety.
|
||||
|
||||
## Demo
|
||||
|
||||

|
||||

|
||||
|
||||
_See example for details_
|
||||
|
||||
@@ -20,7 +20,7 @@ Add the package to your `pubspec.yml` file.
|
||||
|
||||
```yml
|
||||
dependencies:
|
||||
modal_progress_hud_nsn: ^0.2.1
|
||||
modal_progress_hud_nsn: ^0.3.0
|
||||
```
|
||||
|
||||
Next, import the library into your widget.
|
||||
@@ -59,9 +59,17 @@ ModalProgressHUD(
|
||||
progressIndicator: CircularProgressIndicator,
|
||||
offset: double
|
||||
dismissible: bool,
|
||||
blur: double,
|
||||
);
|
||||
```
|
||||
|
||||
## Similar Packages
|
||||
|
||||
* [modal_progress_hud](https://pub.dev/packages/modal_progress_hud) : Original
|
||||
* [modal_progress_hud_alt](https://pub.dev/packages/modal_progress_hud_alt) : Alternative
|
||||
* [blurry_modal_progress_hud](https://pub.dev/packages/blurry_modal_progress_hud) : With blur
|
||||
* [flutter_progress_hud](https://pub.dev/packages/flutter_progress_hud) : With fade
|
||||
|
||||
## Example
|
||||
|
||||
Here is an example app that demonstrates the usage.
|
||||
@@ -138,7 +146,7 @@ for a complete sample app using the modal progress HUD. Included in the
|
||||
example is a method for using a form's validators while making async
|
||||
calls (see [flutter/issues/9688](https://github.com/flutter/flutter/issues/9688) for details).
|
||||
|
||||
### Issues and feedback
|
||||
## Issues and feedback
|
||||
|
||||
Please file [issues](https://github.com/kphanipavan/modal_progress_hud_nsn/issues/new)
|
||||
to send feedback or report a bug. Thank you!
|
||||
@@ -43,6 +43,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
String? _username;
|
||||
String? _password;
|
||||
bool _isLoggedIn = false;
|
||||
double bur = 0;
|
||||
|
||||
// validate user name
|
||||
String? _validateUserName(String? userName) {
|
||||
@@ -135,13 +136,16 @@ class _LoginPageState extends State<LoginPage> {
|
||||
inAsyncCall: _isInAsyncCall,
|
||||
// demo of some additional parameters
|
||||
opacity: 0.5,
|
||||
blur: bur,
|
||||
progressIndicator: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildLoginForm(BuildContext context) {
|
||||
final TextTheme textTheme = Theme.of(context).textTheme;
|
||||
final TextTheme textTheme = Theme
|
||||
.of(context)
|
||||
.textTheme;
|
||||
// run the validators on reload to process async results
|
||||
_loginFormKey.currentState?.validate();
|
||||
return Form(
|
||||
@@ -182,18 +186,27 @@ class _LoginPageState extends State<LoginPage> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: _isLoggedIn
|
||||
? Text(
|
||||
'Login successful!',
|
||||
key: Key('loggedIn'),
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
)
|
||||
'Login successful!',
|
||||
key: Key('loggedIn'),
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
)
|
||||
: Text(
|
||||
'Not logged in',
|
||||
key: Key('notLoggedIn'),
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
),
|
||||
'Not logged in',
|
||||
key: Key('notLoggedIn'),
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
),
|
||||
),
|
||||
Slider(min: 0,
|
||||
max: 10,
|
||||
value: bur,
|
||||
divisions: 100,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
bur = val;
|
||||
});
|
||||
},),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
modal_progress_hud_nsn
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
@@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
|
||||
@@ -42,7 +42,7 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -56,7 +56,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -94,7 +94,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -108,14 +108,14 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.2.1"
|
||||
version: "0.3.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -127,7 +127,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -162,21 +162,14 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "0.4.9"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-0 <3.0.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
@@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
modal_progress_hud_nsn
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
@@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
library modal_progress_hud;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:ui';
|
||||
|
||||
///
|
||||
/// Wrap around any widget that makes an async call to show a modal progress
|
||||
@@ -31,6 +32,9 @@ class ModalProgressHUD extends StatelessWidget {
|
||||
/// A [Widget] which should be the the widget to be shown behind the loading barrier.
|
||||
final Widget child;
|
||||
|
||||
/// A [double] value specifying the amount of background blur of the progress.
|
||||
final double blur;
|
||||
|
||||
const ModalProgressHUD({
|
||||
Key? key,
|
||||
required this.inAsyncCall,
|
||||
@@ -40,6 +44,7 @@ class ModalProgressHUD extends StatelessWidget {
|
||||
this.offset,
|
||||
this.dismissible = false,
|
||||
required this.child,
|
||||
this.blur = 0.0,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -60,12 +65,15 @@ class ModalProgressHUD extends StatelessWidget {
|
||||
return Stack(
|
||||
children: [
|
||||
child,
|
||||
Opacity(
|
||||
child: ModalBarrier(dismissible: dismissible, color: color),
|
||||
opacity: opacity,
|
||||
BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
|
||||
child: Opacity(
|
||||
child: ModalBarrier(dismissible: dismissible, color: color),
|
||||
opacity: opacity,
|
||||
),
|
||||
),
|
||||
layOutProgressIndicator,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: modal_progress_hud_nsn
|
||||
description: A modal progress indicator widget with Sound Null Safety. A fork of https://github.com/mmcc007/modal_progress_hud
|
||||
version: 0.2.1
|
||||
version: 0.3.0
|
||||
#author: Phani Pavan K
|
||||
homepage: https://github.com/kphanipavan/modal_progress_hud_nsn
|
||||
|
||||
|
||||
Reference in New Issue
Block a user