Skip to content

Commit

Permalink
Merge pull request #2 from LiquidGalaxyLAB/development
Browse files Browse the repository at this point in the history
PR2: Version 0.1
  • Loading branch information
VSBDev authored Jun 8, 2024
2 parents e7e5101 + f05985c commit e1fa5f3
Show file tree
Hide file tree
Showing 15 changed files with 553 additions and 210 deletions.
Binary file added assets/icons/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 22 additions & 15 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,43 @@ void main() {
// Ensures that an instance of the widgets library is initialized.
WidgetsFlutterBinding.ensureInitialized();

// Set landscape preferred orientation
// Set the preferred orientation to landscape.
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);

// Set app in fullscreen mode
// Set the app in fullscreen mode, hiding the system UI overlays.
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);

runApp(const Launcher());
}

/// The Launcher widget serves as the entry point for the app.
///
/// It sets up the background image, the theme, and the initial route for the app.
class Launcher extends StatelessWidget {
const Launcher({super.key});

@override
Widget build(BuildContext context) {

return Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/background.jpg"),
fit: BoxFit.fill,
),
// Set a background image for the entire app.
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/background.jpg"),
fit: BoxFit.fill,
),
child: MaterialApp(
title: 'SpaceVisualizations',
theme: ThemeData(fontFamily: 'Forgotten Futurist'),
onGenerateRoute: makeRoute,
initialRoute: '/',
));
),
child: MaterialApp(
title: 'SpaceVisualizations',
// Set the app theme with a custom font.
theme: ThemeData(fontFamily: 'Forgotten Futurist'),
// Define the route generator function.
onGenerateRoute: makeRoute,
// Set the initial route to the splash screen.
initialRoute: '/splash',
),
);
}
}
}
36 changes: 30 additions & 6 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:lg_space_visualizations/pages/template_page.dart';
import 'package:lg_space_visualizations/widget/image_button.dart';
import 'package:lg_space_visualizations/utils/styles.dart';
import 'package:lg_space_visualizations/widget/logo.dart';

/// The home page of the application, displayed using the [TemplatePage] widget.
class HomePage extends StatefulWidget {
const HomePage({super.key});

Expand All @@ -19,12 +21,34 @@ class _HomePageState extends State<HomePage> {
showTopBar: false,
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius),
color: backgroundColor,
child: Column(
children: [
SizedBox(height: spaceBetweenWidgets),
const Logo(),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageButton(
width: 425,
height: 220,
image: const AssetImage('assets/images/rover.png'),
text: 'MARS 2020\nMISSION',
onPressed: () {},
),
ImageButton(
width: 425,
height: 220,
image: const AssetImage('assets/images/earth.png'),
text: 'SATELLITE\nEARTH ORBITS',
onPressed: () {},
),
],
),
)
],
),
)),
)
],
);
}
Expand Down
55 changes: 55 additions & 0 deletions lib/pages/splash_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lg_space_visualizations/utils/styles.dart';
import 'package:lg_space_visualizations/widget/logo.dart';

/// A widget that represents the splash screen of the app.
///
/// It displays the logos and a loading indicator at the bottom.
/// When initialized, it waits for 5 seconds before navigating to the home page.s
class SplashPage extends StatefulWidget {
const SplashPage({super.key});

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

class _SplashPageState extends State<SplashPage> {
@override
void initState() {
super.initState();

// Timer to navigate to the home page after 5 seconds.
Timer(const Duration(seconds: 5), () {
Navigator.of(context).pushReplacementNamed('/home');
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: secondaryColor,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 20),
const Logo(),
Expanded(
child:
Image.asset('assets/images/logos.png', fit: BoxFit.contain),
),
SizedBox(
height: 4,
child: LinearProgressIndicator(
color: backgroundColor,
backgroundColor: secondaryColor,
),
),
],
),
),
);
}
}
40 changes: 26 additions & 14 deletions lib/pages/template_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@ import 'package:lg_space_visualizations/utils/styles.dart';
import 'package:lg_space_visualizations/widget/bottom_bar.dart';
import 'package:lg_space_visualizations/widget/top_bar.dart';

/// A page template that includes an optional top bar and a bottom bar.
///
/// The [TemplatePage] widget allows you to specify a [title] and [children]
/// widgets to be displayed. The top bar visibility can be controlled with [showTopBar].
class TemplatePage extends StatefulWidget {
final List<Widget> children;
/// The title of the page displayed in the top bar.
final String title;

/// The widgets to be displayed in the body of the page.
final List<Widget> children;

/// Controls the visibility of the top bar.
final bool showTopBar;

const TemplatePage(
{super.key,
required this.title,
this.showTopBar = true,
required this.children});
const TemplatePage({
super.key,
required this.title,
this.showTopBar = true,
required this.children,
});

@override
_TemplatePageState createState() => _TemplatePageState();
Expand All @@ -22,13 +32,15 @@ class _TemplatePageState extends State<TemplatePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
appBar: widget.showTopBar ? TopBar(title: widget.title) : null,
body: Padding(
padding: EdgeInsets.all(spaceBetweenWidgets),
child: Row(
children: widget.children,
)),
bottomNavigationBar: const BottomBar());
backgroundColor: Colors.transparent,
appBar: widget.showTopBar ? TopBar(title: widget.title) : null,
body: Padding(
padding: EdgeInsets.all(spaceBetweenWidgets),
child: Row(
children: widget.children,
),
),
bottomNavigationBar: const BottomBar(),
);
}
}
43 changes: 32 additions & 11 deletions lib/utils/routes.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
import 'package:flutter/material.dart';
import 'package:lg_space_visualizations/pages/home_page.dart';
import 'package:lg_space_visualizations/pages/splash_screen.dart';

/// Generates a [Route] for the application based on the provided [RouteSettings].
///
/// This function takes [settings] as a parameter, which contains the name of
/// the route to be generated. It returns a [Route] corresponding to the route
/// name. If the route name is not recognized, it defaults to the home page.
Route<dynamic> makeRoute(RouteSettings settings) {
WidgetBuilder builder;
switch (settings.name) {
case '/':
return customRoute(const HomePage());
case '/home':
// Route for the home page.
builder = (BuildContext context) => const HomePage();
break;
case '/splash':
// Route for the splash screen.
builder = (BuildContext context) => const SplashPage();
break;
default:
throw 'Route is not defined';
// Default route if no match is found, redirects to the home page.
builder = (BuildContext context) => const HomePage();
}
// Return a custom route with a very short transition animation.
return AnimationPageRoute(builder: builder, settings: settings);
}

PageRouteBuilder customRoute(Widget page) {
return PageRouteBuilder(
pageBuilder: (context, animation1, animation2) => page,
transitionDuration: const Duration(milliseconds: 500),
transitionsBuilder: (context, animation, animation2, child) {
return FadeTransition(opacity: animation, child: child);
},
);
/// A custom [MaterialPageRoute] that disables transition animations but keeps a transition duration of 10 ms.
class AnimationPageRoute<T> extends MaterialPageRoute<T> {
AnimationPageRoute({required super.builder, super.settings});

@override
Duration get transitionDuration => const Duration(milliseconds: 10);

@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
// Return the child widget without any transition animations.
return child;
}
}
53 changes: 42 additions & 11 deletions lib/utils/styles.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,56 @@
import 'package:flutter/material.dart';

// Dimensions
/// Dimensions used in the application.
double borderRadius = 10.0;
double barHeight = 60.0;
double barWidth = 1366.0;

// Colors
/// Colors used throughout in the application.
Color primaryColor = const Color(0xFF000000);
Color secondaryColor = const Color(0xFF281F5E);
Color backgroundColor = const Color(0xFFD9D9D9);
Color grey = const Color(0xFFA7A7A7);
// Extra

/// Spacing used between widgets.
double spaceBetweenWidgets = 20.0;

// Text styles
TextStyle hugeTitle = TextStyle(color: backgroundColor, fontWeight: FontWeight.bold, fontSize: 80);
TextStyle bigTitle = TextStyle(color: primaryColor, fontWeight: FontWeight.bold, fontSize: 40);
TextStyle middleTitle = TextStyle(color: primaryColor, fontWeight: FontWeight.bold, fontSize: 30);
/// Text styles used in the application.
TextStyle hugeTitle = TextStyle(
color: backgroundColor,
fontWeight: FontWeight.bold,
fontSize: 80,
);

TextStyle bigTitle = TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 40,
);

TextStyle middleTitle = TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 30,
);

TextStyle bigText = TextStyle(
color: primaryColor,
fontSize: 25,
);

TextStyle middleText = TextStyle(
color: primaryColor,
fontSize: 20,
);

TextStyle bigText = TextStyle(color: primaryColor, fontSize: 25);
TextStyle middleText = TextStyle(color: primaryColor, fontSize: 20);
TextStyle buttonText = TextStyle(
color: backgroundColor,
fontSize: 20,
);

TextStyle buttonText = TextStyle(color: backgroundColor, fontSize: 20);
TextStyle buttonTextBold = TextStyle(color: backgroundColor, fontWeight: FontWeight.bold, height: 1.2, fontSize: 40);
TextStyle buttonTextBold = TextStyle(
color: backgroundColor,
fontWeight: FontWeight.bold,
height: 1.2,
fontSize: 40,
);
Loading

0 comments on commit e1fa5f3

Please sign in to comment.