mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
feat: wip contributors screen.
This commit is contained in:
56
lib/ui/views/contributors/contributors_view.dart
Normal file
56
lib/ui/views/contributors/contributors_view.dart
Normal file
@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:revanced_manager/ui/views/contributors/contributors_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/contributors_card.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class ContributorsView extends StatelessWidget {
|
||||
const ContributorsView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<ContributorsViewModel>.reactive(
|
||||
disposeViewModel: false,
|
||||
viewModelBuilder: () => ContributorsViewModel(),
|
||||
onModelReady: (model) => model.getContributors(),
|
||||
builder: (context, model, child) => Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => model.getContributors(),
|
||||
child: const Icon(Icons.refresh),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ContributorsCard(
|
||||
title: "Patcher Contributors",
|
||||
contributors: model.patcherContributors,
|
||||
height: 60,
|
||||
),
|
||||
ContributorsCard(
|
||||
title: "Patches Contributors",
|
||||
contributors: model.patchesContributors,
|
||||
height: 230,
|
||||
),
|
||||
ContributorsCard(
|
||||
title: "Integrations Contributors",
|
||||
contributors: model.integrationsContributors,
|
||||
height: 230,
|
||||
),
|
||||
ContributorsCard(
|
||||
title: "CLI Contributors",
|
||||
contributors: model.cliContributors,
|
||||
height: 180,
|
||||
),
|
||||
ContributorsCard(
|
||||
title: "Manager Contributors",
|
||||
contributors: model.managerContributors,
|
||||
height: 130,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
27
lib/ui/views/contributors/contributors_viewmodel.dart
Normal file
27
lib/ui/views/contributors/contributors_viewmodel.dart
Normal file
@ -0,0 +1,27 @@
|
||||
import 'package:github/github.dart';
|
||||
import 'package:revanced_manager/services/github_api.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class ContributorsViewModel extends BaseViewModel {
|
||||
final GithubAPI githubAPI = GithubAPI();
|
||||
List<Contributor> patchesContributors = [];
|
||||
List<Contributor> integrationsContributors = [];
|
||||
List<Contributor> patcherContributors = [];
|
||||
List<Contributor> cliContributors = [];
|
||||
List<Contributor> managerContributors = [];
|
||||
|
||||
Future<List<Contributor>> getContributors() async {
|
||||
patchesContributors =
|
||||
await githubAPI.getContributors('revanced', 'revanced-patches');
|
||||
integrationsContributors =
|
||||
await githubAPI.getContributors('revanced', 'revanced-integrations');
|
||||
patcherContributors =
|
||||
await githubAPI.getContributors('revanced', 'revanced-patcher');
|
||||
cliContributors =
|
||||
await githubAPI.getContributors('revanced', 'revanced-cli');
|
||||
managerContributors =
|
||||
await githubAPI.getContributors('revanced', 'revanced-manager');
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
@ -77,6 +77,7 @@ class SettingsView extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
title: I18nText('settingsView.contributorsLabel'),
|
||||
onTap: model.navigateToContributors,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,7 +1,16 @@
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/app/app.router.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
class SettingsViewModel extends BaseViewModel {
|
||||
final _navigationService = locator<NavigationService>();
|
||||
|
||||
void setLanguage(String language) {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void navigateToContributors() {
|
||||
_navigationService.navigateTo(Routes.contributorsView);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user