Added category filter

This commit is contained in:
Imran Remtulla
2022-12-21 04:15:39 -05:00
parent 26f953dbb0
commit 118460ccb9
3 changed files with 46 additions and 36 deletions

View File

@@ -6,6 +6,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:obtainium/app_sources/github.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -153,4 +154,13 @@ class SettingsProvider with ChangeNotifier {
set categories(Map<String, int> cats) {
prefs?.setString('categories', jsonEncode(cats));
}
getCategoryFormItem({String initCategory = ''}) =>
GeneratedFormItem('category', // TODO
label: 'Category',
opts: [
const MapEntry('', 'No Category'),
...categories.entries.map((e) => MapEntry(e.key, e.key)).toList()
],
defaultValue: initCategory);
}