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

Commit

Permalink
## [1.0.4] - Maintenance issues and suggestions.
Browse files Browse the repository at this point in the history
- Added New ConnectivityScreenWrapper for [#1](#1)
- Updated to  provider: ^4.3.2 [#2](#2)
- Exposed `lastStatus` as an API
  • Loading branch information
ProjectAJ14 committed Aug 8, 2020
1 parent a64de3c commit 69d8529
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 171 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.0.4] - Maintenance issues and suggestions.

- Added New ConnectivityScreenWrapper for [#1](https://github.com/ajaynonstopio/connectivity_wrapper/issues/1)
- Updated to provider: ^4.3.2 [#2](https://github.com/ajaynonstopio/connectivity_wrapper/issues/2)
- Exposed `lastStatus` as an API

## [1.0.3] - Maintenance issues and suggestions.

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

- Initial release.



export FLUTTER_ROOT= /Users/Office/SDK/flutter # on macOS or Linux

set FLUTTER_ROOT=~/dev/flutter # on Windows
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
[![](https://img.shields.io/badge/build-1.0.4-brightgreen)](https://github.com/ajaynonstopio/connectivity_wrapper)

# connectivity_wrapper

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

## Usage
## Let's get started

###Add the package to `pubspec.yaml`
1. Go to `pubspec.yaml`
2. add a ns_utils and replace `[version]` with the latest version:

```yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
connectivity_wrapper: 1.0.3
connectivity_wrapper: ^[version]
```
3. click the packages get button or *flutter pub get*
### Import the package to main.dart
## Import the package
```dart
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
Expand Down Expand Up @@ -65,7 +68,7 @@ class MyApp extends StatelessWidget {
}
```

##STEP 2: The last step, Wrap your body widget with `ConnectivityWidgetWrapper`
##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

```dart
Expand All @@ -76,7 +79,7 @@ class MenuScreen extends StatelessWidget {
appBar: AppBar(
title: Text("Connectivity Wrapper Example"),
),
body: ConnectivityWidgetWrapper(
body: ConnectivityWidgetWrapper( // or use ##ConnectivityScreenWrapper for In build animation
child: ListView(
children: <Widget>[
ListTile(
Expand Down
6 changes: 5 additions & 1 deletion example/lib/screens/menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class MenuScreen extends StatelessWidget {
appBar: AppBar(
title: Text("Connectivity Wrapper Example"),
),
body: ConnectivityWidgetWrapper(
body: ConnectivityScreenWrapper(
disableInteraction: true,
disableWidget: Container(
color: Colors.red.withOpacity(0.3),
),
child: ListView(
children: <Widget>[
ListTile(
Expand Down
108 changes: 33 additions & 75 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,76 +1,69 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
async:
dependency: transitive
description:
name: archive
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
version: "2.4.2"
boolean_selector:
dependency: transitive
description:
name: args
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
version: "2.0.0"
characters:
dependency: transitive
description:
name: async
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
boolean_selector:
version: "1.0.0"
charcode:
dependency: transitive
description:
name: boolean_selector
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
charcode:
version: "1.1.3"
clock:
dependency: transitive
description:
name: charcode
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.13"
connectivity_wrapper:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "1.0.2"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "1.0.4"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -81,20 +74,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.8"
meta:
dependency: transitive
description:
Expand All @@ -115,35 +101,14 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "1.7.0"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.5+1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "4.3.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -155,14 +120,14 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
version: "1.7.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stream_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -190,28 +155,21 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.2.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
flutter: ">=1.12.1"
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.16.0"
3 changes: 3 additions & 0 deletions lib/connectivity_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:connectivity_wrapper/src/utils/constants.dart';

export 'package:connectivity_wrapper/src/widgets/connectivity_app_wrapper_widget.dart';
export 'package:connectivity_wrapper/src/widgets/connectivity_widget_wrapper.dart';
export 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';

/// Connection Status Check Result
///
Expand Down Expand Up @@ -125,6 +126,8 @@ class ConnectivityWrapper {
bool get hasListeners => _statusController.hasListener;

bool get isActivelyChecking => _statusController.hasListener;

ConnectivityStatus get lastStatus => _lastStatus;
}

class AddressCheckOptions {
Expand Down
21 changes: 21 additions & 0 deletions lib/src/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -34,3 +35,23 @@ const TextStyle defaultMessageStyle = TextStyle(
color: Colors.white,
inherit: false,
);

extension PositionOnScreenExtention on PositionOnScreen {
bool get isTOP => this == PositionOnScreen.TOP;

bool get isBOTTOM => this == PositionOnScreen.BOTTOM;

double top(double height, bool isOffline) {
if (this.isTOP) {
return isOffline ? 0 : (-height);
}
return null;
}

double bottom(double height, bool isOffline) {
if (this.isBOTTOM) {
return isOffline ? 0 : (-height);
}
return null;
}
}
Loading

0 comments on commit 69d8529

Please sign in to comment.