-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from osociety/dev
Dev -> Main
- Loading branch information
Showing
12 changed files
with
245 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,36 @@ | ||
# Defines a default set of lint rules enforced for | ||
# projects at Google. For details and rationale, | ||
# see https://github.com/dart-lang/pedantic#enabled-lints. | ||
# include: package:pedantic/analysis_options.yaml | ||
|
||
# lint analysis | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options | ||
|
||
analyzer: | ||
errors: | ||
missing_required_param: error | ||
missing_return: error | ||
must_be_immutable: error | ||
exclude: | ||
- "**/*.g.dart" | ||
- "**/*.freezed.dart" | ||
- "**/*.config.dart" | ||
- "**/*.pb.dart" | ||
- "**/*.pbenum.dart" | ||
- "**/*.pbgrpc.dart" | ||
- "**/*.pbjson.dart" | ||
- "**/*.gr.dart" | ||
- "**/*.md" | ||
- "example/**" | ||
|
||
linter: | ||
rules: | ||
# Use parameter order as in json response | ||
always_put_required_named_parameters_first: true | ||
|
||
avoid_classes_with_only_static_members: false | ||
|
||
sort_constructors_first: true | ||
|
||
avoid_relative_lib_imports: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:network_tools_flutter/network_tools_flutter.dart'; | ||
|
||
class PingableDevices extends StatefulWidget { | ||
const PingableDevices({super.key}); | ||
|
||
@override | ||
State<PingableDevices> createState() => _PingableDevicesState(); | ||
} | ||
|
||
class _PingableDevicesState extends State<PingableDevices> { | ||
List<ActiveHost> activeHosts = []; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
NetInterface.localInterface().then((value) { | ||
final NetInterface? netInt = value; | ||
if (netInt == null) { | ||
return; | ||
} | ||
HostScannerFlutter.getAllPingableDevices(netInt.networkId).listen((host) { | ||
setState(() { | ||
activeHosts.add(host); | ||
}); | ||
}).onError((e) { | ||
print('Error $e'); | ||
}); | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | ||
title: const Text('Pingable Devices'), | ||
), | ||
body: Center( | ||
child: activeHosts.isEmpty | ||
? const CircularProgressIndicator() | ||
: ListView.builder( | ||
itemCount: activeHosts.length, | ||
itemBuilder: (context, index) { | ||
return ListTile( | ||
title: Text(activeHosts[index].address), | ||
); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:network_tools_flutter/network_tools_flutter.dart'; | ||
|
||
class PortScannerPage extends StatefulWidget { | ||
const PortScannerPage({super.key}); | ||
|
||
@override | ||
State<PortScannerPage> createState() => _PortScannerPageState(); | ||
} | ||
|
||
class _PortScannerPageState extends State<PortScannerPage> { | ||
List<ActiveHost> activeHosts = []; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
NetInterface.localInterface().then((value) { | ||
final NetInterface? netInt = value; | ||
if (netInt == null) { | ||
return; | ||
} | ||
String subnet = | ||
netInt.ipAddress.substring(0, netInt.ipAddress.lastIndexOf('.')); | ||
HostScanner.scanDevicesForSinglePort(subnet, 53).listen((host) { | ||
setState(() { | ||
activeHosts.add(host); | ||
}); | ||
}).onError((e) { | ||
print('Error $e'); | ||
}); | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | ||
title: const Text('Port Scanner'), | ||
), | ||
body: Center( | ||
child: activeHosts.isEmpty | ||
? const CircularProgressIndicator() | ||
: ListView.builder( | ||
itemCount: activeHosts.length, | ||
itemBuilder: (context, index) { | ||
return ListTile( | ||
title: Text(activeHosts[index].address), | ||
); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.