Skip to content

Commit 5607c98

Browse files
committed
feat(circuit): desktop layout; fix saudi arabia's details (wrong markdown from api...)
1 parent 93234e9 commit 5607c98

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

lib/Screens/Racing/circuit.dart

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ class CircuitScreenContent extends StatelessWidget {
8585
shaderCallback: (rect) {
8686
return LinearGradient(
8787
begin: Alignment.topCenter,
88-
end: Alignment.bottomCenter,
88+
end: MediaQuery.of(context).size.width > 780
89+
? Alignment(
90+
Alignment.bottomCenter.x,
91+
Alignment.bottomCenter.y * 0.97,
92+
)
93+
: Alignment.bottomCenter,
8994
colors: [Colors.black, Colors.transparent],
9095
).createShader(
9196
Rect.fromLTRB(0, 0, rect.width, rect.height),
@@ -101,13 +106,17 @@ class CircuitScreenContent extends StatelessWidget {
101106
imageUrl: details['raceImage']['url'],
102107
placeholder: (context, url) => const LoadingIndicatorUtil(),
103108
colorBlendMode: BlendMode.darken,
104-
height: MediaQuery.of(context).size.height * (4 / 9),
109+
height: MediaQuery.of(context).size.width > 780
110+
? MediaQuery.of(context).size.height
111+
: MediaQuery.of(context).size.height * (4 / 9),
105112
),
106113
),
107114
Padding(
108115
padding: EdgeInsets.only(
109-
top: MediaQuery.of(context).size.height * (4 / 9) - 110),
116+
top: MediaQuery.of(context).size.height * (4 / 9) - 110,
117+
),
110118
child: Column(
119+
mainAxisSize: MainAxisSize.max,
111120
mainAxisAlignment: MainAxisAlignment.end,
112121
children: [
113122
Row(
@@ -123,17 +132,30 @@ class CircuitScreenContent extends StatelessWidget {
123132
placeholder: (context, url) => SizedBox(width: 53),
124133
fit: BoxFit.cover,
125134
imageUrl: details['raceCountryFlag']['url'],
126-
height: 30,
127-
width: 53,
135+
height: MediaQuery.of(context).size.width > 780
136+
? 60
137+
: 30,
138+
width: MediaQuery.of(context).size.width > 780
139+
? 106
140+
: 53,
128141
),
129142
),
130143
Padding(
131-
padding: EdgeInsets.only(left: 15, bottom: 3),
144+
padding: EdgeInsets.only(
145+
left: MediaQuery.of(context).size.width > 780
146+
? 20
147+
: 15,
148+
bottom: MediaQuery.of(context).size.width > 780
149+
? 10
150+
: 3,
151+
),
132152
child: Text(
133153
details['race']['meetingCountryName'],
134154
style: TextStyle(
135155
fontFamily: 'Northwell',
136-
fontSize: 70,
156+
fontSize: MediaQuery.of(context).size.width > 780
157+
? 120
158+
: 70,
137159
),
138160
),
139161
),

lib/Screens/Racing/circuit_details.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ class CircuitDetailsScreen extends StatelessWidget {
4040
super.key,
4141
});
4242

43+
String fixMarkdownError(String text) {
44+
int i = text.indexOf("##");
45+
String tmp = text.substring(i + 1);
46+
tmp = tmp.replaceAll("## ", "### ");
47+
return "${text.substring(0, i + 1)}$tmp";
48+
}
49+
4350
@override
4451
Widget build(BuildContext context) {
4552
return Scaffold(
@@ -88,7 +95,7 @@ class CircuitDetailsScreen extends StatelessWidget {
8895
right: 10,
8996
),
9097
child: MarkdownBody(
91-
data: trackDetailsText,
98+
data: fixMarkdownError(trackDetailsText),
9299
selectable: true,
93100
fitContent: false,
94101
styleSheet: MarkdownStyleSheet(

0 commit comments

Comments
 (0)