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

Commit 85cb1af

Browse files
committed
1.0.6
- Added textAlign in ConnectivityScreenWrapper i.e #6 - Added import_sorter
1 parent 35008f3 commit 85cb1af

15 files changed

+113
-28
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.0.6] - Maintenance issues and suggestions.
2+
3+
- Resolved [#6](https://github.com/ajaynonstopio/connectivity_wrapper/issues/6)
4+
15
## [1.0.5] - Maintenance issues and suggestions.
26

37
- Migrating to null safety and updated provider to: ^5.0.0 [#7](https://github.com/ajaynonstopio/connectivity_wrapper/issues/7)

README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
[![](https://img.shields.io/badge/build-1.0.5-brightgreen)](https://github.com/ajaynonstopio/connectivity_wrapper)
1+
[![](https://img.shields.io/badge/build-1.0.6-brightgreen)](https://github.com/ajaynonstopio/connectivity_wrapper)
2+
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
23

34
# connectivity_wrapper
45

@@ -258,13 +259,15 @@ class NetworkAwareWidgetScreen extends StatelessWidget {
258259
whether you can reliably make a network connection. Always guard your app code
259260
against timeouts and errors that might come from the network layer.
260261

261-
## Getting Started
262+
262263

263-
This project is a starting point for a Dart
264-
[package](https://flutter.dev/developing-packages/),
265-
a library module containing code that can be shared easily across
266-
multiple Flutter or Dart projects.
264+
## Contributing
267265

268-
For help getting started with Flutter, view our
269-
[online documentation](https://flutter.dev/docs), which offers tutorials,
270-
samples, guidance on mobile development, and a full API reference.
266+
There are couple of ways in which you can contribute.
267+
- Propose any feature, enhancement
268+
- Report a bug
269+
- Fix a bug
270+
- Participate in a discussion and help in decision making
271+
- Write and improve some **documentation**. Documentation is super critical and its importance
272+
cannot be overstated!
273+
- Send in a Pull Request :-)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ packages:
4949
path: ".."
5050
relative: true
5151
source: path
52-
version: "1.0.5"
52+
version: "1.0.6"
5353
cupertino_icons:
5454
dependency: "direct main"
5555
description:

git_add_and_format_code.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
clear
3+
echo "Sort imports...."
4+
flutter pub run import_sorter:main
5+
echo "Formatting code with [flutter format]...."
6+
flutter format lib
7+
git add .
8+
echo "Done"
9+
git status
10+

lib/connectivity_wrapper.dart

+2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
///
1111
library connectivity_wrapper;
1212

13+
// Dart imports:
1314
import 'dart:async';
1415
import 'dart:io';
1516

17+
// Project imports:
1618
import 'package:connectivity_wrapper/src/utils/constants.dart';
1719

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

lib/src/providers/connectivity_provider.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// Dart imports:
12
import 'dart:async';
23

3-
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
4+
// Flutter imports:
45
import 'package:flutter/material.dart';
56

7+
// Project imports:
8+
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
9+
610
/// [ConnectivityProvider] event ChangeNotifier class for ConnectivityStatus .
711
/// which extends [ChangeNotifier].
812

lib/src/utils/constants.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';
1+
// Flutter imports:
22
import 'package:flutter/cupertino.dart';
33
import 'package:flutter/material.dart';
44

5+
// Project imports:
6+
import 'package:connectivity_wrapper/src/widgets/connectivity_screen_wrapper.dart';
7+
58
/// More info on why default port is 53
69
/// here:
710
/// - https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

lib/src/widgets/connectivity_app_wrapper_widget.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
2-
import 'package:connectivity_wrapper/src/providers/connectivity_provider.dart';
1+
// Flutter imports:
32
import 'package:flutter/material.dart';
3+
4+
// Package imports:
45
import 'package:provider/provider.dart';
56

7+
// Project imports:
8+
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
9+
import 'package:connectivity_wrapper/src/providers/connectivity_provider.dart';
10+
611
///[ConnectivityAppWrapper] is a StatelessWidget.
712
813
class ConnectivityAppWrapper extends StatelessWidget {

lib/src/widgets/connectivity_screen_wrapper.dart

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
2-
import 'package:connectivity_wrapper/src/utils/constants.dart';
1+
// Flutter imports:
32
import 'package:flutter/material.dart';
3+
4+
// Package imports:
45
import 'package:provider/provider.dart';
56

7+
// Project imports:
8+
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
9+
import 'package:connectivity_wrapper/src/utils/constants.dart';
10+
611
enum PositionOnScreen {
712
TOP,
813
BOTTOM,
@@ -39,6 +44,9 @@ class ConnectivityScreenWrapper extends StatelessWidget {
3944
/// Disable the user interaction with child widget
4045
final Widget? disableWidget;
4146

47+
/// How the text should be aligned horizontally.
48+
final TextAlign? textAlign;
49+
4250
const ConnectivityScreenWrapper({
4351
Key? key,
4452
this.child,
@@ -47,6 +55,7 @@ class ConnectivityScreenWrapper extends StatelessWidget {
4755
this.message,
4856
this.messageStyle,
4957
this.height,
58+
this.textAlign,
5059
this.duration,
5160
this.positionOnScreen = PositionOnScreen.BOTTOM,
5261
this.disableInteraction = false,
@@ -64,7 +73,7 @@ class ConnectivityScreenWrapper extends StatelessWidget {
6473

6574
double _height = height ?? defaultHeight;
6675

67-
final Widget offlineWidget = AnimatedPositioned(
76+
final Widget _offlineWidget = AnimatedPositioned(
6877
top: positionOnScreen.top(_height, isOffline),
6978
bottom: positionOnScreen.bottom(_height, isOffline),
7079
child: AnimatedContainer(
@@ -76,6 +85,7 @@ class ConnectivityScreenWrapper extends StatelessWidget {
7685
child: Text(
7786
message ?? disconnectedMessage,
7887
style: messageStyle ?? defaultMessageStyle,
88+
textAlign: textAlign,
7989
),
8090
),
8191
duration: duration ?? Duration(milliseconds: 300),
@@ -87,10 +97,10 @@ class ConnectivityScreenWrapper extends StatelessWidget {
8797
absorbing: (disableInteraction && isOffline),
8898
child: Stack(
8999
children: (<Widget?>[
90-
child,
100+
if (child != null) child,
91101
if (disableInteraction && isOffline)
92102
if (disableWidget != null) disableWidget,
93-
offlineWidget,
103+
_offlineWidget,
94104
]) as List<Widget>,
95105
),
96106
);

lib/src/widgets/connectivity_widget_wrapper.dart

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
// Flutter imports:
2+
import 'package:flutter/material.dart';
3+
4+
// Package imports:
5+
import 'package:provider/provider.dart';
6+
7+
// Project imports:
18
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
29
import 'package:connectivity_wrapper/src/utils/constants.dart';
310
import 'package:connectivity_wrapper/src/widgets/empty_container.dart';
4-
import 'package:flutter/material.dart';
5-
import 'package:provider/provider.dart';
611

712
class ConnectivityWidgetWrapper extends StatelessWidget {
813
/// The [child] contained by the ConnectivityWidgetWrapper.
@@ -71,9 +76,9 @@ class ConnectivityWidgetWrapper extends StatelessWidget {
7176

7277
@override
7378
Widget build(BuildContext context) {
74-
final bool isOffline = Provider.of<ConnectivityStatus>(context) !=
79+
final bool _isOffline = Provider.of<ConnectivityStatus>(context) !=
7580
ConnectivityStatus.CONNECTED;
76-
Widget finalOfflineWidget = Align(
81+
Widget _finalOfflineWidget = Align(
7782
alignment: alignment ?? Alignment.bottomCenter,
7883
child: offlineWidget ??
7984
Container(
@@ -93,8 +98,8 @@ class ConnectivityWidgetWrapper extends StatelessWidget {
9398
if (stacked)
9499
return Stack(
95100
children: (<Widget?>[
96-
child,
97-
disableInteraction && isOffline
101+
if (child != null) child,
102+
disableInteraction && _isOffline
98103
? Column(
99104
children: <Widget>[
100105
Flexible(
@@ -108,10 +113,10 @@ class ConnectivityWidgetWrapper extends StatelessWidget {
108113
],
109114
)
110115
: EmptyContainer(),
111-
isOffline ? finalOfflineWidget : EmptyContainer(),
116+
_isOffline ? _finalOfflineWidget : EmptyContainer(),
112117
]) as List<Widget>,
113118
);
114119

115-
return isOffline ? finalOfflineWidget : child!;
120+
return _isOffline ? _finalOfflineWidget : child!;
116121
}
117122
}

lib/src/widgets/empty_container.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flutter imports:
12
import 'package:flutter/material.dart';
23

34
class EmptyContainer extends StatelessWidget {

pubspec.lock

+28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4+
args:
5+
dependency: transitive
6+
description:
7+
name: args
8+
url: "https://pub.dartlang.org"
9+
source: hosted
10+
version: "2.1.0"
411
async:
512
dependency: transitive
613
description:
@@ -60,6 +67,13 @@ packages:
6067
description: flutter
6168
source: sdk
6269
version: "0.0.0"
70+
import_sorter:
71+
dependency: "direct dev"
72+
description:
73+
name: import_sorter
74+
url: "https://pub.dartlang.org"
75+
source: hosted
76+
version: "4.5.0"
6377
matcher:
6478
dependency: transitive
6579
description:
@@ -142,6 +156,13 @@ packages:
142156
url: "https://pub.dartlang.org"
143157
source: hosted
144158
version: "0.2.19"
159+
tint:
160+
dependency: transitive
161+
description:
162+
name: tint
163+
url: "https://pub.dartlang.org"
164+
source: hosted
165+
version: "2.0.0"
145166
typed_data:
146167
dependency: transitive
147168
description:
@@ -156,6 +177,13 @@ packages:
156177
url: "https://pub.dartlang.org"
157178
source: hosted
158179
version: "2.1.0"
180+
yaml:
181+
dependency: transitive
182+
description:
183+
name: yaml
184+
url: "https://pub.dartlang.org"
185+
source: hosted
186+
version: "3.1.0"
159187
sdks:
160188
dart: ">=2.12.0 <3.0.0"
161189
flutter: ">=1.16.0"

pubspec.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: connectivity_wrapper
22
description: A new Flutter package which provides network-aware widgets.It allows Flutter apps provide feedback on your app when it's not connected to it, or when there's no connection.
3-
version: 1.0.5
3+
version: 1.0.6
44
documentation: https://github.com/ajaynonstopio/connectivity_wrapper
55
homepage: https://github.com/ajaynonstopio/connectivity_wrapper
66

@@ -15,5 +15,6 @@ dependencies:
1515
dev_dependencies:
1616
flutter_test:
1717
sdk: flutter
18+
import_sorter: ^4.4.1 #run to sort import => flutter pub run import_sorter:main
1819

1920
flutter:

test/connectivity_wrapper_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package imports:
12
import 'package:flutter_test/flutter_test.dart';
23

34
void main() {

0 commit comments

Comments
 (0)