Skip to content

Commit

Permalink
feat: Continue helldivers (adding planets)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisL61 committed Nov 16, 2024
1 parent 41a6051 commit 7b70d9c
Show file tree
Hide file tree
Showing 44 changed files with 632 additions and 101 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:flutter/widgets.dart';
import 'package:games_richpresence/gen/assets.gen.dart';

class HelldiversButton extends StatefulWidget {
final String text;
final Function onClick;

const HelldiversButton({super.key, required this.text, required this.onClick});

@override
State<HelldiversButton> createState() => _HelldiversButtonState();
}

class _HelldiversButtonState extends State<HelldiversButton> {
@override
Widget build(BuildContext context) {
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
widget.onClick();
},
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 1),
border: Border.all(
color: Color(0xFF30302f),
width: 2,
),
image: DecorationImage(
image: AssetImage(Assets.helldivers.buttons.buttonBackground.path), repeat: ImageRepeat.repeat),
),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(
widget.text,
style: TextStyle(
color: Color.fromRGBO(255, 255, 255, 1),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/faction.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/objective.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/planets.dart';

class HelldiversPlanetPanel extends StatelessWidget {
Expand All @@ -10,55 +12,133 @@ class HelldiversPlanetPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 400,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: Color(0xFFc9c9cb),
width: 2,
width:350,
child: Column(
children: [
if (planet.objective != null)
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Image(image: AssetImage(planet.objective!.icon), width: 20, height: 20),
SizedBox(width: 10),
Text(
planet.objective!.name,
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
],
),
),
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: Color(0xFFffe702),
width: 2,
),
),
),
child: Column(
children: [
Row(
children: [
Image(image: AssetImage(planet.owner.icon), width: 70, height: 70),
SizedBox(width: 20),
Expanded(
child: Column(
children: [
Text(
planet.name,
style: TextStyle(
color: planet.owner.color,
fontSize: 20,
fontWeight: FontWeight.bold,
padding: EdgeInsets.all(2),
child: Column(
children: [
Container(
width: 350,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: Color(0xFFc9c9cb),
width: 2,
),
),
SizedBox(width: 10),
Text(
planet.sector,
style: TextStyle(
color: planet.owner.color,
fontSize: 14,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image(image: AssetImage(planet.owner.icon), width: 50, height: 50),
),
SizedBox(width: 20),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
planet.name,
style: TextStyle(
color: planet.owner.color, fontSize: 20, fontWeight: FontWeight.w800, height: 1),
),
Text(
planet.sector,
style: TextStyle(color: planet.owner.color, fontSize: 16, fontWeight: FontWeight.bold),
),
],
))
]),
Image.network(
planet.biomeImage,
width: 350,
height: 100,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
width: 350,
height: 100,
color: Color(0xFF3F3F3F),
),
),
],
),
],
)),
Image.network(
planet.biomeImage,
width: 400,
height: 200,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
width: 400,
height: 200,
color: Color(0xFF3F3F3F),
),
),
],
)
],
));
if (planet.objectiveProgression != null && planet.ennemy != null) SizedBox(height: 2),
if (planet.objectiveProgression != null && planet.ennemy != null)
Container(
width:350,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: planet.owner.color,
width: 2,
),
),
padding: EdgeInsets.all(4),
child: Row(
children: [
SizedBox(width: 2),
Text(
(planet.objectiveProgression! * 100).toStringAsFixed(2) + "%",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
SizedBox(width: 10),
Flexible(
child: Container(
color: HelldiversFactions.humans.color,
height: 20,
),
flex: (planet.objectiveProgression! * 100).floor(),
),
SizedBox(width:2),
Flexible(
child: Container(
color: planet.ennemy!.color,
height: 20,
),
flex: ((1 - planet.objectiveProgression!) * 100).floor(),
),
],
),
)],
)),
],
),
);
}
}
87 changes: 87 additions & 0 deletions games_richpresence/lib/gen/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions games_richpresence/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:games_richpresence/pages/helldivers/activity_select/planet_select_page.dart';
import 'package:games_richpresence/pages/home/home.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:games_richpresence/pages/sea_of_thieves/activities/choose_activity.dart';
Expand Down Expand Up @@ -37,6 +38,7 @@ class _MyAppState extends State<MyApp> {
TheFinalsGroupPage.route: (context) => TheFinalsGroupPage(),
TheFinalsGamemodesCategoriesPage.route: (context) => TheFinalsGamemodesCategoriesPage(),
TheFinalsGamemodesPageRoute.route: (context) => TheFinalsGamemodesPageRoute(),
HelldiversPlanetSelectPage.route: (context) => HelldiversPlanetSelectPage(),
},
);
}
Expand Down
Loading

0 comments on commit 7b70d9c

Please sign in to comment.