Skip to content

Commit

Permalink
Merge pull request #3 from LiquidGalaxyLAB/development
Browse files Browse the repository at this point in the history
PR3: Version 0.2
  • Loading branch information
VSBDev authored Jun 20, 2024
2 parents e1fa5f3 + 65c32c2 commit 043b317
Show file tree
Hide file tree
Showing 16 changed files with 1,631 additions and 91 deletions.
Binary file added assets/images/logos_compacted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions lib/pages/info_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import 'package:flutter/material.dart';
import 'package:lg_space_visualizations/pages/template_page.dart';
import 'package:lg_space_visualizations/utils/styles.dart';

/// A [InfoPage] widget that displays information about the Space Visualizations project.
///
/// It includes a description of the project and the logos.
class InfoPage extends StatefulWidget {
const InfoPage({super.key});

@override
_InfoPageState createState() => _InfoPageState();
}

class _InfoPageState extends State<InfoPage> {
@override
Widget build(BuildContext context) {
return TemplatePage(
title: 'Info',
showTopBar: true,
children: [
Expanded(
flex: 3,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius),
color: backgroundColor,
),
child: Padding(
padding: EdgeInsets.all(spaceBetweenWidgets),
child: Column(
children: <Widget>[
Image.asset('assets/images/logo.png', fit: BoxFit.contain),
const Spacer(),
Image.asset('assets/images/logos_compacted.png',
fit: BoxFit.contain),
],
),
),
),
),
SizedBox(width: spaceBetweenWidgets),
Expanded(
flex: 7,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius),
color: backgroundColor,
),
padding: EdgeInsets.only(
left: spaceBetweenWidgets,
right: spaceBetweenWidgets,
bottom: spaceBetweenWidgets,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Text(
"Space Visualizations",
style: hugeTitle.apply(color: primaryColor),
),
),
Transform.translate(
offset: const Offset(0, -25),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
color: primaryColor,
height: 10,
width: 175,
margin: const EdgeInsets.only(right: 25),
),
Text(
"for Liquid Galaxy",
style: bigTitle.apply(color: primaryColor),
),
Container(
color: primaryColor,
height: 10,
width: 175,
margin: const EdgeInsets.only(left: 25),
),
],
),
),
Text(
"""This project aims to build an educational application dedicated to visualizing orbits and the Mars 2020 mission, utilizing the Liquid Galaxy platform to provide immersive space exploration experiences. The app enables users to see and understand different orbits, such as GPS, QZSS, Graveyard and more in detail. Additionally, it showcases the Mars 2020 mission by featuring interactive 3D models of the Perseverance Rover and the Ingenuity Drone. Users can follow their paths on Mars, view photos taken by the rover, and discover technical details about the mission.""",
style: middleText,
),
],
),
),
),
],
);
}
}
232 changes: 232 additions & 0 deletions lib/pages/services_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import 'package:flutter/material.dart';
import 'package:lg_space_visualizations/pages/template_page.dart';
import 'package:lg_space_visualizations/utils/styles.dart';
import 'package:lg_space_visualizations/widget/button.dart';
import 'package:lg_space_visualizations/widget/custom_icon.dart';
import 'package:lg_space_visualizations/utils/lg_connection.dart';
import 'package:lg_space_visualizations/widget/custom_dialog.dart';

/// A [ServicesPage] widget for managing services related to the Liquid Galaxy system.
///
/// Those services include relaunching, clearing KMLs, rebooting, setting refresh.They are used for managing the system remotely.
class ServicesPage extends StatefulWidget {
const ServicesPage({super.key});

@override
_ServicesPageState createState() => _ServicesPageState();
}

class _ServicesPageState extends State<ServicesPage> {
/// Displays a dialog indicating that the Liquid Galaxy is not connected.
void showNotConnectedDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Error',
content: 'The Liquid Galaxy is not connected.\nPlease connect to the rig and try again.',
iconName: 'error',
);
},
);
}

@override
Widget build(BuildContext context) {
return TemplatePage(
title: 'Services',
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius),
color: backgroundColor,
),
padding: EdgeInsets.only(
top: spaceBetweenWidgets,
left: 2 * spaceBetweenWidgets,
right: 2 * spaceBetweenWidgets,
bottom: spaceBetweenWidgets,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildServiceButton(
context,
icon: 'relaunch',
text: 'LG\nRELAUNCH',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.relaunch();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Reboot',
content: 'The relaunch command has been sent.\nThe Liquid Galaxy will relaunch in a few seconds.',
iconName: 'relaunch',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
_buildServiceButton(
context,
icon: 'clear',
text: 'CLEAR\nKML',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.clearKml();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Clear KML',
content: 'The Clear KML command has been sent to the Liquid Galaxy.\nThe KMLs will be cleared in a few seconds.',
iconName: 'clear',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
_buildServiceButton(
context,
icon: 'reboot',
text: 'LG\nREBOOT',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.reboot();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Reboot',
content: 'The reboot command has been sent.\nThe Liquid Galaxy will reboot in a few seconds.',
iconName: 'reboot',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildServiceButton(
context,
icon: 'setrefresh',
text: 'SET\nREFRESH',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.setRefresh();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Set Refresh',
content: 'The Set Refresh command has been sent.\nThe Liquid Galaxy will set refresh and reboot in a few seconds.',
iconName: 'setrefresh',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
_buildServiceButton(
context,
icon: 'resetrefresh',
text: 'RESET\nREFRESH',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.resetRefresh();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Reset Refresh',
content: 'The Reset Refresh command has been sent.\nThe Liquid Galaxy will reset the refresh and reboot in a few seconds.',
iconName: 'resetrefresh',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
_buildServiceButton(
context,
icon: 'shutdown',
text: 'LG\nSHUTDOWN',
onPressed: () async {
if (await lgConnection.isConnected()) {
lgConnection.shutdown();
showDialog(
context: context,
builder: (BuildContext context) {
return const CustomDialog(
title: 'Shutdown',
content: 'The shutdown command has been sent.\nThe Liquid Galaxy will shutdown in a few seconds.',
iconName: 'shutdown',
);
},
);
} else {
showNotConnectedDialog(context);
}
},
),
],
),
],
),
),
),
],
);
}

/// Builds a service button for the services page.
///
/// [context] is the build context.
/// [icon] is the name of the icon to display.
/// [text] is the text to display on the button.
/// [onPressed] is the function to call when the button is pressed.
Widget _buildServiceButton(BuildContext context,
{required String icon,
required String text,
required VoidCallback onPressed}) {
return SizedBox(
height: 250,
width: 250,
child: Button(
icon: CustomIcon(
name: icon,
size: 90,
color: backgroundColor,
),
text: text,
color: secondaryColor,
multiLine: true,
bold: true,
borderRadius: BorderRadius.circular(borderRadius),
onPressed: onPressed,
),
);
}
}
Loading

0 comments on commit 043b317

Please sign in to comment.