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

Commit

Permalink
Dart analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectAJ14 committed Dec 20, 2022
1 parent 65a8f86 commit 876ff51
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]}],"date_created":"2022-12-20 15:49:52.195478","version":"3.3.7"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]}],"date_created":"2022-12-20 15:53:54.182602","version":"3.3.7"}
14 changes: 14 additions & 0 deletions dry_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

START=$(date +%s)
flutter clean
flutter pub get
flutter test
if [[ $? == 0 ]]; then
flutter pub publish --dry-run
else
echo "FLUTTER TEST FAILED"
fi
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
echo "It took $DIFF seconds"
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]}],"date_created":"2022-12-20 15:49:52.469159","version":"3.3.7"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/ajaykumar/SDK/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-3.0.2/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]}],"date_created":"2022-12-20 15:53:53.377289","version":"3.3.7"}
6 changes: 4 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import 'package:connectivity_wrapper/connectivity_wrapper.dart';
import 'package:connectivity_wrapper_example/screens/menu_screen.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());
void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return ConnectivityAppWrapper(
Expand All @@ -16,9 +18,9 @@ class MyApp extends StatelessWidget {
home: MenuScreen(),
builder: (buildContext, widget) {
return ConnectivityWidgetWrapper(
child: widget,
disableInteraction: true,
height: 80,
child: widget,
);
},
),
Expand Down
42 changes: 22 additions & 20 deletions example/lib/screens/custom_offline_widget_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import 'package:connectivity_wrapper_example/utils/ui_helper.dart';
import 'package:flutter/material.dart';

class CustomOfflineWidgetScreen extends StatelessWidget {
const CustomOfflineWidgetScreen({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Strings.example2),
title: const Text(Strings.example2),
),
body: ConnectivityWidgetWrapper(
disableInteraction: true,
offlineWidget: OfflineWidget(),
offlineWidget: const OfflineWidget(),
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
return ListTile(
Expand All @@ -26,27 +28,27 @@ class CustomOfflineWidgetScreen extends StatelessWidget {
}

class OfflineWidget extends StatelessWidget {
const OfflineWidget({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Image(
height: 300,
image: AssetImage('assets/dog.gif'),
),
PA5(),
Center(
child: Text(
Strings.offlineMessage,
style: TextStyle(color: Colors.white, fontSize: 30.0),
),
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: const <Widget>[
Image(
height: 300,
image: AssetImage('assets/dog.gif'),
),
PA5(),
Center(
child: Text(
Strings.offlineMessage,
style: TextStyle(color: Colors.white, fontSize: 30.0),
),
PA5(),
],
),
),
PA5(),
],
);
}
}
28 changes: 15 additions & 13 deletions example/lib/screens/menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import 'custom_offline_widget_screen.dart';
import 'network_aware_widget_screen.dart';

class MenuScreen extends StatelessWidget {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();

MenuScreen({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text("Connectivity Wrapper Example"),
title: const Text("Connectivity Wrapper Example"),
),
body: ConnectivityScreenWrapper(
disableInteraction: false,
Expand All @@ -25,28 +27,28 @@ class MenuScreen extends StatelessWidget {
child: ListView(
children: <Widget>[
ListTile(
title: Text(Strings.example1),
title: const Text(Strings.example1),
onTap: () async {
AppRoutes.push(context, ScaffoldExampleScreen());
AppRoutes.push(context, const ScaffoldExampleScreen());
},
),
Divider(),
const Divider(),
ListTile(
title: Text(Strings.example2),
title: const Text(Strings.example2),
onTap: () {
AppRoutes.push(context, CustomOfflineWidgetScreen());
AppRoutes.push(context, const CustomOfflineWidgetScreen());
},
),
Divider(),
const Divider(),
ListTile(
title: Text(Strings.example3),
title: const Text(Strings.example3),
onTap: () {
AppRoutes.push(context, NetworkAwareWidgetScreen());
AppRoutes.push(context, const NetworkAwareWidgetScreen());
},
),
Divider(),
const Divider(),
ListTile(
title: Text(Strings.example4),
title: const Text(Strings.example4),
onTap: () async {
if (await ConnectivityWrapper.instance.isConnected) {
showSnackBar(
Expand All @@ -62,7 +64,7 @@ class MenuScreen extends StatelessWidget {
}
},
),
Divider(),
const Divider(),
],
),
),
Expand Down
24 changes: 13 additions & 11 deletions example/lib/screens/network_aware_widget_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class NetworkAwareWidgetScreen extends StatelessWidget {
const NetworkAwareWidgetScreen({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Strings.example3),
title: const Text(Strings.example3),
),
body: ListView(
padding: EdgeInsets.all(20.0),
padding: const EdgeInsets.all(20.0),
children: <Widget>[
TextField(
const TextField(
decoration: InputDecoration(labelText: 'Email'),
),
PA5(),
TextField(
const PA5(),
const TextField(
decoration: InputDecoration(labelText: 'Password'),
),
PA5(),
const PA5(),
ConnectivityWidgetWrapper(
stacked: false,
offlineWidget: ElevatedButton(
Expand All @@ -33,7 +35,7 @@ class NetworkAwareWidgetScreen extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
children: const <Widget>[
Text(
"Connecting",
style: TextStyle(
Expand All @@ -48,15 +50,15 @@ class NetworkAwareWidgetScreen extends StatelessWidget {
),
child: ElevatedButton(
onPressed: () {},
child: Text(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.blue),
),
child: const Text(
"Sign In",
style: TextStyle(
color: Colors.white,
),
),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.blue),
),
),
),
],
Expand Down
61 changes: 33 additions & 28 deletions example/lib/screens/scaffold_example_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import 'package:connectivity_wrapper_example/utils/ui_helper.dart';
import 'package:flutter/material.dart';

class ScaffoldExampleScreen extends StatefulWidget {
const ScaffoldExampleScreen({Key key}) : super(key: key);

@override
_ScaffoldExampleScreenState createState() => _ScaffoldExampleScreenState();
State<ScaffoldExampleScreen> createState() => _ScaffoldExampleScreenState();
}

class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
Expand All @@ -24,7 +26,7 @@ class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(Strings.example1),
title: const Text(Strings.example1),
),
body: ConnectivityWidgetWrapper(
alignment: _alignment,
Expand All @@ -33,24 +35,27 @@ class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
height: _height,
message: _message,
messageStyle: _customMessage
? TextStyle(
? const TextStyle(
color: Colors.white,
fontSize: 40.0,
)
: null,
child: ListView(
children: <Widget>[
CheckboxListTile(
title: Text(Strings.customDecoration),
title: const Text(Strings.customDecoration),
value: _customDecoration,
onChanged: (value) {
setState(() {
_customDecoration = value;
if (_customDecoration) {
_decoration = BoxDecoration(
_decoration = const BoxDecoration(
color: Colors.purple,
gradient: new LinearGradient(
colors: [Colors.red, Colors.cyan],
gradient: LinearGradient(
colors: [
Colors.red,
Colors.cyan,
],
),
);
} else {
Expand All @@ -59,10 +64,10 @@ class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
});
},
),
Divider(),
PA5(),
const Divider(),
const PA5(),
CheckboxListTile(
title: Text(Strings.customHeight),
title: const Text(Strings.customHeight),
value: _customHeight,
onChanged: (value) {
setState(() {
Expand All @@ -75,10 +80,10 @@ class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
});
},
),
Divider(),
PA5(),
const Divider(),
const PA5(),
CheckboxListTile(
title: Text(Strings.customMessage),
title: const Text(Strings.customMessage),
value: _customMessage,
onChanged: (value) {
setState(() {
Expand All @@ -91,52 +96,52 @@ class _ScaffoldExampleScreenState extends State<ScaffoldExampleScreen> {
});
},
),
Divider(),
PA5(),
ListTile(
const Divider(),
const PA5(),
const ListTile(
title: Text(Strings.customAlignment),
),
PA5(),
const PA5(),
IconButton(
icon: Icon(Icons.arrow_upward),
icon: const Icon(Icons.arrow_upward),
onPressed: () {
setState(() {
_alignment = Alignment.topCenter;
});
},
),
Divider(),
PA5(),
const Divider(),
const PA5(),
IconButton(
icon: Icon(Icons.center_focus_strong),
icon: const Icon(Icons.center_focus_strong),
onPressed: () {
setState(() {
_alignment = Alignment.center;
});
},
),
Divider(),
PA5(),
const Divider(),
const PA5(),
IconButton(
icon: Icon(Icons.arrow_downward),
icon: const Icon(Icons.arrow_downward),
onPressed: () {
setState(() {
_alignment = Alignment.bottomCenter;
});
},
),
Divider(),
PA5(),
const Divider(),
const PA5(),
CheckboxListTile(
title: Text(Strings.userInteraction),
title: const Text(Strings.userInteraction),
value: _disableInteraction,
onChanged: (value) {
setState(() {
_disableInteraction = value;
});
},
),
PA5(),
const PA5(),
],
),
),
Expand Down
Loading

0 comments on commit 876ff51

Please sign in to comment.