Skip to content

Commit

Permalink
info screen, lg status indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
gmonso committed Jul 29, 2024
1 parent 81336c4 commit 78ffb3e
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 83 deletions.
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:get_it/get_it.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:wildfiretracker/screens/gencat_screen.dart';
import 'package:wildfiretracker/screens/info_screen.dart';
import 'package:wildfiretracker/screens/lg_settings_sreen.dart';
import 'package:wildfiretracker/screens/nasa_screen.dart';
import 'package:wildfiretracker/screens/nasa_screen_old.dart';
Expand Down Expand Up @@ -96,6 +97,7 @@ class MyApp extends StatelessWidget {
'/settings': (context) => const SettingsPage(),
'/gencat': (context) => const GencatPage(),
'/precisely-usa-forest-fire-risk': (context) => const PreciselyUsaForestFireRisk(),
'/info': (context) => InfoScreen(),
},
debugShowCheckedModeBanner: false,
);
Expand Down
89 changes: 89 additions & 0 deletions lib/screens/info_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import 'package:flutter/material.dart';
import 'package:wildfiretracker/utils/body.dart';

import '../utils/custom_appbar.dart';
import '../utils/theme.dart';

class InfoScreen extends StatefulWidget {
@override
_InfoScreenState createState() => _InfoScreenState();
}

class _InfoScreenState extends State<InfoScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ThemeColors.paltetteColor1,
appBar: CustomAppBar(),
body: CustomBody(content: SingleChildScrollView(
child: Padding(padding: const EdgeInsets.only(left: 20.0, right: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 20.0,),
Center(
child: Image.asset(
'assets/images/logo_gsoc24_round.png', // Ensure this image is added to your assets folder
height: 200,
),
),
SizedBox(height: 20),
Text(
'Wildfire Tracker for Liquid Galaxy',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Text(
'Monitoring of all fires in the world and the history of all Catalan wildfires.',
style: TextStyle(
fontSize: 18,
),
),
SizedBox(height: 20),
Text(
'Description',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Text(
'The project will be a responsive Flutter application designed for tablets, which through an SSH connection and API calls, we will be able to represent the desired information on the LG. Additionally, the application will be autonomous, and without being connected to the LG, it will be able to represent and display information on the mobile device itself. The project will consist of two parts:',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 10),
Text(
'The first part is intended to represent past forest fires, to see all the affected areas, the development of the forest fire, and all the information represented on the Liquid Galaxy.',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 10),
Text(
'The second part will be to visualize real-time fires, whether they are forest fires or house fires, on the Liquid Galaxy and see their information.',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 10),
Text(
'In the third part of the project, what is dealt with is to represent the risks of forest fires in the United States area.',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 20),
Text(
'The Liquid Galaxy is a cluster of screens with Google Earth that synchronize with each other to create the sensation of a single screen, depending on the configuration it can be panoramic, vertical, curved, etc. Through this tool, we will be able to represent fires and see the impacts in an interactive and easy-to-see detail. Additionally, we will have many important data about the fire, such as the extent, emitted gases, possible victims, key points, extinguishing techniques, possible improvements, front speed, fire score, type of smoke column, smoke data, etc. All those data that we can extract from our API.',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 20.0,),
Center(
child: Image.asset(
'assets/images/collaborators.png', // Ensure this image is added to your assets folder
//height: 200,
),
),
],
),)
)));
}
}
87 changes: 6 additions & 81 deletions lib/utils/body.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@

import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:wildfiretracker/utils/storage_keys.dart';
import 'package:wildfiretracker/utils/theme.dart';

import '../services/local_storage_service.dart';

class CustomBody extends StatefulWidget {
var content;

Expand All @@ -24,6 +28,7 @@ class CustomBodyState extends State<CustomBody> {
_selectedMenu = routeName ?? '/nasa'; // default to '/nasa' if routeName is null
});
});
// check on local store if LG is connected
}

@override
Expand Down Expand Up @@ -89,7 +94,7 @@ class NavigationDrawer extends StatelessWidget {
_createDrawerItem(name:'/gencat', icon: Icons.forest, text: 'Historic Wildfire', onTap: () => onMenuSelected('/gencat'), isSelected: () => isMenuSelected('/gencat')),
_createDrawerItem(name:'/precisely-usa-forest-fire-risk', icon: Icons.forest_outlined, text: 'Forest Fire Risk', onTap: () => onMenuSelected('/precisely-usa-forest-fire-risk'), isSelected: () => isMenuSelected('/precisely-usa-forest-fire-risk')),
_createDrawerItem(name:'/settings', icon: Icons.settings, text: 'Settings', onTap: () => onMenuSelected('/settings'), isSelected: () => isMenuSelected('/settings')),
_createDrawerItem(name:'/about', icon: Icons.info, text: 'About', onTap: () => onMenuSelected('/settings'), isSelected: () => isMenuSelected('/about')),
_createDrawerItem(name:'/about', icon: Icons.info, text: 'About', onTap: () => onMenuSelected('/info'), isSelected: () => isMenuSelected('/info')),
],
),
),
Expand Down Expand Up @@ -150,84 +155,4 @@ class NavigationDrawer extends StatelessWidget {
);
}

}


class AnimatedDrawerItem extends StatefulWidget {
final IconData icon;
final String title;
final Color selectedColor;
final Color unselectedColor;
final ValueChanged<bool> onTap;

AnimatedDrawerItem({
required this.icon,
required this.title,
required this.selectedColor,
required this.unselectedColor,
required this.onTap,
});

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

class _AnimatedDrawerItemState extends State<AnimatedDrawerItem> with SingleTickerProviderStateMixin {
bool isSelected = false;
late AnimationController _controller;
late Animation<Color?> _colorAnimation;

@override
void initState() {
super.initState();
_controller = AnimationController(
duration: Duration(milliseconds: 300),
vsync: this,
);
_colorAnimation = ColorTween(
begin: widget.unselectedColor,
end: widget.selectedColor,
).animate(_controller);
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

void _handleTap() {
setState(() {
isSelected = !isSelected;
isSelected ? _controller.forward() : _controller.reverse();
});
widget.onTap(isSelected);
}

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: _handleTap,
child: AnimatedBuilder(
animation: _colorAnimation,
builder: (context, child) {
return Container(
color: _colorAnimation.value,
child: ListTile(
leading: Icon(
widget.icon,
color: isSelected ? widget.selectedColor : widget.unselectedColor,
),
title: Text(
widget.title,
style: TextStyle(
color: isSelected ? widget.selectedColor : widget.unselectedColor,
),
),
),
);
},
),
);
}
}
18 changes: 16 additions & 2 deletions lib/utils/custom_appbar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:wildfiretracker/utils/storage_keys.dart';
import 'package:wildfiretracker/utils/theme.dart';

import '../services/local_storage_service.dart';

class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
CustomAppBar() : preferredSize = Size.fromHeight(kToolbarHeight);

Expand All @@ -15,6 +19,16 @@ class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
class _CustomAppBarState extends State<CustomAppBar> {
bool _isOnline = false;

LocalStorageService get _localStorageService =>
GetIt.I<LocalStorageService>();

void initState() {
super.initState();
// check on local store if LG is connected
setState(() {
_isOnline = _localStorageService.getItem(StorageKeys.lgCurrentConnection) ?? false;
});
}

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -48,7 +62,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
_isOnline ? 'Connected' : 'Disconnected',
style: TextStyle(fontSize: 14),
),
Switch(
/*Switch(
value: _isOnline,
onChanged: (value) {
setState(() {
Expand All @@ -57,7 +71,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
},
activeColor: Colors.green,
inactiveThumbColor: Colors.red,
),
),*/
],
);
}
Expand Down

0 comments on commit 78ffb3e

Please sign in to comment.