From 4adcd2645ec2c20a02ec6121e58646786e7415b2 Mon Sep 17 00:00:00 2001 From: andoriyaprashant Date: Thu, 28 Dec 2023 09:58:46 +0530 Subject: [PATCH 1/5] FAQ Feature added --- lib/screens/faq.dart | 123 ++++++++++++++++++++++++++++++++++++++ lib/screens/settings.dart | 12 +++- 2 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 lib/screens/faq.dart diff --git a/lib/screens/faq.dart b/lib/screens/faq.dart new file mode 100644 index 0000000..3fa504d --- /dev/null +++ b/lib/screens/faq.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; + +class FAQScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBar( + backgroundColor: Colors.transparent, + foregroundColor: Colors.black, + elevation: 0, + leading: IconButton( + icon: Icon( + Icons.arrow_back_rounded, + color: Colors.black, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + title: const Text( + "FAQs Section", + style: TextStyle( + color: Colors.black, + fontSize: 30.0, + fontWeight: FontWeight.bold, + ), + ), + ), + body: Column( + children: [ + SizedBox(height: 40), + Expanded( + child: Container( + margin: EdgeInsets.fromLTRB(15, 15, 15, 60), + padding: EdgeInsets.all(30), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(40), + topRight: Radius.circular(40), + bottomLeft: Radius.circular(40), + bottomRight: Radius.circular(40), + ), + border: Border.all( + color: Colors.red, + width: 2.0, + ), + ), + child: SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()), + child: Column( + children: [ + FAQItem( + question: 'How does the STEAM Celestial Satellite Tracker work?', + answer: 'The STEAM Celestial Satellite Tracker utilizes an Arduino-controlled pointer and Liquid Galaxy rig to visualize satellite orbits. The app provides real-time information about satellite movements and offers a unique way to interact with the satellite data.', + ), + FAQItem( + question: ' What satellite information does the app provide?', + answer: 'The app offers detailed information about various satellites, including their orbits, trajectories, and other relevant data. Explore a variety of satellites and learn more about their celestial movements.' + ), + FAQItem( + question: ' Is the app compatible with all Android devices?', + answer: 'The app is compatible with Android devices up to Android 11. Please note that the Arduino-controlled pointer functionality is specifically designed for Android devices.', + ), + FAQItem( + question: 'What Bluetooth module is compatible with the STEAM Celestial Satellite Tracker?', + answer: 'The HC-05 Bluetooth module is used for communication between the app and the Arduino-controlled pointer. Ensure your Bluetooth module is HC-05 for seamless connectivity.', + ), + FAQItem( + question: 'Can I use any Arduino board for the pointer setup?', + answer: 'The current implementation uses an Arduino UNO board. While other boards may work, it is recommended to stick with Arduino UNO for compatibility.', + ), + FAQItem( + question: 'How do I connect the app to Liquid Galaxy for satellite visualization?', + answer: 'Open the app and navigate to the Settings page by clicking on the gear icon. Choose the "LG Connection" option and enter the Liquid Galaxy host name, password, IP address, SSH connection port, and the number of screens. Click "Connect" to establish a connection.', + ), + FAQItem( + question: 'How can I contribute to the development of the app?', + answer: 'We welcome contributions! Feel free to report issues, bugs, or submit feature requests through our issue tracker. If you are interested in contributing code, you can submit a pull request.' + ), + ], + ), + ), + ), + ), + ], + ), + ); + } +} + +class FAQItem extends StatefulWidget { + final String question; + final String answer; + FAQItem({required this.question, required this.answer}); + + @override + _FAQItemState createState() => _FAQItemState(); +} + +class _FAQItemState extends State { + bool isExpanded = false; + + @override + Widget build(BuildContext context) { + return ExpansionTile( + title: Text(widget.question), + trailing: Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down), + onExpansionChanged: (bool expanded) { + setState(() { + isExpanded = expanded; + }); + }, + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text(widget.answer), + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 0210d52..91a5661 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; +import 'package:steam_celestial_satellite_tracker_in_real_time/screens/faq.dart'; import 'package:steam_celestial_satellite_tracker_in_real_time/screens/help.dart'; import 'package:steam_celestial_satellite_tracker_in_real_time/screens/lg_settings.dart'; import 'package:steam_celestial_satellite_tracker_in_real_time/services/local_storage_service.dart'; @@ -125,9 +126,18 @@ class _SettingsState extends State { Navigator.push(context, MaterialPageRoute(builder: (context) => const Help())); }, - title: _buildTitle('Help'), + title: _buildTitle('Help'), trailing: const Icon(Icons.arrow_forward), leading: _buildIcon(Icons.help_center_outlined), + ), + ListTile( + onTap: (){ + Navigator.push(context, + MaterialPageRoute(builder: (context) => FAQScreen())); + }, + title: _buildTitle('FAQ'), + trailing: const Icon(Icons.arrow_forward), + leading: _buildIcon(Icons.contact_mail), ), _divider(), const SizedBox(height: 10,), From d07784fdd92fb0ac9b5c7f07b2835106b22bfacd Mon Sep 17 00:00:00 2001 From: andoriyaprashant Date: Sat, 6 Jan 2024 16:28:48 +0530 Subject: [PATCH 2/5] Code of conduct and contributing.md file added --- CODE_OF_CONDUCT.md | 47 +++++++++++++++++++++++ CONTRIBUTING.md | 96 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..d5efbc1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,47 @@ +# STEAM-Celestial-Satellite-tracker-in-real-time Code of Conduct + +## Introduction + +Welcome to the "STEAM-Celestial-Satellite-tracker-in-real-time" project. We are committed to fostering a collaborative and inclusive community. This code of conduct outlines our expectations for behavior and interaction within the project. By participating, you agree to abide by this code of conduct. + +## Our Pledge + +We, as members of the STEAM community, pledge to make participation in this project a positive and harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Expected Behavior + +To contribute to a safe and welcoming environment, we expect all participants to: + +1. Be respectful and considerate of others. +2. Use inclusive language and avoid offensive or derogatory remarks. +3. Act professionally and be constructive in your interactions. +4. Assume good intentions and give people the benefit of the doubt. +5. Resolve disagreements or conflicts constructively and respectfully. + +## Unacceptable Behavior + +Unacceptable behavior includes, but is not limited to: + +1. Harassment, discrimination, or intimidation in any form. +2. Verbal, written, or physical abuse or threats. +3. Offensive or inappropriate comments, including slurs and jokes. +4. Invasion of privacy, such as publishing someone's private information without their consent. +5. Any form of trolling, spamming, or unconstructive disruption. +6. Posting or discussing content that is sexually explicit, violent, or otherwise offensive. + +## Reporting and Enforcement + +If you witness or experience unacceptable behavior, please report it promptly to the project maintainers at email address - krishna.agrawal@icloud.com . All reports will be treated with confidentiality and will be taken seriously. + +The project maintainers will investigate the issue and may take appropriate action, such as warnings, temporary suspensions, or permanent bans, as deemed necessary. Our goal is to maintain a respectful and safe environment for everyone. + +## Attribution + +This code of conduct is inspired by the [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). We appreciate their work in promoting an open and welcoming community. + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq + +## Conclusion + +By participating in the STEAM-Celestial-Satellite-tracker-in-real-time project, you are agreeing to abide by this code of conduct. We are committed to upholding these guidelines to create a positive and inclusive environment for everyone involved. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..61704b2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,96 @@ +# Contributing Guidelines ✅ + +This documentation contains a set of guidelines to help you during the contribution process. +We are happy to welcome all the contributions from anyone willing to improve/add new scripts to this project. Thank you for helping out and remember, +**no contribution is too small.** + +## Submitting Contributions 👩‍💻👨‍💻 + +Below you will find the process and workflow used to review and merge your changes. + +## Step 1 : Find an issue + +- Take a look at the Existing Issues or create your **own** Issues! +- Wait for the Issue to be assigned to you after which you can start working on it. +- Note : Every change in this project should/must have an associated issue. + +## Step 2 : Fork the Project + +- Fork this Repository. This will create a Local Copy of this Repository on your Github Profile. Keep a reference to the original project in `upstream` remote. + +``` +git clone https://github.com//STEAM-Celestial-Satellite-tracker-in-real-time +cd STEAM-Celestial-Satellite-tracker-in-real-time +git remote add upstream https://github.com/savitore/STEAM-Celestial-Satellite-tracker-in-real-time.git +``` + +- If you have already forked the project, update your copy before working. + +``` +git remote update +git checkout +git rebase upstream/ +``` + +## Step 3 : Branch + +Create a new branch. Use its name to identify the issue your addressing. + +``` +# It will create a new branch with name Branch_Name and switch to that branch +$ git checkout -b branch_name +``` + +## Step 4 : Work on the issue assigned + +- Work on the issue(s) assigned to you. +- Add all the files/folders needed. +- After you've made changes or made your contribution to the project add changes to the branch you've just created by: + +``` +# To add all new files to branch Branch_Name +$ git add . +``` + +## Step 5 : Commit + +- To commit give a descriptive message for the convenience of reveiwer by: + +``` +# This message get associated with all files you have changed +$ git commit -m 'message +``` + +- **NOTE**: A PR should have only one commit. Multiple commits should be squashed. + +## Step 6 : Work Remotely + +- Now you are ready to your work to the remote repository. +- Push your work to your remote repository. + +- When your work is ready and complies with the project conventions, upload your changes to your fork: + +``` +# To push your work to your remote repository +$ git push -u origin Branch_Name +``` + +## Step 7 : Pull Request + +- Go to your repository in browser and click on compare and pull requests. +- Add a title and description to your pull request that explains your contribution. + +- Voila! Your Pull Request has been submitted and will be reviewed by the moderators and merged.🥳 + +## Need more help?🤔 + +You can refer to the following articles on basics of Git and Github and also contact the Project Mentors, in case you are stuck: + +- [Forking a Repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) +- [Cloning a Repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) +- [How to create a Pull Request](https://opensource.com/article/19/7/create-pull-request-github) +- [Getting started with Git and GitHub](https://towardsdatascience.com/getting-started-with-git-and-github-6fcd0f2d4ac6) + +## Tip from us😇 + +Learning and understanding takes time, so don't worry if things seem challenging at first. So, do not worry at all. We know **you have got this**!💪 \ No newline at end of file From e71eca3616fad0796efc13f8af6fc283c45f7f13 Mon Sep 17 00:00:00 2001 From: rkverma2022 Date: Thu, 11 Jan 2024 09:45:49 +0530 Subject: [PATCH 3/5] rkverma2022/error screen appears with a poorly displayed "TRY AGAIN" button fixed-issue #16 --- .vscode/settings.json | 3 + lib/screens/home.dart | 1176 ++++++++++++++++++++++++----------------- pubspec.lock | 50 +- pubspec.yaml | 1 + 4 files changed, 725 insertions(+), 505 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..41d590e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.sourceDirectory": "G:/GSoC Contribution/STEAM-Celestial-Satellite-tracker-in-real-time/linux/flutter" +} \ No newline at end of file diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 7248567..404f9aa 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -27,10 +27,10 @@ class Home extends StatefulWidget { } class _HomeState extends State { - - LocalStorageService get _localStorageService => GetIt.I(); + LocalStorageService get _localStorageService => + GetIt.I(); TextEditingController _searchController = TextEditingController(); - bool lgConnected=false; + bool lgConnected = false; FocusNode _searchFocusNode = FocusNode(); String dropdownvalueCountries = 'ALL'; String dropdownvalueStatus = 'ALL'; @@ -38,20 +38,18 @@ class _HomeState extends State { List itemsCountries = [ 'ALL', ]; - List itemsStatus = [ - 'ALL', - 'ALIVE', - 'DEAD', - 'RE-ENTERED', - 'FUTURE' - ]; + List itemsStatus = ['ALL', 'ALIVE', 'DEAD', 'RE-ENTERED', 'FUTURE']; List itemsOperators = []; List iso = ISO().iso; - bool decayed = false, launched=false, deployed=false, filter=false,sort=false; - bool featured=true, launchNew=false, launchOld=false; + bool decayed = false, + launched = false, + deployed = false, + filter = false, + sort = false; + bool featured = true, launchNew = false, launchOld = false; String location = ""; - double latitude=0, longitude=0, altitude=0; - bool gotServo = false, range3d=false; + double latitude = 0, longitude = 0, altitude = 0; + bool gotServo = false, range3d = false; @override void initState() { @@ -78,33 +76,32 @@ class _HomeState extends State { //check if lg is connected void checkLGConnection() { - if(_localStorageService.hasItem(StorageKeys.lgConnection)){ - if(_localStorageService.getItem(StorageKeys.lgConnection)=="connected"){ + if (_localStorageService.hasItem(StorageKeys.lgConnection)) { + if (_localStorageService.getItem(StorageKeys.lgConnection) == + "connected") { setState(() { - lgConnected=true; + lgConnected = true; }); - } - else{ + } else { setState(() { - lgConnected=false; + lgConnected = false; }); } } } - @override Widget build(BuildContext context) { return BlocProvider( create: (context) => SatelliteCubit(), child: BlocConsumer( - listener: (context,state){ - if(state is SatelliteErrorState){ + listener: (context, state) { + if (state is SatelliteErrorState) { showSnackbar(context, state.error); } }, - builder: (context, state){ - if(state is SatelliteLoadingState){ + builder: (context, state) { + if (state is SatelliteLoadingState) { return Scaffold( backgroundColor: ThemeColors.backgroundCardColor, appBar: AppBar( @@ -112,10 +109,13 @@ class _HomeState extends State { foregroundColor: ThemeColors.textPrimary, backgroundColor: ThemeColors.backgroundCardColor, elevation: 0, - title: const Text("STEAM Celestial Satellite tracker",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 24),), + title: const Text( + "STEAM Celestial Satellite tracker", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24), + ), actions: [ IconButton( - onPressed: (){}, + onPressed: () {}, icon: IconButton( icon: const Icon(Icons.settings), onPressed: () { @@ -124,8 +124,7 @@ class _HomeState extends State { MaterialPageRoute( builder: (context) => const Settings())); }, - ) - ) + )) ], ), body: SingleChildScrollView( @@ -141,7 +140,8 @@ class _HomeState extends State { height: 50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: Colors.grey), // Set the base color of the shimmer effect + color: Colors + .grey), // Set the base color of the shimmer effect ), ), )), @@ -150,11 +150,14 @@ class _HomeState extends State { child: Row( children: [ Container( - width: MediaQuery.of(context).size.width*0.5-130, + width: + MediaQuery.of(context).size.width * 0.5 - 130, height: 1, color: Colors.grey, ), - const SizedBox(width: 10,), + const SizedBox( + width: 10, + ), Container( height: 10, decoration: BoxDecoration( @@ -162,9 +165,12 @@ class _HomeState extends State { color: Colors.grey), width: 200, ), - const SizedBox(width: 10,), + const SizedBox( + width: 10, + ), Container( - width: MediaQuery.of(context).size.width*0.5-130, + width: + MediaQuery.of(context).size.width * 0.5 - 130, height: 1, color: Colors.grey, ), @@ -184,143 +190,163 @@ class _HomeState extends State { ), ), ); - } - else if(state is SatelliteLoadedState){ + } else if (state is SatelliteLoadedState) { List satellites = state.satellites; - double textWidth = _textWidth('${satellites.length} SATELLITES', TextStyle(fontSize: 20,color: ThemeColors.textPrimary)); + double textWidth = _textWidth('${satellites.length} SATELLITES', + TextStyle(fontSize: 20, color: ThemeColors.textPrimary)); return Scaffold( backgroundColor: ThemeColors.backgroundCardColor, body: CustomScrollView( slivers: [ - sliverAppBar(context,state), + sliverAppBar(context, state), SliverList( - delegate: SliverChildListDelegate( - [ - SafeArea( - child:SingleChildScrollView( - physics: const ScrollPhysics(), - child: Padding( - padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(bottom: 20), - child: Row( - children: [ - divider(textWidth), - Padding( - padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), - child: Text('${satellites.length} SATELLITES',style: TextStyle(fontSize: 20,color: ThemeColors.textPrimary)), - ), - divider(textWidth), - ], - ), - ), - ListView.builder( - primary: false, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: satellites.length, - itemBuilder:(context, index){ - return InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SatelliteInfo(satellites[index], location, latitude, longitude, altitude))); - }, - child: _buildList(context, satellites[index]), - ); - } - ), - ], - ), + delegate: SliverChildListDelegate([ + SafeArea( + child: SingleChildScrollView( + physics: const ScrollPhysics(), + child: Padding( + padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 20), + child: Row( + children: [ + divider(textWidth), + Padding( + padding: + const EdgeInsets.fromLTRB(20, 0, 20, 0), + child: Text( + '${satellites.length} SATELLITES', + style: TextStyle( + fontSize: 20, + color: ThemeColors.textPrimary)), ), - ) - ) - ] - ) - ) + divider(textWidth), + ], + ), + ), + ListView.builder( + primary: false, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: satellites.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SatelliteInfo( + satellites[index], + location, + latitude, + longitude, + altitude))); + }, + child: + _buildList(context, satellites[index]), + ); + }), + ], + ), + ), + )) + ])) ], ), - bottomNavigationBar: bottomRow(context,state), + bottomNavigationBar: bottomRow(context, state), ); - } - else if(state is FilteredSatelliteState){ + } else if (state is FilteredSatelliteState) { List searchedSatellites = state.searchedSatellites; - double textWidth = _textWidth('${searchedSatellites.length} SATELLITES', const TextStyle(fontSize: 20,color: Colors.black)); + double textWidth = _textWidth( + '${searchedSatellites.length} SATELLITES', + const TextStyle(fontSize: 20, color: Colors.black)); return Scaffold( backgroundColor: ThemeColors.backgroundCardColor, body: CustomScrollView( slivers: [ - sliverAppBar(context,state), + sliverAppBar(context, state), SliverList( - delegate: SliverChildListDelegate( - [ - SafeArea( - child: SingleChildScrollView( - physics: const ScrollPhysics(), - child: Padding( - padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(bottom: 20), - child: Row( - children: [ - divider(textWidth), - Padding( - padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), - child: Text('${searchedSatellites.length} SATELLITES',style: TextStyle(fontSize: 20,color: ThemeColors.textPrimary)), - ), - divider(textWidth), - ], - ), - ), - ListView.builder( - primary: false, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: searchedSatellites.length, - itemBuilder:(context, index){ - return InkWell( - onTap: () async{ - final result = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => SatelliteInfo(searchedSatellites[index],location, latitude, longitude, altitude))); - if(result == "range" && range3d && filter && mounted){ - context.read().filterSearchData( - _searchController.text, - dropdownvalueCountries, - dropdownvalueStatus, - decayed, - launched, - deployed, - dropdownvalueOperators, - featured, - launchNew, - launchOld, - range3d); - } - }, - child: _buildList(context, searchedSatellites[index]), - ); - } - ), - ], - ), + delegate: SliverChildListDelegate([ + SafeArea( + child: SingleChildScrollView( + physics: const ScrollPhysics(), + child: Padding( + padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 20), + child: Row( + children: [ + divider(textWidth), + Padding( + padding: + const EdgeInsets.fromLTRB(10, 0, 10, 0), + child: Text( + '${searchedSatellites.length} SATELLITES', + style: TextStyle( + fontSize: 20, + color: ThemeColors.textPrimary)), ), - ) - ) - ] - ) - ) + divider(textWidth), + ], + ), + ), + ListView.builder( + primary: false, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: searchedSatellites.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () async { + final result = await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SatelliteInfo( + searchedSatellites[index], + location, + latitude, + longitude, + altitude))); + if (result == "range" && + range3d && + filter && + mounted) { + context + .read() + .filterSearchData( + _searchController.text, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); + } + }, + child: _buildList( + context, searchedSatellites[index]), + ); + }), + ], + ), + ), + )) + ])) ], ), - bottomNavigationBar: bottomRow(context,state), + bottomNavigationBar: bottomRow(context, state), ); } return Scaffold( @@ -329,18 +355,26 @@ class _HomeState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Text("An error occurred!",overflow: TextOverflow.visible,style: TextStyle(fontSize: 40,fontWeight: FontWeight.bold),), - const SizedBox(height: 20,), - SizedBox( - height: 45, - width: 150, - child: ElevatedButton( - onPressed: (){ - context.read().fetchData(); - context.read().emit(SatelliteLoadingState()); - }, - style: ElevatedButton.styleFrom(backgroundColor: ThemeColors.primaryColor), - child: const Text('TRY AGAIN',style: TextStyle(fontSize: 20),), + const Text( + "An error occurred!", + overflow: TextOverflow.visible, + style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold), + ), + const SizedBox( + height: 20, + ), + ElevatedButton( + onPressed: () { + context.read().fetchData(); + context + .read() + .emit(SatelliteLoadingState()); + }, + style: ElevatedButton.styleFrom( + backgroundColor: ThemeColors.primaryColor), + child: const Text( + 'TRY AGAIN', + style: TextStyle(color: Colors.white), ), ) ], @@ -352,15 +386,14 @@ class _HomeState extends State { ); } - - Widget _buildList(BuildContext context, SatelliteModel satellites){ + Widget _buildList(BuildContext context, SatelliteModel satellites) { return Card( elevation: 1, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), color: ThemeColors.backgroundColor, - child: Padding( + child: Padding( padding: const EdgeInsets.all(10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -373,47 +406,76 @@ class _HomeState extends State { child: Text( satellites.name.toString(), overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w500,fontSize: 22), + style: const TextStyle( + fontWeight: FontWeight.w500, fontSize: 22), ), ), Flexible( child: Text( satellites.status!.toUpperCase(), style: TextStyle( - color: _getStatusColor(satellites.status.toString(),), + color: _getStatusColor( + satellites.status.toString(), + ), fontWeight: FontWeight.bold, - fontSize: 18 - ), + fontSize: 18), overflow: TextOverflow.ellipsis, ), ) ], ), - const SizedBox(height: 5,), - satellites.launched.toString().isEmpty || satellites.launched.toString() == 'null' ? - Container() - : Padding( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), - child: Text('${checkLaunch(satellites.launched!)} - ${parseDateString(satellites.launched!)}',overflow: TextOverflow.ellipsis,style: TextStyle(fontSize: 18,color: ThemeColors.textSecondary)), + const SizedBox( + height: 5, ), + satellites.launched.toString().isEmpty || + satellites.launched.toString() == 'null' + ? Container() + : Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), + child: Text( + '${checkLaunch(satellites.launched!)} - ${parseDateString(satellites.launched!)}', + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 18, color: ThemeColors.textSecondary)), + ), const SizedBox(height: 15), - Text('# ${satellites.satId}',overflow: TextOverflow.ellipsis,style: TextStyle(fontSize: 18,color: ThemeColors.textPrimary)), + Text('# ${satellites.satId}', + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 18, color: ThemeColors.textPrimary)), const SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ satellites.noradCatId.toString() == 'null' ? const SizedBox() - : Text(satellites.noradCatId.toString(),style: TextStyle(color: ThemeColors.primaryColor,fontWeight: FontWeight.bold,fontSize: 20),overflow: TextOverflow.visible,), - satellites.countries.toString() == 'null' || satellites.countries.toString().isEmpty - ? const SizedBox() - : MediaQuery.of(context).size.width >= 500 ? - Row( - children: [ - Icon(Icons.outlined_flag_rounded,color: ThemeColors.textPrimary,), - Text(' ${satellites.countries}',style: TextStyle(fontSize: 20,color: ThemeColors.textPrimary),overflow: TextOverflow.ellipsis,) - ], - ) : const SizedBox() + : Text( + satellites.noradCatId.toString(), + style: TextStyle( + color: ThemeColors.primaryColor, + fontWeight: FontWeight.bold, + fontSize: 20), + overflow: TextOverflow.visible, + ), + satellites.countries.toString() == 'null' || + satellites.countries.toString().isEmpty + ? const SizedBox() + : MediaQuery.of(context).size.width >= 500 + ? Row( + children: [ + Icon( + Icons.outlined_flag_rounded, + color: ThemeColors.textPrimary, + ), + Text( + ' ${satellites.countries}', + style: TextStyle( + fontSize: 20, + color: ThemeColors.textPrimary), + overflow: TextOverflow.ellipsis, + ) + ], + ) + : const SizedBox() ], ), ], @@ -439,26 +501,27 @@ class _HomeState extends State { double _textWidth(String text, TextStyle style) { final TextPainter textPainter = TextPainter( - text: TextSpan(text: text, style: style), maxLines: 1, textDirection: TextDirection.ltr) + text: TextSpan(text: text, style: style), + maxLines: 1, + textDirection: TextDirection.ltr) ..layout(minWidth: 0, maxWidth: double.infinity); return textPainter.size.width; } - void refresh(BuildContext context,SatelliteState state){ + void refresh(BuildContext context, SatelliteState state) { setState(() { - featured=true; - launchNew=false; - launchOld=false; - sort=false; - filter=false; + featured = true; + launchNew = false; + launchOld = false; + sort = false; + filter = false; _searchController.text = ""; }); context.read().fetchData(refresh: true); context.read().emit(SatelliteLoadingState()); } - SliverAppBar sliverAppBar(BuildContext context,SatelliteState state) - { + SliverAppBar sliverAppBar(BuildContext context, SatelliteState state) { return SliverAppBar( floating: true, pinned: true, @@ -467,29 +530,39 @@ class _HomeState extends State { foregroundColor: ThemeColors.textPrimary, backgroundColor: ThemeColors.backgroundCardColor, elevation: 0, - title: const Text("STEAM Celestial Satellite tracker",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 24),), + title: const Text( + "STEAM Celestial Satellite tracker", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24), + ), actions: [ TextButton( onPressed: null, child: Text( - lgConnected ? 'LG: CONNECTED' : 'LG: NOT CONNECTED',style: TextStyle(color: lgConnected ? ThemeColors.success : ThemeColors.alert,fontSize: 19),overflow: TextOverflow.visible, + lgConnected ? 'LG: CONNECTED' : 'LG: NOT CONNECTED', + style: TextStyle( + color: lgConnected ? ThemeColors.success : ThemeColors.alert, + fontSize: 19), + overflow: TextOverflow.visible, ), ), IconButton( - icon: Icon(Icons.settings,color: ThemeColors.textPrimary,), - tooltip: 'Settings', - onPressed: () async { - final result = await Navigator.push(context, - MaterialPageRoute(builder: (context) => const Settings())); - if(result=="pop"){ - checkLGConnection(); - } - if(result=="refresh"){ - if(mounted){ - refresh(context, state); - } - } - }, + icon: Icon( + Icons.settings, + color: ThemeColors.textPrimary, + ), + tooltip: 'Settings', + onPressed: () async { + final result = await Navigator.push(context, + MaterialPageRoute(builder: (context) => const Settings())); + if (result == "pop") { + checkLGConnection(); + } + if (result == "refresh") { + if (mounted) { + refresh(context, state); + } + } + }, ), const SizedBox(width: 5) ], @@ -497,28 +570,43 @@ class _HomeState extends State { elevation: 0, backgroundColor: ThemeColors.backgroundCardColor, title: Padding( - padding: const EdgeInsets.only(bottom:15), + padding: const EdgeInsets.only(bottom: 15), child: Column( children: [ - const SizedBox(height: 10,), + const SizedBox( + height: 10, + ), Card( color: ThemeColors.backgroundColor, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), - elevation:2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20)), + elevation: 2, child: TextField( focusNode: _searchFocusNode, controller: _searchController, - onChanged: (val){ - context.read().filterSearchData(val,dropdownvalueCountries,dropdownvalueStatus,decayed,launched,deployed,dropdownvalueOperators,featured,launchNew,launchOld, range3d); + onChanged: (val) { + context.read().filterSearchData( + val, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); }, keyboardType: TextInputType.text, cursorColor: ThemeColors.primaryColor, style: TextStyle(color: ThemeColors.textPrimary), decoration: InputDecoration( - border: InputBorder.none, - hintStyle: TextStyle(color: ThemeColors.searchBarColor), - hintText: 'Search satellites..', - prefixIcon: Icon(Icons.search,color: ThemeColors.primaryColor), + border: InputBorder.none, + hintStyle: TextStyle(color: ThemeColors.searchBarColor), + hintText: 'Search satellites..', + prefixIcon: + Icon(Icons.search, color: ThemeColors.primaryColor), ), ), ), @@ -529,16 +617,16 @@ class _HomeState extends State { ); } - Widget divider(double textWidth){ + Widget divider(double textWidth) { return Container( - width: (MediaQuery.of(context).size.width - textWidth - 60)*0.5, + width: (MediaQuery.of(context).size.width - textWidth - 60) * 0.5, height: 0.5, color: ThemeColors.textPrimary, ); } - void _dropDownCountries(){ - for(int i=0;i data = iso[i]; itemsCountries.add(data['Name'].toString()); } @@ -548,25 +636,30 @@ class _HomeState extends State { final SharedPreferences prefs = await SharedPreferences.getInstance(); itemsOperators.add('ALL'); List? items = prefs.getStringList('operators'); - for(int i=0;i(context), + value: BlocProvider.of(context), child: Padding( - padding: const EdgeInsets.symmetric(vertical: 20), + padding: const EdgeInsets.symmetric(vertical: 20), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 15), - child: Text('SORT BY',style: TextStyle(fontSize: 22,color: ThemeColors.textPrimary),), + child: Text( + 'SORT BY', + style: TextStyle(fontSize: 22, color: ThemeColors.textPrimary), + ), + ), + const SizedBox( + height: 10, ), - const SizedBox(height: 10,), Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Divider( @@ -575,90 +668,92 @@ class _HomeState extends State { color: Colors.grey[500], ), ), - const SizedBox(height: 10,), + const SizedBox( + height: 10, + ), InkWell( - onTap: (){ + onTap: () { _setState(() { - featured=true; - launchNew=false; - launchOld=false; - sort=false; + featured = true; + launchNew = false; + launchOld = false; + sort = false; }); - Navigator.pop(context); - context.read().filterSearchData( - _searchController.text, - dropdownvalueCountries, - dropdownvalueStatus, - decayed, - launched, - deployed, - dropdownvalueOperators, - featured, - launchNew, - launchOld, - range3d); + Navigator.pop(context); + context.read().filterSearchData( + _searchController.text, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); }, child: Container( - padding: const EdgeInsets.symmetric(vertical: 10,horizontal: 15), - width: double.infinity , - child: sortItem('Featured', featured) - ), + padding: + const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + width: double.infinity, + child: sortItem('Featured', featured)), ), InkWell( - onTap: (){ + onTap: () { _setState(() { - featured=false; - launchNew=true; - launchOld=false; - sort=true; + featured = false; + launchNew = true; + launchOld = false; + sort = true; }); - Navigator.pop(context); - context.read().filterSearchData( - _searchController.text, - dropdownvalueCountries, - dropdownvalueStatus, - decayed, - launched, - deployed, - dropdownvalueOperators, - featured, - launchNew, - launchOld, - range3d); + Navigator.pop(context); + context.read().filterSearchData( + _searchController.text, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); }, child: Container( - padding: const EdgeInsets.symmetric(vertical: 10,horizontal: 15), - width: double.infinity , - child: sortItem('Launch date - New to Old', launchNew) - ), + padding: + const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + width: double.infinity, + child: sortItem('Launch date - New to Old', launchNew)), ), InkWell( - onTap: (){ + onTap: () { _setState(() { - featured=false; - launchNew=false; - launchOld=true; - sort=true; + featured = false; + launchNew = false; + launchOld = true; + sort = true; }); - Navigator.pop(context); - context.read().filterSearchData( - _searchController.text, - dropdownvalueCountries, - dropdownvalueStatus, - decayed, - launched, - deployed, - dropdownvalueOperators, - featured, - launchNew, - launchOld, - range3d); + Navigator.pop(context); + context.read().filterSearchData( + _searchController.text, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); }, child: Container( - padding: const EdgeInsets.symmetric(vertical: 10,horizontal: 15), - width: double.infinity , - child: sortItem('Launch date - Old to New', launchOld) - ), + padding: + const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + width: double.infinity, + child: sortItem('Launch date - Old to New', launchOld)), ), ], ), @@ -666,7 +761,7 @@ class _HomeState extends State { ); } - Widget buildFilter(BuildContext context, StateSetter _setState){ + Widget buildFilter(BuildContext context, StateSetter _setState) { return BlocProvider.value( value: BlocProvider.of(context), child: Column( @@ -678,28 +773,44 @@ class _HomeState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - Text('FILTERS',style: TextStyle(fontSize: 22,color: ThemeColors.textPrimary),), + Text( + 'FILTERS', + style: + TextStyle(fontSize: 22, color: ThemeColors.textPrimary), + ), const SizedBox(height: 20), Divider( thickness: 0.5, height: 0.5, color: Colors.grey[500], ), - const SizedBox(height: 20,), - Text('Country of Origin',style: TextStyle(fontSize:18, fontWeight: FontWeight.w500,color: ThemeColors.primaryColor),), + const SizedBox( + height: 20, + ), + Text( + 'Country of Origin', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w500, + color: ThemeColors.primaryColor), + ), DropdownButton( - // isExpanded: true, + // isExpanded: true, elevation: 4, value: dropdownvalueCountries, - underline: Container( - height: 1, color:ThemeColors.textPrimary), - style: TextStyle(color: ThemeColors.textPrimary,fontSize: 20), - items: itemsCountries.map((String items){ + underline: + Container(height: 1, color: ThemeColors.textPrimary), + style: + TextStyle(color: ThemeColors.textPrimary, fontSize: 20), + items: itemsCountries.map((String items) { return DropdownMenuItem( value: items, child: SizedBox( - width: MediaQuery.of(context).size.width-50, - child: Text(items,overflow: TextOverflow.ellipsis,)), + width: MediaQuery.of(context).size.width - 50, + child: Text( + items, + overflow: TextOverflow.ellipsis, + )), ); }).toList(), onChanged: (String? newValue) { @@ -707,9 +818,10 @@ class _HomeState extends State { dropdownvalueCountries = newValue!; checkFilter(); }); - } + }), + const SizedBox( + height: 30, ), - const SizedBox(height: 30,), Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -717,20 +829,31 @@ class _HomeState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Status',style: TextStyle(fontSize:18, fontWeight: FontWeight.w500,color: ThemeColors.primaryColor),), + Text( + 'Status', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w500, + color: ThemeColors.primaryColor), + ), DropdownButton( - // isExpanded: true, + // isExpanded: true, elevation: 4, value: dropdownvalueStatus, underline: Container( - height: 1, color:ThemeColors.textPrimary), - style: TextStyle(color: ThemeColors.textPrimary,fontSize: 20), - items: itemsStatus.map((String items){ + height: 1, color: ThemeColors.textPrimary), + style: TextStyle( + color: ThemeColors.textPrimary, fontSize: 20), + items: itemsStatus.map((String items) { return DropdownMenuItem( value: items, child: SizedBox( - width: MediaQuery.of(context).size.width*0.3, - child: Text(items,overflow: TextOverflow.ellipsis,)), + width: + MediaQuery.of(context).size.width * 0.3, + child: Text( + items, + overflow: TextOverflow.ellipsis, + )), ); }).toList(), onChanged: (String? newValue) { @@ -738,27 +861,37 @@ class _HomeState extends State { dropdownvalueStatus = newValue!; checkFilter(); }); - } - ) + }) ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('Operators',style: TextStyle(fontSize:18, fontWeight: FontWeight.w500,color: ThemeColors.primaryColor),), + Text( + 'Operators', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w500, + color: ThemeColors.primaryColor), + ), DropdownButton( - // isExpanded: true, + // isExpanded: true, elevation: 4, value: dropdownvalueOperators, underline: Container( - height: 1, color:ThemeColors.textPrimary), - style: TextStyle(color: ThemeColors.textPrimary,fontSize: 20), - items: itemsOperators.map((String items){ + height: 1, color: ThemeColors.textPrimary), + style: TextStyle( + color: ThemeColors.textPrimary, fontSize: 20), + items: itemsOperators.map((String items) { return DropdownMenuItem( value: items, child: SizedBox( - width: MediaQuery.of(context).size.width*0.3, - child: Text(items,overflow: TextOverflow.ellipsis,)), + width: + MediaQuery.of(context).size.width * 0.3, + child: Text( + items, + overflow: TextOverflow.ellipsis, + )), ); }).toList(), onChanged: (String? newValue) { @@ -766,23 +899,29 @@ class _HomeState extends State { dropdownvalueOperators = newValue!; checkFilter(); }); - } - ) + }) ], ), ], ), - const SizedBox(height: 20,), + const SizedBox( + height: 20, + ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Flexible( child: Row( children: [ - Flexible(child: Text('Decayed',style: TextStyle(fontSize: 18, color: ThemeColors.textPrimary),overflow: TextOverflow.visible)), + Flexible( + child: Text('Decayed', + style: TextStyle( + fontSize: 18, + color: ThemeColors.textPrimary), + overflow: TextOverflow.visible)), Checkbox( value: decayed, - onChanged: (bool? value){ + onChanged: (bool? value) { _setState(() { decayed = value!; checkFilter(); @@ -797,10 +936,15 @@ class _HomeState extends State { Flexible( child: Row( children: [ - Flexible(child:Text('Launched',style: TextStyle(fontSize: 18, color: ThemeColors.textPrimary),overflow: TextOverflow.visible)), + Flexible( + child: Text('Launched', + style: TextStyle( + fontSize: 18, + color: ThemeColors.textPrimary), + overflow: TextOverflow.visible)), Checkbox( value: launched, - onChanged: (bool? value){ + onChanged: (bool? value) { _setState(() { launched = value!; checkFilter(); @@ -815,10 +959,16 @@ class _HomeState extends State { Flexible( child: Row( children: [ - Flexible(child: Text('Deployed',style: TextStyle(fontSize: 18, color: ThemeColors.textPrimary),overflow: TextOverflow.visible,)), + Flexible( + child: Text( + 'Deployed', + style: TextStyle( + fontSize: 18, color: ThemeColors.textPrimary), + overflow: TextOverflow.visible, + )), Checkbox( value: deployed, - onChanged: (bool? value){ + onChanged: (bool? value) { _setState(() { deployed = value!; checkFilter(); @@ -832,29 +982,39 @@ class _HomeState extends State { ) ], ), - const SizedBox(height: 20,), - location=="access" ? - Row( - children: [ - Checkbox( - value: range3d, - onChanged: (bool? value){ - _setState(() { - range3d = value!; - checkFilter(); - }); - }, - checkColor: ThemeColors.backgroundColor, - activeColor: ThemeColors.primaryColor, - ), - Flexible(child: Text('Only show the satellites that are in range to view in 3D',style: TextStyle(fontSize: 18, color: ThemeColors.textPrimary),overflow: TextOverflow.visible)), - ], - ) : - const SizedBox(), + const SizedBox( + height: 20, + ), + location == "access" + ? Row( + children: [ + Checkbox( + value: range3d, + onChanged: (bool? value) { + _setState(() { + range3d = value!; + checkFilter(); + }); + }, + checkColor: ThemeColors.backgroundColor, + activeColor: ThemeColors.primaryColor, + ), + Flexible( + child: Text( + 'Only show the satellites that are in range to view in 3D', + style: TextStyle( + fontSize: 18, + color: ThemeColors.textPrimary), + overflow: TextOverflow.visible)), + ], + ) + : const SizedBox(), ], ), ), - const SizedBox(height: 10,), + const SizedBox( + height: 10, + ), const Divider( height: 5, thickness: 1, @@ -864,23 +1024,55 @@ class _HomeState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - filter ? + filter + ? SizedBox( + height: 50, + child: ElevatedButton( + onPressed: () { + _setState(() { + dropdownvalueCountries = 'ALL'; + dropdownvalueStatus = 'ALL'; + dropdownvalueOperators = 'ALL'; + deployed = false; + decayed = false; + launched = false; + range3d = false; + }); + setState(() {}); + checkFilter(); + Navigator.pop(context); + context.read().filterSearchData( + _searchController.text, + dropdownvalueCountries, + dropdownvalueStatus, + decayed, + launched, + deployed, + dropdownvalueOperators, + featured, + launchNew, + launchOld, + range3d); + }, + style: ElevatedButton.styleFrom( + backgroundColor: ThemeColors.backgroundColor, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + side: + const BorderSide(color: Colors.black12))), + child: Text( + 'CLEAR', + style: TextStyle( + color: ThemeColors.primaryColor, fontSize: 20), + ), + ), + ) + : const SizedBox(), SizedBox( height: 50, child: ElevatedButton( - onPressed: (){ - _setState(() { - dropdownvalueCountries='ALL'; - dropdownvalueStatus='ALL'; - dropdownvalueOperators='ALL'; - deployed=false; - decayed=false; - launched=false; - range3d=false; - }); - setState(() { - - }); + onPressed: () { checkFilter(); Navigator.pop(context); context.read().filterSearchData( @@ -896,32 +1088,15 @@ class _HomeState extends State { launchOld, range3d); }, - style: ElevatedButton.styleFrom(backgroundColor: ThemeColors.backgroundColor,elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5),side: const BorderSide(color: Colors.black12))), - child: Text('CLEAR',style: TextStyle(color: ThemeColors.primaryColor,fontSize: 20),), - ), - ) : - const SizedBox(), - SizedBox( - height: 50, - child: ElevatedButton( - onPressed: (){ - checkFilter(); - Navigator.pop(context); - context.read().filterSearchData( - _searchController.text, - dropdownvalueCountries, - dropdownvalueStatus, - decayed, - launched, - deployed, - dropdownvalueOperators, - featured, - launchNew, - launchOld, - range3d); - }, - style: ElevatedButton.styleFrom(backgroundColor: ThemeColors.primaryColor,shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))), - child: Text('APPLY',style: TextStyle(color: ThemeColors.backgroundColor,fontSize: 20),), + style: ElevatedButton.styleFrom( + backgroundColor: ThemeColors.primaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5))), + child: Text( + 'APPLY', + style: TextStyle( + color: ThemeColors.backgroundColor, fontSize: 20), + ), ), ), ], @@ -932,7 +1107,7 @@ class _HomeState extends State { ); } - Widget bottomRow(BuildContext context,SatelliteState state){ + Widget bottomRow(BuildContext context, SatelliteState state) { return BottomAppBar( color: ThemeColors.backgroundColor, elevation: 5, @@ -940,119 +1115,145 @@ class _HomeState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ InkWell( - onTap: (){ + onTap: () { showModalBottomSheet( - isDismissible: true, - enableDrag: false, - backgroundColor: ThemeColors.backgroundColor, - context: context, - builder: (_context) => StatefulBuilder( - builder: (BuildContext _context, StateSetter _setState){ - return buildSort(context,_setState); - }), - isScrollControlled: true, + isDismissible: true, + enableDrag: false, + backgroundColor: ThemeColors.backgroundColor, + context: context, + builder: (_context) => StatefulBuilder( + builder: (BuildContext _context, StateSetter _setState) { + return buildSort(context, _setState); + }), + isScrollControlled: true, ); }, child: Container( - width: MediaQuery.of(context).size.width*0.5-0.25, + width: MediaQuery.of(context).size.width * 0.5 - 0.25, padding: const EdgeInsets.symmetric(vertical: 15), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon(Icons.sort_rounded,color: Colors.black54,size: 25,), - const SizedBox(width: 10,), - const Text('SORT',style: TextStyle(color: Colors.black54,fontSize: 20),), - sort ? - Padding( - padding: const EdgeInsets.only(bottom: 12.0,left: 5), - child: Container( - width: 6.5, - height: 6.5, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: ThemeColors.primaryColor - ), - ), - ) : - const SizedBox() + const Icon( + Icons.sort_rounded, + color: Colors.black54, + size: 25, + ), + const SizedBox( + width: 10, + ), + const Text( + 'SORT', + style: TextStyle(color: Colors.black54, fontSize: 20), + ), + sort + ? Padding( + padding: + const EdgeInsets.only(bottom: 12.0, left: 5), + child: Container( + width: 6.5, + height: 6.5, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: ThemeColors.primaryColor), + ), + ) + : const SizedBox() ], ), - ) - ), + )), Container( width: 0.5, height: 20, color: Colors.black54, ), InkWell( - onTap: (){ + onTap: () { showModalBottomSheet( - isDismissible: true, - enableDrag: false, - backgroundColor: ThemeColors.backgroundColor, - context: context, - builder: (_context) => StatefulBuilder( - builder: (BuildContext _context, StateSetter _setState){ - return buildFilter(context,_setState); - }), - isScrollControlled: true, + isDismissible: true, + enableDrag: false, + backgroundColor: ThemeColors.backgroundColor, + context: context, + builder: (_context) => StatefulBuilder( + builder: (BuildContext _context, StateSetter _setState) { + return buildFilter(context, _setState); + }), + isScrollControlled: true, ); }, child: Container( - width: MediaQuery.of(context).size.width*0.5-0.25, + width: MediaQuery.of(context).size.width * 0.5 - 0.25, padding: const EdgeInsets.symmetric(vertical: 15), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon(Icons.filter_list,color: Colors.black54,size: 25,), - const SizedBox(width: 10,), - const Text('FILTER',style: TextStyle(color: Colors.black54,fontSize: 20),), - filter ? - Padding( - padding: const EdgeInsets.only(bottom: 12.0,left: 5), - child: Container( - width: 6.5, - height: 6.5, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: ThemeColors.primaryColor - ), - ), - ) : - const SizedBox() + const Icon( + Icons.filter_list, + color: Colors.black54, + size: 25, + ), + const SizedBox( + width: 10, + ), + const Text( + 'FILTER', + style: TextStyle(color: Colors.black54, fontSize: 20), + ), + filter + ? Padding( + padding: + const EdgeInsets.only(bottom: 12.0, left: 5), + child: Container( + width: 6.5, + height: 6.5, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: ThemeColors.primaryColor), + ), + ) + : const SizedBox() ], ), - ) - ), + )), ], ), ); } - Widget sortItem(String message, bool check){ - return Text(message,style: TextStyle(fontSize: 20,color: check ? ThemeColors.primaryColor : ThemeColors.textSecondary),); + Widget sortItem(String message, bool check) { + return Text( + message, + style: TextStyle( + fontSize: 20, + color: check ? ThemeColors.primaryColor : ThemeColors.textSecondary), + ); } - void checkFilter(){ - if(decayed == false && deployed == false && launched == false && range3d == false && dropdownvalueCountries == 'ALL' && dropdownvalueStatus == 'ALL' && dropdownvalueOperators=='ALL'){ + void checkFilter() { + if (decayed == false && + deployed == false && + launched == false && + range3d == false && + dropdownvalueCountries == 'ALL' && + dropdownvalueStatus == 'ALL' && + dropdownvalueOperators == 'ALL') { setState(() { - filter=false; + filter = false; }); - } - else{ + } else { setState(() { - filter=true; + filter = true; }); } } void _determinePosition() async { - if(_localStorageService.hasItem(StorageKeys.latitude)){ + if (_localStorageService.hasItem(StorageKeys.latitude)) { setState(() { - location=_localStorageService.getItem(StorageKeys.location); - latitude=_localStorageService.getItem(StorageKeys.latitude); - longitude=_localStorageService.getItem(StorageKeys.longitude); - altitude=_localStorageService.getItem(StorageKeys.altitude); + location = _localStorageService.getItem(StorageKeys.location); + latitude = _localStorageService.getItem(StorageKeys.latitude); + longitude = _localStorageService.getItem(StorageKeys.longitude); + altitude = _localStorageService.getItem(StorageKeys.altitude); }); } bool serviceEnabled; @@ -1061,7 +1262,7 @@ class _HomeState extends State { // Test if location services are enabled. serviceEnabled = await Geolocator.isLocationServiceEnabled(); if (!serviceEnabled) { - location='Location services are disabled.'; + location = 'Location services are disabled.'; // Location services are not enabled don't continue // accessing the position and request users of the // App to enable the location services. @@ -1071,36 +1272,36 @@ class _HomeState extends State { if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); if (permission == LocationPermission.denied) { - location='Location permissions are denied'; + location = 'Location permissions are denied'; // Permissions are denied, next time you could try // requesting permissions again } } if (permission == LocationPermission.deniedForever) { - location='Location permissions are permanently denied, we cannot request permissions.'; + location = + 'Location permissions are permanently denied, we cannot request permissions.'; // Permissions are denied forever, handle appropriately. } setState(() { - location="granted"; + location = "granted"; }); Position position = await Geolocator.getCurrentPosition(); - setState(() { - location='access'; - latitude=position.latitude; - longitude=position.longitude; - altitude=position.altitude; - _localStorageService.setItem(StorageKeys.location, location); - _localStorageService.setItem(StorageKeys.latitude, latitude); - _localStorageService.setItem(StorageKeys.longitude, longitude); - _localStorageService.setItem(StorageKeys.altitude, altitude); - }); + setState(() { + location = 'access'; + latitude = position.latitude; + longitude = position.longitude; + altitude = position.altitude; + _localStorageService.setItem(StorageKeys.location, location); + _localStorageService.setItem(StorageKeys.latitude, latitude); + _localStorageService.setItem(StorageKeys.longitude, longitude); + _localStorageService.setItem(StorageKeys.altitude, altitude); + }); } - - String checkLaunch(String _datetime){ + String checkLaunch(String _datetime) { String current = DateTime.now().toString(); - if(current.compareTo(_datetime)<0){ + if (current.compareTo(_datetime) < 0) { return 'Launching On'; } return 'Launched'; @@ -1149,5 +1350,4 @@ class _HomeState extends State { ), ); } - } diff --git a/pubspec.lock b/pubspec.lock index e0940ec..115fbfe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.18.0" connectivity_plus: dependency: "direct main" description: @@ -264,6 +264,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.6.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: f0b8d115a13ecf827013ec9fc883390ccc0e87a96ed5347a3114cac177ef18e8 + url: "https://pub.dev" + source: hosted + version: "6.1.0" http: dependency: "direct main" description: @@ -324,26 +332,26 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" nested: dependency: transitive description: @@ -577,26 +585,26 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -617,10 +625,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.1" typed_data: dependency: transitive description: @@ -709,6 +717,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" win32: dependency: transitive description: @@ -734,5 +750,5 @@ packages: source: hosted version: "6.3.0" sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" flutter: ">=3.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 51521b9..635c447 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: geolocator: ^10.0.0 flutter_compass: ^0.7.0 country_flags: ^2.1.0 + google_fonts: ^6.1.0 dev_dependencies: flutter_test: From 298dab5a286d459dba2e65e5c97ee9e2ab327bb5 Mon Sep 17 00:00:00 2001 From: andoriyaprashant Date: Thu, 11 Jan 2024 22:49:25 +0530 Subject: [PATCH 4/5] Ui updated --- lib/screens/faq.dart | 92 ++++++++++++++++----------------------- lib/screens/settings.dart | 1 + 2 files changed, 38 insertions(+), 55 deletions(-) diff --git a/lib/screens/faq.dart b/lib/screens/faq.dart index 3fa504d..dc17630 100644 --- a/lib/screens/faq.dart +++ b/lib/screens/faq.dart @@ -1,18 +1,19 @@ import 'package:flutter/material.dart'; +import 'package:steam_celestial_satellite_tracker_in_real_time/utils/colors.dart'; class FAQScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, + backgroundColor: ThemeColors.backgroundCardColor, appBar: AppBar( backgroundColor: Colors.transparent, - foregroundColor: Colors.black, + foregroundColor: ThemeColors.textPrimary, elevation: 0, leading: IconButton( icon: Icon( Icons.arrow_back_rounded, - color: Colors.black, + color: ThemeColors.textPrimary, ), onPressed: () { Navigator.pop(context); @@ -27,31 +28,11 @@ class FAQScreen extends StatelessWidget { ), ), ), - body: Column( - children: [ - SizedBox(height: 40), - Expanded( - child: Container( - margin: EdgeInsets.fromLTRB(15, 15, 15, 60), - padding: EdgeInsets.all(30), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(40), - topRight: Radius.circular(40), - bottomLeft: Radius.circular(40), - bottomRight: Radius.circular(40), - ), - border: Border.all( - color: Colors.red, - width: 2.0, - ), - ), - child: SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()), - child: Column( - children: [ - FAQItem( + body: Container( + padding: EdgeInsets.all(16), + child: ListView( + children: [ + FAQItem( question: 'How does the STEAM Celestial Satellite Tracker work?', answer: 'The STEAM Celestial Satellite Tracker utilizes an Arduino-controlled pointer and Liquid Galaxy rig to visualize satellite orbits. The app provides real-time information about satellite movements and offers a unique way to interact with the satellite data.', ), @@ -79,45 +60,46 @@ class FAQScreen extends StatelessWidget { question: 'How can I contribute to the development of the app?', answer: 'We welcome contributions! Feel free to report issues, bugs, or submit feature requests through our issue tracker. If you are interested in contributing code, you can submit a pull request.' ), - ], - ), - ), - ), - ), - ], + ], + ), ), ); } } -class FAQItem extends StatefulWidget { +class FAQItem extends StatelessWidget { final String question; final String answer; - FAQItem({required this.question, required this.answer}); - - @override - _FAQItemState createState() => _FAQItemState(); -} -class _FAQItemState extends State { - bool isExpanded = false; + FAQItem({required this.question, required this.answer}); @override Widget build(BuildContext context) { - return ExpansionTile( - title: Text(widget.question), - trailing: Icon(isExpanded ? Icons.arrow_drop_up : Icons.arrow_drop_down), - onExpansionChanged: (bool expanded) { - setState(() { - isExpanded = expanded; - }); - }, - children: [ - Padding( - padding: const EdgeInsets.all(16.0), - child: Text(widget.answer), + return Card( + elevation: 2, + margin: EdgeInsets.symmetric(vertical: 8), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + side: BorderSide( + color: Colors.red, + width: 0.5, ), - ], + ), + child: ExpansionTile( + title: Text( + question, + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text(answer), + ), + ], + ), ); } } \ No newline at end of file diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 91a5661..20b0f30 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -130,6 +130,7 @@ class _SettingsState extends State { trailing: const Icon(Icons.arrow_forward), leading: _buildIcon(Icons.help_center_outlined), ), + _divider(), ListTile( onTap: (){ Navigator.push(context, From 9c49038b8ddf8f1813a2acd58992cd2b4326d4f7 Mon Sep 17 00:00:00 2001 From: andoriyaprashant Date: Thu, 11 Jan 2024 23:10:35 +0530 Subject: [PATCH 5/5] Ui updated (red border) --- lib/screens/faq.dart | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/screens/faq.dart b/lib/screens/faq.dart index dc17630..78a94f9 100644 --- a/lib/screens/faq.dart +++ b/lib/screens/faq.dart @@ -78,14 +78,7 @@ class FAQItem extends StatelessWidget { return Card( elevation: 2, margin: EdgeInsets.symmetric(vertical: 8), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - side: BorderSide( - color: Colors.red, - width: 0.5, - ), - ), + color: Colors.white, child: ExpansionTile( title: Text( question,