Skip to content

Commit a585cc0

Browse files
feat: landing v9 layout (#1684)
* refactor: simplify button background color logic and update super block layout handling * Update mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart Co-authored-by: Huyen Nguyen <[email protected]> --------- Co-authored-by: Huyen Nguyen <[email protected]>
1 parent 5a62f93 commit a585cc0

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

mobile-app/lib/ui/views/learn/landing/landing_view.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ class SuperBlockButton extends StatelessWidget {
252252
child: ElevatedButton(
253253
style: ElevatedButton.styleFrom(
254254
padding: const EdgeInsets.all(5),
255-
backgroundColor: button.public
256-
? FccColors.gray80
257-
: const Color.fromARGB(255, 41, 41, 54),
255+
backgroundColor: button.public ? FccColors.gray80 : FccColors.gray75,
258256
side: button.public
259257
? const BorderSide(
260258
width: 2,

mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ class LearnLandingViewModel extends BaseViewModel {
212212
Future<List<Widget>> requestSuperBlocks() async {
213213
String baseUrl = LearnService.baseUrl;
214214

215-
final Response res = await _dio.get('$baseUrl/available-superblocks.json');
215+
TextStyle headerStyle = TextStyle(fontSize: 21);
216216

217-
List<Widget> layout = [];
217+
final Response res = await _dio.get('$baseUrl/available-superblocks.json');
218218
if (res.statusCode == 200) {
219219
await dotenv.load(fileName: '.env');
220220

@@ -223,27 +223,32 @@ class LearnLandingViewModel extends BaseViewModel {
223223

224224
Map<String, dynamic> superBlockStages = res.data['superblocks'];
225225

226-
List<String> stageOrder = [
227-
'legacy',
228-
'professional',
229-
'extra',
230-
'core',
231-
'english'
232-
];
226+
Map<String, String> stageOrder = {
227+
'core': 'Recommended curriculum (still in beta):',
228+
'english': 'Learn English for Developers:',
229+
'legacy': 'Our archived coursework:',
230+
'extra': 'Prepare for the developer interview job search:',
231+
'professional': 'Professional certifications:',
232+
};
233233

234-
List<Widget> publicButtons = [];
235-
List<Widget> nonPublicButtons = [];
234+
List<Widget> widgetOrder = [];
236235

237-
for (var stage in stageOrder) {
236+
for (var stage in stageOrder.keys) {
238237
if (superBlockStages.containsKey(stage)) {
239238
List stageBlocks = superBlockStages[stage];
240239

240+
widgetOrder.add(
241+
Text(
242+
stageOrder[stage] ?? '',
243+
style: headerStyle,
244+
),
245+
);
246+
241247
for (var superBlock in stageBlocks) {
242248
if (superBlock['dashedName'].toString().contains('full-stack')) {
243249
continue;
244250
}
245251

246-
bool isPublic = superBlock['public'] ?? false;
247252
Widget button = SuperBlockButton(
248253
button: SuperBlockButtonData(
249254
path: superBlock['dashedName'],
@@ -253,18 +258,12 @@ class LearnLandingViewModel extends BaseViewModel {
253258
model: this,
254259
);
255260

256-
if (isPublic) {
257-
publicButtons.add(button);
258-
} else {
259-
nonPublicButtons.add(button);
260-
}
261+
widgetOrder.add(button);
261262
}
262263
}
263264
}
264265

265-
layout = [...publicButtons, ...nonPublicButtons];
266-
267-
return layout;
266+
return widgetOrder;
268267
}
269268
return [];
270269
}

0 commit comments

Comments
 (0)