Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 69d8529

Browse files
committed
## [1.0.4] - Maintenance issues and suggestions.
- Added New ConnectivityScreenWrapper for [#1](#1) - Updated to provider: ^4.3.2 [#2](#2) - Exposed `lastStatus` as an API
1 parent a64de3c commit 69d8529

11 files changed

+229
-171
lines changed

Diff for: CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.0.4] - Maintenance issues and suggestions.
2+
3+
- Added New ConnectivityScreenWrapper for [#1](https://github.com/ajaynonstopio/connectivity_wrapper/issues/1)
4+
- Updated to provider: ^4.3.2 [#2](https://github.com/ajaynonstopio/connectivity_wrapper/issues/2)
5+
- Exposed `lastStatus` as an API
6+
17
## [1.0.3] - Maintenance issues and suggestions.
28

39
- Bumping version number, so pub.dev can accept the package
@@ -15,3 +21,8 @@
1521

1622
- Initial release.
1723

24+
25+
26+
export FLUTTER_ROOT= /Users/Office/SDK/flutter # on macOS or Linux
27+
28+
set FLUTTER_ROOT=~/dev/flutter # on Windows

Diff for: README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
[![](https://img.shields.io/badge/build-1.0.4-brightgreen)](https://github.com/ajaynonstopio/connectivity_wrapper)
2+
13
# connectivity_wrapper
24

35
This plugin allows Flutter apps provide feedback on your app when it's not connected to it, or when there's no connection.
46

5-
## Usage
7+
## Let's get started
68

7-
###Add the package to `pubspec.yaml`
9+
1. Go to `pubspec.yaml`
10+
2. add a ns_utils and replace `[version]` with the latest version:
811

912
```yaml
1013
dependencies:
1114
flutter:
1215
sdk: flutter
13-
cupertino_icons: ^0.1.2
14-
connectivity_wrapper: 1.0.3
16+
connectivity_wrapper: ^[version]
1517
```
18+
3. click the packages get button or *flutter pub get*
1619
17-
### Import the package to main.dart
20+
## Import the package
1821
1922
```dart
2023
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
@@ -65,7 +68,7 @@ class MyApp extends StatelessWidget {
6568
}
6669
```
6770

68-
##STEP 2: The last step, Wrap your body widget with `ConnectivityWidgetWrapper`
71+
##STEP 2: The last step, Wrap your body widget with `ConnectivityWidgetWrapper` or use [`ConnectivityScreenWrapper`](https://github.com/ajaynonstopio/connectivity_wrapper/blob/master/example/lib/screens/menu_screen.dart) for In-build animation
6972

7073
```dart
7174
@@ -76,7 +79,7 @@ class MenuScreen extends StatelessWidget {
7679
appBar: AppBar(
7780
title: Text("Connectivity Wrapper Example"),
7881
),
79-
body: ConnectivityWidgetWrapper(
82+
body: ConnectivityWidgetWrapper( // or use ##ConnectivityScreenWrapper for In build animation
8083
child: ListView(
8184
children: <Widget>[
8285
ListTile(

Diff for: example/lib/screens/menu_screen.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ class MenuScreen extends StatelessWidget {
1717
appBar: AppBar(
1818
title: Text("Connectivity Wrapper Example"),
1919
),
20-
body: ConnectivityWidgetWrapper(
20+
body: ConnectivityScreenWrapper(
21+
disableInteraction: true,
22+
disableWidget: Container(
23+
color: Colors.red.withOpacity(0.3),
24+
),
2125
child: ListView(
2226
children: <Widget>[
2327
ListTile(

Diff for: example/pubspec.lock

+33-75
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,69 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
4+
async:
55
dependency: transitive
66
description:
7-
name: archive
7+
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.0.11"
11-
args:
10+
version: "2.4.2"
11+
boolean_selector:
1212
dependency: transitive
1313
description:
14-
name: args
14+
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.5.2"
18-
async:
17+
version: "2.0.0"
18+
characters:
1919
dependency: transitive
2020
description:
21-
name: async
21+
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "2.4.0"
25-
boolean_selector:
24+
version: "1.0.0"
25+
charcode:
2626
dependency: transitive
2727
description:
28-
name: boolean_selector
28+
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.0.5"
32-
charcode:
31+
version: "1.1.3"
32+
clock:
3333
dependency: transitive
3434
description:
35-
name: charcode
35+
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.2"
38+
version: "1.0.1"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.11"
45+
version: "1.14.13"
4646
connectivity_wrapper:
4747
dependency: "direct main"
4848
description:
4949
path: ".."
5050
relative: true
5151
source: path
52-
version: "1.0.2"
53-
convert:
54-
dependency: transitive
55-
description:
56-
name: convert
57-
url: "https://pub.dartlang.org"
58-
source: hosted
59-
version: "2.1.1"
60-
crypto:
61-
dependency: transitive
62-
description:
63-
name: crypto
64-
url: "https://pub.dartlang.org"
65-
source: hosted
66-
version: "2.1.3"
52+
version: "1.0.4"
6753
cupertino_icons:
6854
dependency: "direct main"
6955
description:
7056
name: cupertino_icons
7157
url: "https://pub.dartlang.org"
7258
source: hosted
7359
version: "0.1.2"
60+
fake_async:
61+
dependency: transitive
62+
description:
63+
name: fake_async
64+
url: "https://pub.dartlang.org"
65+
source: hosted
66+
version: "1.1.0"
7467
flutter:
7568
dependency: "direct main"
7669
description: flutter
@@ -81,20 +74,13 @@ packages:
8174
description: flutter
8275
source: sdk
8376
version: "0.0.0"
84-
image:
85-
dependency: transitive
86-
description:
87-
name: image
88-
url: "https://pub.dartlang.org"
89-
source: hosted
90-
version: "2.1.4"
9177
matcher:
9278
dependency: transitive
9379
description:
9480
name: matcher
9581
url: "https://pub.dartlang.org"
9682
source: hosted
97-
version: "0.12.6"
83+
version: "0.12.8"
9884
meta:
9985
dependency: transitive
10086
description:
@@ -115,35 +101,14 @@ packages:
115101
name: path
116102
url: "https://pub.dartlang.org"
117103
source: hosted
118-
version: "1.6.4"
119-
pedantic:
120-
dependency: transitive
121-
description:
122-
name: pedantic
123-
url: "https://pub.dartlang.org"
124-
source: hosted
125-
version: "1.8.0+1"
126-
petitparser:
127-
dependency: transitive
128-
description:
129-
name: petitparser
130-
url: "https://pub.dartlang.org"
131-
source: hosted
132-
version: "2.4.0"
104+
version: "1.7.0"
133105
provider:
134106
dependency: transitive
135107
description:
136108
name: provider
137109
url: "https://pub.dartlang.org"
138110
source: hosted
139-
version: "4.0.5+1"
140-
quiver:
141-
dependency: transitive
142-
description:
143-
name: quiver
144-
url: "https://pub.dartlang.org"
145-
source: hosted
146-
version: "2.0.5"
111+
version: "4.3.2"
147112
sky_engine:
148113
dependency: transitive
149114
description: flutter
@@ -155,14 +120,14 @@ packages:
155120
name: source_span
156121
url: "https://pub.dartlang.org"
157122
source: hosted
158-
version: "1.5.5"
123+
version: "1.7.0"
159124
stack_trace:
160125
dependency: transitive
161126
description:
162127
name: stack_trace
163128
url: "https://pub.dartlang.org"
164129
source: hosted
165-
version: "1.9.3"
130+
version: "1.9.5"
166131
stream_channel:
167132
dependency: transitive
168133
description:
@@ -190,28 +155,21 @@ packages:
190155
name: test_api
191156
url: "https://pub.dartlang.org"
192157
source: hosted
193-
version: "0.2.11"
158+
version: "0.2.17"
194159
typed_data:
195160
dependency: transitive
196161
description:
197162
name: typed_data
198163
url: "https://pub.dartlang.org"
199164
source: hosted
200-
version: "1.1.6"
165+
version: "1.2.0"
201166
vector_math:
202167
dependency: transitive
203168
description:
204169
name: vector_math
205170
url: "https://pub.dartlang.org"
206171
source: hosted
207172
version: "2.0.8"
208-
xml:
209-
dependency: transitive
210-
description:
211-
name: xml
212-
url: "https://pub.dartlang.org"
213-
source: hosted
214-
version: "3.5.0"
215173
sdks:
216-
dart: ">=2.4.0 <3.0.0"
217-
flutter: ">=1.12.1"
174+
dart: ">=2.9.0-14.0.dev <3.0.0"
175+
flutter: ">=1.16.0"

Diff for: lib/connectivity_wrapper.dart

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import 'package:connectivity_wrapper/src/utils/constants.dart';
1717

1818
export 'package:connectivity_wrapper/src/widgets/connectivity_app_wrapper_widget.dart';
1919
export 'package:connectivity_wrapper/src/widgets/connectivity_widget_wrapper.dart';
20+
export 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';
2021

2122
/// Connection Status Check Result
2223
///
@@ -125,6 +126,8 @@ class ConnectivityWrapper {
125126
bool get hasListeners => _statusController.hasListener;
126127

127128
bool get isActivelyChecking => _statusController.hasListener;
129+
130+
ConnectivityStatus get lastStatus => _lastStatus;
128131
}
129132

130133
class AddressCheckOptions {

Diff for: lib/src/utils/constants.dart

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';
12
import 'package:flutter/cupertino.dart';
23
import 'package:flutter/material.dart';
34

@@ -34,3 +35,23 @@ const TextStyle defaultMessageStyle = TextStyle(
3435
color: Colors.white,
3536
inherit: false,
3637
);
38+
39+
extension PositionOnScreenExtention on PositionOnScreen {
40+
bool get isTOP => this == PositionOnScreen.TOP;
41+
42+
bool get isBOTTOM => this == PositionOnScreen.BOTTOM;
43+
44+
double top(double height, bool isOffline) {
45+
if (this.isTOP) {
46+
return isOffline ? 0 : (-height);
47+
}
48+
return null;
49+
}
50+
51+
double bottom(double height, bool isOffline) {
52+
if (this.isBOTTOM) {
53+
return isOffline ? 0 : (-height);
54+
}
55+
return null;
56+
}
57+
}

0 commit comments

Comments
 (0)