mirror of
https://github.com/kphanipavan/modal_progress_hud_nsn.git
synced 2025-10-29 06:42:50 -07:00
linting and maintainance
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
## 0.2.1
|
||||||
|
|
||||||
|
- Minor fixes in README file.
|
||||||
|
- Added dartdoc strings.
|
||||||
|
- Fixed most issues to follow dart guidelines.
|
||||||
|
|
||||||
## 0.2.0
|
## 0.2.0
|
||||||
|
|
||||||
- Added support for other platforms.
|
- Added support for other platforms.
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Add the package to your `pubspec.yml` file.
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
dependencies:
|
dependencies:
|
||||||
modal_progress_hud_nsn: ^0.2.0
|
modal_progress_hud_nsn: ^0.2.1
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, import the library into your widget.
|
Next, import the library into your widget.
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
modal_progress_hud_nsn
|
modal_progress_hud_nsn
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
@@ -17,8 +14,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||||
endforeach(plugin)
|
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)
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import modal_progress_hud_nsn
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
ModalProgressHudNsnPlugin.register(with: registry.registrar(forPlugin: "ModalProgressHudNsnPlugin"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ packages:
|
|||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.16.0"
|
version: "1.15.0"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -56,17 +56,31 @@ packages:
|
|||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.2.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_lints:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
lints:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: lints
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -80,7 +94,7 @@ packages:
|
|||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.4"
|
version: "0.1.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -94,14 +108,14 @@ packages:
|
|||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.2.0"
|
version: "0.2.1"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -113,7 +127,7 @@ packages:
|
|||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.2"
|
version: "1.8.1"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -148,14 +162,21 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.9"
|
version: "0.4.8"
|
||||||
|
typed_data:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: typed_data
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.0"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.0-0 <3.0.0"
|
dart: ">=2.14.0 <3.0.0"
|
||||||
flutter: ">=1.20.0"
|
flutter: ">=1.20.0"
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ dependencies:
|
|||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
flutter_lints: ^1.0.4
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
modal_progress_hud_nsn
|
modal_progress_hud_nsn
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
|
||||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||||
@@ -17,8 +14,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
|||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||||
endforeach(plugin)
|
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)
|
|
||||||
|
|||||||
@@ -6,32 +6,32 @@ import 'package:flutter/material.dart';
|
|||||||
/// Wrap around any widget that makes an async call to show a modal progress
|
/// Wrap around any widget that makes an async call to show a modal progress
|
||||||
/// indicator while the async call is in progress.
|
/// indicator while the async call is in progress.
|
||||||
///
|
///
|
||||||
/// The progress indicator can be turned on or off using [inAsyncCall]
|
|
||||||
///
|
|
||||||
/// The progress indicator defaults to a [CircularProgressIndicator] but can be
|
|
||||||
/// any kind of widget
|
|
||||||
///
|
|
||||||
/// The progress indicator can be positioned using [offset] otherwise it is
|
|
||||||
/// centered
|
|
||||||
///
|
|
||||||
/// The modal barrier can be dismissed using [dismissible]
|
|
||||||
///
|
|
||||||
/// The color of the modal barrier can be set using [color]
|
|
||||||
///
|
|
||||||
/// The opacity of the modal barrier can be set using [opacity]
|
|
||||||
///
|
|
||||||
/// HUD=Heads Up Display
|
/// HUD=Heads Up Display
|
||||||
///
|
///
|
||||||
class ModalProgressHUD extends StatelessWidget {
|
class ModalProgressHUD extends StatelessWidget {
|
||||||
|
/// A required [bool]to toggle the loading animation.
|
||||||
final bool inAsyncCall;
|
final bool inAsyncCall;
|
||||||
|
|
||||||
|
/// A [double] value which states how opaque the loading overlay should be, defaults to 0.3
|
||||||
final double opacity;
|
final double opacity;
|
||||||
|
|
||||||
|
/// A [Color] object which is assigned to the loading barrier, defaults to grey
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
|
/// A [Widget] which is shown at the center of the modal loading barrier,
|
||||||
|
/// defaults to the standard android spinny animation.
|
||||||
final Widget progressIndicator;
|
final Widget progressIndicator;
|
||||||
|
|
||||||
|
/// An [Offset] object which is applied to the [progressIndicator] when specified.
|
||||||
final Offset? offset;
|
final Offset? offset;
|
||||||
|
|
||||||
|
/// A [bool] value which sets the `loading screen can be dismissible by tapping on the loading screen` rule.
|
||||||
final bool dismissible;
|
final bool dismissible;
|
||||||
|
|
||||||
|
/// A [Widget] which should be the the widget to be shown behind the loading barrier.
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
ModalProgressHUD({
|
const ModalProgressHUD({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.inAsyncCall,
|
required this.inAsyncCall,
|
||||||
this.opacity = 0.3,
|
this.opacity = 0.3,
|
||||||
@@ -47,9 +47,9 @@ class ModalProgressHUD extends StatelessWidget {
|
|||||||
if (!inAsyncCall) return child;
|
if (!inAsyncCall) return child;
|
||||||
|
|
||||||
Widget layOutProgressIndicator;
|
Widget layOutProgressIndicator;
|
||||||
if (offset == null)
|
if (offset == null) {
|
||||||
layOutProgressIndicator = Center(child: progressIndicator);
|
layOutProgressIndicator = Center(child: progressIndicator);
|
||||||
else {
|
} else {
|
||||||
layOutProgressIndicator = Positioned(
|
layOutProgressIndicator = Positioned(
|
||||||
child: progressIndicator,
|
child: progressIndicator,
|
||||||
left: offset!.dx,
|
left: offset!.dx,
|
||||||
@@ -57,11 +57,11 @@ class ModalProgressHUD extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
child,
|
child,
|
||||||
new Opacity(
|
Opacity(
|
||||||
child: new ModalBarrier(dismissible: dismissible, color: color),
|
child: ModalBarrier(dismissible: dismissible, color: color),
|
||||||
opacity: opacity,
|
opacity: opacity,
|
||||||
),
|
),
|
||||||
layOutProgressIndicator,
|
layOutProgressIndicator,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: modal_progress_hud_nsn
|
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
|
description: A modal progress indicator widget with Sound Null Safety. A fork of https://github.com/mmcc007/modal_progress_hud
|
||||||
version: 0.2.0
|
version: 0.2.1
|
||||||
#author: Phani Pavan K
|
#author: Phani Pavan K
|
||||||
homepage: https://github.com/kphanipavan/modal_progress_hud_nsn
|
homepage: https://github.com/kphanipavan/modal_progress_hud_nsn
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
|
||||||
|
|
||||||
@@ -7,17 +6,17 @@ void main() {
|
|||||||
group('Modal Progress HUD', () {
|
group('Modal Progress HUD', () {
|
||||||
Widget sut(bool inAsyncCall, Offset? offset) {
|
Widget sut(bool inAsyncCall, Offset? offset) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: new ModalProgressHUD(
|
home: ModalProgressHUD(
|
||||||
inAsyncCall: inAsyncCall,
|
inAsyncCall: inAsyncCall,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
child: Text(''),
|
child: const Text(''),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets('should show progress indicator when in async call',
|
testWidgets('should show progress indicator when in async call',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
final inAsyncCall = true;
|
const inAsyncCall = true;
|
||||||
await tester.pumpWidget(sut(inAsyncCall, null));
|
await tester.pumpWidget(sut(inAsyncCall, null));
|
||||||
|
|
||||||
expect(find.byType(Text), findsOneWidget);
|
expect(find.byType(Text), findsOneWidget);
|
||||||
@@ -26,7 +25,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('should not show progress indicator when not in async call',
|
testWidgets('should not show progress indicator when not in async call',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
final inAsyncCall = false;
|
const inAsyncCall = false;
|
||||||
await tester.pumpWidget(sut(inAsyncCall, null));
|
await tester.pumpWidget(sut(inAsyncCall, null));
|
||||||
|
|
||||||
expect(find.byType(Text), findsOneWidget);
|
expect(find.byType(Text), findsOneWidget);
|
||||||
@@ -35,8 +34,8 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('should allow positioning of progress indicator',
|
testWidgets('should allow positioning of progress indicator',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
final inAsyncCall = true;
|
const inAsyncCall = true;
|
||||||
final offset = Offset(0.1, 0.1);
|
const offset = Offset(0.1, 0.1);
|
||||||
await tester.pumpWidget(sut(inAsyncCall, offset));
|
await tester.pumpWidget(sut(inAsyncCall, offset));
|
||||||
|
|
||||||
expect(find.byType(Positioned), findsOneWidget);
|
expect(find.byType(Positioned), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user