Skip to content

Commit 7b70d9c

Browse files
committed
feat: Continue helldivers (adding planets)
1 parent 41a6051 commit 7b70d9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+632
-101
lines changed
Loading
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.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import 'package:flutter/widgets.dart';
2+
import 'package:games_richpresence/gen/assets.gen.dart';
3+
4+
class HelldiversButton extends StatefulWidget {
5+
final String text;
6+
final Function onClick;
7+
8+
const HelldiversButton({super.key, required this.text, required this.onClick});
9+
10+
@override
11+
State<HelldiversButton> createState() => _HelldiversButtonState();
12+
}
13+
14+
class _HelldiversButtonState extends State<HelldiversButton> {
15+
@override
16+
Widget build(BuildContext context) {
17+
return MouseRegion(
18+
cursor: SystemMouseCursors.click,
19+
child: GestureDetector(
20+
onTap: () {
21+
widget.onClick();
22+
},
23+
child: Container(
24+
decoration: BoxDecoration(
25+
color: Color.fromRGBO(0, 0, 0, 1),
26+
border: Border.all(
27+
color: Color(0xFF30302f),
28+
width: 2,
29+
),
30+
image: DecorationImage(
31+
image: AssetImage(Assets.helldivers.buttons.buttonBackground.path), repeat: ImageRepeat.repeat),
32+
),
33+
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
34+
child: Text(
35+
widget.text,
36+
style: TextStyle(
37+
color: Color.fromRGBO(255, 255, 255, 1),
38+
fontSize: 20,
39+
fontWeight: FontWeight.bold,
40+
),
41+
),
42+
),
43+
),
44+
);
45+
}
46+
}
Lines changed: 125 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import 'package:flutter/material.dart';
12
import 'package:flutter/widgets.dart';
23
import 'package:games_richpresence/model/class/game_activities/helldivers/faction.dart';
4+
import 'package:games_richpresence/model/class/game_activities/helldivers/objective.dart';
35
import 'package:games_richpresence/model/class/game_activities/helldivers/planets.dart';
46

57
class HelldiversPlanetPanel extends StatelessWidget {
@@ -10,55 +12,133 @@ class HelldiversPlanetPanel extends StatelessWidget {
1012
@override
1113
Widget build(BuildContext context) {
1214
return Container(
13-
width: 400,
14-
decoration: BoxDecoration(
15-
color: Color.fromRGBO(0, 0, 0, 0.8),
16-
border: Border.all(
17-
color: Color(0xFFc9c9cb),
18-
width: 2,
15+
width:350,
16+
child: Column(
17+
children: [
18+
if (planet.objective != null)
19+
Container(
20+
decoration: BoxDecoration(
21+
color: Color.fromRGBO(0, 0, 0, 0.8),
22+
),
23+
padding: EdgeInsets.symmetric(horizontal: 8),
24+
child: Row(
25+
children: [
26+
Image(image: AssetImage(planet.objective!.icon), width: 20, height: 20),
27+
SizedBox(width: 10),
28+
Text(
29+
planet.objective!.name,
30+
style: TextStyle(
31+
color: Colors.white,
32+
fontSize: 20,
33+
),
34+
),
35+
],
36+
),
37+
),
38+
Container(
39+
decoration: BoxDecoration(
40+
color: Color.fromRGBO(0, 0, 0, 0.8),
41+
border: Border.all(
42+
color: Color(0xFFffe702),
43+
width: 2,
44+
),
1945
),
20-
),
21-
child: Column(
22-
children: [
23-
Row(
24-
children: [
25-
Image(image: AssetImage(planet.owner.icon), width: 70, height: 70),
26-
SizedBox(width: 20),
27-
Expanded(
28-
child: Column(
29-
children: [
30-
Text(
31-
planet.name,
32-
style: TextStyle(
33-
color: planet.owner.color,
34-
fontSize: 20,
35-
fontWeight: FontWeight.bold,
46+
padding: EdgeInsets.all(2),
47+
child: Column(
48+
children: [
49+
Container(
50+
width: 350,
51+
decoration: BoxDecoration(
52+
color: Color.fromRGBO(0, 0, 0, 0.8),
53+
border: Border.all(
54+
color: Color(0xFFc9c9cb),
55+
width: 2,
3656
),
3757
),
38-
SizedBox(width: 10),
39-
Text(
40-
planet.sector,
41-
style: TextStyle(
42-
color: planet.owner.color,
43-
fontSize: 14,
44-
),
58+
child: Column(
59+
crossAxisAlignment: CrossAxisAlignment.start,
60+
children: [
61+
Row(children: [
62+
Padding(
63+
padding: const EdgeInsets.all(8.0),
64+
child: Image(image: AssetImage(planet.owner.icon), width: 50, height: 50),
65+
),
66+
SizedBox(width: 20),
67+
Expanded(
68+
child: Column(
69+
mainAxisAlignment: MainAxisAlignment.center,
70+
crossAxisAlignment: CrossAxisAlignment.start,
71+
children: [
72+
Text(
73+
planet.name,
74+
style: TextStyle(
75+
color: planet.owner.color, fontSize: 20, fontWeight: FontWeight.w800, height: 1),
76+
),
77+
Text(
78+
planet.sector,
79+
style: TextStyle(color: planet.owner.color, fontSize: 16, fontWeight: FontWeight.bold),
80+
),
81+
],
82+
))
83+
]),
84+
Image.network(
85+
planet.biomeImage,
86+
width: 350,
87+
height: 100,
88+
fit: BoxFit.cover,
89+
errorBuilder: (context, error, stackTrace) => Container(
90+
width: 350,
91+
height: 100,
92+
color: Color(0xFF3F3F3F),
93+
),
94+
),
95+
],
4596
),
46-
],
47-
)),
48-
Image.network(
49-
planet.biomeImage,
50-
width: 400,
51-
height: 200,
52-
fit: BoxFit.cover,
53-
errorBuilder: (context, error, stackTrace) => Container(
54-
width: 400,
55-
height: 200,
56-
color: Color(0xFF3F3F3F),
5797
),
58-
),
59-
],
60-
)
61-
],
62-
));
98+
if (planet.objectiveProgression != null && planet.ennemy != null) SizedBox(height: 2),
99+
if (planet.objectiveProgression != null && planet.ennemy != null)
100+
Container(
101+
width:350,
102+
decoration: BoxDecoration(
103+
color: Color.fromRGBO(0, 0, 0, 0.8),
104+
border: Border.all(
105+
color: planet.owner.color,
106+
width: 2,
107+
),
108+
),
109+
padding: EdgeInsets.all(4),
110+
child: Row(
111+
children: [
112+
SizedBox(width: 2),
113+
Text(
114+
(planet.objectiveProgression! * 100).toStringAsFixed(2) + "%",
115+
style: TextStyle(
116+
color: Colors.white,
117+
fontSize: 20,
118+
),
119+
),
120+
SizedBox(width: 10),
121+
Flexible(
122+
child: Container(
123+
color: HelldiversFactions.humans.color,
124+
height: 20,
125+
),
126+
flex: (planet.objectiveProgression! * 100).floor(),
127+
),
128+
SizedBox(width:2),
129+
Flexible(
130+
child: Container(
131+
color: planet.ennemy!.color,
132+
height: 20,
133+
),
134+
flex: ((1 - planet.objectiveProgression!) * 100).floor(),
135+
),
136+
],
137+
),
138+
)],
139+
)),
140+
],
141+
),
142+
);
63143
}
64144
}

games_richpresence/lib/gen/assets.gen.dart

Lines changed: 87 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

games_richpresence/lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:games_richpresence/pages/helldivers/activity_select/planet_select_page.dart';
23
import 'package:games_richpresence/pages/home/home.dart';
34
import 'package:easy_localization/easy_localization.dart';
45
import 'package:games_richpresence/pages/sea_of_thieves/activities/choose_activity.dart';
@@ -37,6 +38,7 @@ class _MyAppState extends State<MyApp> {
3738
TheFinalsGroupPage.route: (context) => TheFinalsGroupPage(),
3839
TheFinalsGamemodesCategoriesPage.route: (context) => TheFinalsGamemodesCategoriesPage(),
3940
TheFinalsGamemodesPageRoute.route: (context) => TheFinalsGamemodesPageRoute(),
41+
HelldiversPlanetSelectPage.route: (context) => HelldiversPlanetSelectPage(),
4042
},
4143
);
4244
}

0 commit comments

Comments
 (0)