Compare commits
7 Commits
3.0.0-beta
...
3.0.0-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3b79fcb3f | ||
|
|
3cf57ac6d4 | ||
|
|
d72bf84a36 | ||
|
|
638b8c9413 | ||
|
|
d5bdca698b | ||
|
|
ea6b2ec73d | ||
|
|
7ffb58c9ac |
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:filcnaplo/models/config.dart';
|
||||
import 'package:filcnaplo/models/news.dart';
|
||||
import 'package:filcnaplo/models/release.dart';
|
||||
import 'package:filcnaplo/models/supporter.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/school.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -10,6 +11,7 @@ class FilcAPI {
|
||||
static const SCHOOL_LIST = "https://filcnaplo.hu/v2/school_list.json";
|
||||
static const CONFIG = "https://filcnaplo.hu/v2/config.json";
|
||||
static const NEWS = "https://filcnaplo.hu/v2/news.json";
|
||||
static const SUPPORTERS = "https://filcnaplo.hu/v2/supporters.json";
|
||||
static const REPO = "filc/naplo";
|
||||
static const RELEASES = "https://api.github.com/repos/$REPO/releases";
|
||||
|
||||
@@ -55,6 +57,20 @@ class FilcAPI {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Supporters?> getSupporters() async {
|
||||
try {
|
||||
http.Response res = await http.get(Uri.parse(SUPPORTERS));
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
return Supporters.fromJson(jsonDecode(res.body));
|
||||
} else {
|
||||
throw "HTTP ${res.statusCode}: ${res.body}";
|
||||
}
|
||||
} catch (error) {
|
||||
print("ERROR: FilcAPI.getSupporters: $error");
|
||||
}
|
||||
}
|
||||
|
||||
static Future<List<Release>?> getReleases() async {
|
||||
try {
|
||||
http.Response res = await http.get(Uri.parse(RELEASES));
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:filcnaplo/api/client.dart';
|
||||
import 'package:filcnaplo/api/providers/news_provider.dart';
|
||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||
@@ -77,8 +79,11 @@ class App extends StatelessWidget {
|
||||
builder: (context, themeMode, child) {
|
||||
return MaterialApp(
|
||||
builder: (context, child) {
|
||||
// Limit font size scaling to 1.0
|
||||
double textScaleFactor = min(MediaQuery.of(context).textScaleFactor, 1.0);
|
||||
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
|
||||
data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
|
||||
child: child ?? Container(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -14,9 +14,9 @@ class SubjectIcon {
|
||||
if (RegExp("mate(k|matika)").hasMatch(name) || category == "matematika") return Icons.calculate_outlined;
|
||||
if (RegExp("magyar nyelv|nyelvtan").hasMatch(name)) return Icons.spellcheck_outlined;
|
||||
if (RegExp("irodalom").hasMatch(name)) return Icons.menu_book_outlined;
|
||||
if (RegExp("rajz|muvtori|muveszet|kultura").hasMatch(name)) return Icons.palette_outlined;
|
||||
if (RegExp("tor(i|tenelem)").hasMatch(name)) return Icons.hourglass_empty_outlined;
|
||||
if (RegExp("foldrajz").hasMatch(name)) return Icons.public_outlined;
|
||||
if (RegExp("rajz|muvtori|muveszet|kultura").hasMatch(name)) return Icons.palette_outlined;
|
||||
if (RegExp("fizika").hasMatch(name)) return Icons.emoji_objects_outlined;
|
||||
if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) return Icons.music_note_outlined;
|
||||
if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) return Icons.sports_soccer_outlined;
|
||||
|
||||
38
filcnaplo/lib/models/supporter.dart
Normal file
38
filcnaplo/lib/models/supporter.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
class Supporter {
|
||||
String name;
|
||||
String amount;
|
||||
String platform;
|
||||
|
||||
Supporter(this.name, this.amount, this.platform);
|
||||
|
||||
factory Supporter.fromJson(Map json) {
|
||||
return Supporter(
|
||||
json["name"] ?? "",
|
||||
json["amount"] ?? "",
|
||||
json["platform"] ?? "",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Supporters {
|
||||
List<Supporter> top;
|
||||
List<Supporter> all;
|
||||
int progress;
|
||||
int max;
|
||||
|
||||
Supporters({
|
||||
required this.top,
|
||||
required this.all,
|
||||
required this.progress,
|
||||
required this.max,
|
||||
});
|
||||
|
||||
factory Supporters.fromJson(Map json) {
|
||||
return Supporters(
|
||||
max: (json["progress"] ?? {})["max"] ?? 1,
|
||||
progress: (json["progress"] ?? {})["value"] ?? 0,
|
||||
all: ((json["all"] ?? []) as List).cast<Map>().map((e) => Supporter.fromJson(e)).toList(),
|
||||
top: ((json["top"] ?? []) as List).cast<Map>().map((e) => Supporter.fromJson(e)).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,11 @@ extension DateFormatUtils on DateTime {
|
||||
if (timeOnly) return DateFormat("HH:mm").format(this);
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
if (this.difference(now).inDays == 0) {
|
||||
if (now.year == this.year && now.month == this.month && now.day == this.day) {
|
||||
if (this.hour == 0 && this.minute == 0 && this.second == 0) return "Today".i18n;
|
||||
return DateFormat("HH:mm").format(this);
|
||||
}
|
||||
if (this.difference(now).inDays == 1) return "Yesterday".i18n;
|
||||
if (now.year == this.year && now.month == this.month && now.subtract(Duration(days: 1)).day == this.day) return "Yesterday".i18n;
|
||||
|
||||
String formatString;
|
||||
if (this.year == now.year)
|
||||
|
||||
@@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
|
||||
homepage: https://filcnaplo.hu
|
||||
publish_to: "none"
|
||||
|
||||
version: 3.0.0-beta.3+125
|
||||
version: 3.0.0-beta.4+126
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
Submodule filcnaplo_kreta_api updated: 9d09624313...f1e5a2bb29
Submodule filcnaplo_mobile_ui updated: 51578dd62a...5048994691
Reference in New Issue
Block a user