This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #6 from Panduza/model_view_change-with-worflow
Model view change with worflow
- Loading branch information
Showing
45 changed files
with
931 additions
and
1,612 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:panduza_sandbox_flutter/after_setup_pages/add_connection_page.dart'; | ||
|
||
import 'package:panduza_sandbox_flutter/data/const.dart'; | ||
import 'package:panduza_sandbox_flutter/after_setup_pages/connections_page.dart'; | ||
import 'package:panduza_sandbox_flutter/forms/add_connection_form.dart'; | ||
import 'package:panduza_sandbox_flutter/setup_pages/cloud_config_auth_page.dart'; | ||
import 'package:panduza_sandbox_flutter/utils_widgets/appBar.dart'; | ||
import 'package:panduza_sandbox_flutter/utils_widgets/utils_widgets.dart'; | ||
|
||
// Page to give the choice between use the panduza cloud or | ||
// use a broker the user has himself init (self-managed broker) | ||
|
||
class AddCloudOrSelfManaged extends StatelessWidget { | ||
|
||
const AddCloudOrSelfManaged({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
||
return Scaffold( | ||
// bar at the top of the application | ||
appBar: getAppBar("Add self-mangaged broker or use cloud ?"), | ||
body: getBasicLayoutDynamic( | ||
context, | ||
page: const CloudAuthPage(), | ||
title: "Panduza Cloud", | ||
icon: Icons.cloud_outlined, | ||
buttonLabel: "Connect", | ||
description: panduzaCloudInfo, | ||
|
||
page2: const AddConnectionPage(), | ||
title2: "Self-Managed Broker", | ||
icon2: Icons.broadcast_on_personal_outlined, | ||
buttonLabel2: "Append", | ||
description2: selfManagedBrokerInfo | ||
) | ||
); | ||
} | ||
} |
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,39 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:panduza_sandbox_flutter/after_setup_pages/discovery_page.dart'; | ||
import 'package:panduza_sandbox_flutter/after_setup_pages/manual_connection_page.dart'; | ||
import 'package:auto_size_text/auto_size_text.dart'; | ||
|
||
import 'package:panduza_sandbox_flutter/data/const.dart'; | ||
import 'package:panduza_sandbox_flutter/utils_widgets/appBar.dart'; | ||
import 'package:panduza_sandbox_flutter/utils_widgets/utils_widgets.dart'; | ||
|
||
// Page with the 2 choices of adding connection : | ||
// with manual input, with discovery | ||
|
||
class AddConnectionPage extends StatelessWidget { | ||
const AddConnectionPage({ | ||
super.key, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
// bar at the top of the application | ||
appBar: getAppBar("Add self-managed broker"), | ||
body: getBasicLayoutDynamic( | ||
context, | ||
page: const ManualConnectionPage(), | ||
title: "Add broker manually", | ||
icon: Icons.keyboard_outlined, | ||
buttonLabel: "Add my broker", | ||
description: manualAddBrokerInfo, | ||
|
||
page2: const DiscoveryPage(), | ||
title2: "Local discovery broker", | ||
icon2: Icons.wifi_find_outlined, | ||
buttonLabel2: "Discover my brokers", | ||
description2: localDiscoveryInfo | ||
) | ||
); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,146 @@ | ||
import 'dart:io'; | ||
import 'dart:async'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:auto_size_text/auto_size_text.dart'; | ||
|
||
import 'package:panduza_sandbox_flutter/data/utils.dart'; | ||
import 'package:panduza_sandbox_flutter/data/const.dart'; | ||
import 'package:panduza_sandbox_flutter/utils_widgets/appBar.dart'; | ||
import 'manual_connection_page.dart'; | ||
|
||
|
||
// Page who will discover the differents platforms on | ||
// the network | ||
|
||
class DiscoveryPage extends StatefulWidget { | ||
const DiscoveryPage({super.key}); | ||
|
||
@override | ||
State<DiscoveryPage> createState() => _DiscoveryPageState(); | ||
} | ||
|
||
class _DiscoveryPageState extends State<DiscoveryPage> { | ||
|
||
List<(InternetAddress, int)> platformsIpsPorts = []; | ||
bool isLoading = false; | ||
|
||
// List of button of local platform detected | ||
Widget localDiscoveryConnections(List<(InternetAddress, int)> platformsIpsPorts, bool isLoading) { | ||
|
||
if (isLoading) { | ||
return Center( | ||
child: CircularProgressIndicator( | ||
color: blue, | ||
) | ||
); | ||
} | ||
|
||
return ListView.separated( | ||
padding: const EdgeInsets.all(40), | ||
itemCount: platformsIpsPorts.length, | ||
itemBuilder: (BuildContext context, int index) { | ||
return MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: GestureDetector( | ||
child: Container( | ||
padding: const EdgeInsets.all(20), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(10), | ||
color: black, | ||
), | ||
child: Center( | ||
child: Column ( | ||
children: <Widget>[ | ||
AutoSizeText( | ||
// '${platformsIpsPorts[index].$1.host}', | ||
"local", | ||
style: TextStyle( | ||
color: blue | ||
), | ||
), | ||
AutoSizeText( | ||
platformsIpsPorts[index].$1.address | ||
), | ||
const AutoSizeText( | ||
'1883' | ||
) | ||
], | ||
) | ||
), | ||
), | ||
onTap: () { | ||
Navigator.pushReplacement( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => ManualConnectionPage( | ||
ip: platformsIpsPorts[index].$1.address, | ||
port: "1883" | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
); | ||
}, | ||
separatorBuilder: (context, index) => const Divider(), | ||
); | ||
} | ||
|
||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
platformDiscovery().then( | ||
(value) { | ||
platformsIpsPorts = value; | ||
platformsIpsPorts.sort((a, b) => a.$1.host.compareTo(b.$1.host)); | ||
setState(() {}); | ||
} | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
// bar at the top of the application | ||
appBar: getAppBar("Local Discovery"), | ||
body: localDiscoveryConnections(platformsIpsPorts, isLoading), | ||
bottomSheet: Wrap( | ||
children: <Widget>[ | ||
SizedBox( | ||
width: MediaQuery.sizeOf(context).width / 1.1, | ||
height: MediaQuery.sizeOf(context).height / 12, | ||
child: TextButton( | ||
style: ButtonStyle ( | ||
backgroundColor: MaterialStateProperty.all<Color>(black) | ||
), | ||
onPressed: () { | ||
// Resend a broadcast to detect every local plaform (get | ||
// id and for each of them) | ||
platformDiscovery().then( | ||
(value) { | ||
platformsIpsPorts = value; | ||
platformsIpsPorts.sort((a, b) => a.$1.host.compareTo(b.$1.host)); | ||
setState(() {}); | ||
} | ||
); | ||
}, | ||
child: Text( | ||
'REFRESH', | ||
style: TextStyle( | ||
color: white, | ||
fontSize: 18 | ||
) | ||
) | ||
) | ||
), | ||
SizedBox( | ||
width: MediaQuery.sizeOf(context).width / 1.1, | ||
height: 20, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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.