Skip to content

Commit

Permalink
feat(frontend): Open tags from tags page
Browse files Browse the repository at this point in the history
  • Loading branch information
Grohden committed Aug 5, 2020
1 parent 4b7cfc6 commit b1de0ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion frontend/lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class Router {
Get.offAndToNamed('/repository/$id');
}

static void offAndToRepositories(int id) {
static void offAndToTag(int id) {
Get.offAndToNamed('/tag/$id');
}

static void goToTag(int id) {
Get.toNamed('/tag/$id');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RepositoryDetailsController extends GetxController {
}

void openTag(UserTag tag) {
Router.offAndToRepositories(tag.tagId);
Router.offAndToTag(tag.tagId);
}

/// Adds new tag into the current repository
Expand Down
4 changes: 4 additions & 0 deletions frontend/lib/ui/pages/tags/tags_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ class TagsController extends GetxController {
showLoading.value = false;
}
}

void openTag(UserTag tag) {
Router.goToTag(tag.tagId);
}
}
6 changes: 5 additions & 1 deletion frontend/lib/ui/pages/tags/tags_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../api/tagger/repository_tagger_client.dart';
import '../../../router.dart';
import '../../molecules/load_page_error.dart';
import '../../molecules/page_title.dart';

Expand Down Expand Up @@ -47,7 +48,10 @@ class TagsPage extends GetView<TagsController> {
runSpacing: 8,
children: tags
.map(
(tag) => Chip(label: Text(tag.tagName)),
(tag) => ActionChip(
label: Text(tag.tagName),
onPressed: () => controller.openTag(tag),
),
)
.toList(),
)
Expand Down

0 comments on commit b1de0ce

Please sign in to comment.