Compare commits

...

17 Commits

Author SHA1 Message Date
unknown
6ffe4b6c33 gitignore 2021-09-04 20:29:46 +02:00
unknown
7bd5d8bd5a version bump 2021-09-04 20:24:03 +02:00
unknown
c0ffa5d726 commit 2021-09-04 20:05:48 +02:00
unknown
befb107183 mobile 2021-09-04 12:11:15 +02:00
unknown
e56488094e mobile 2021-09-02 20:15:02 +02:00
unknown
74831c3e56 beta 5 2021-09-02 20:03:00 +02:00
unknown
9d3347d680 mobile 2021-09-02 20:01:13 +02:00
unknown
25100ab7d9 add test school 2021-09-02 18:08:31 +02:00
unknown
b509adcbc9 kreten 2021-09-02 17:00:03 +02:00
unknown
d421ae9031 capitalize fix 2021-09-02 16:59:57 +02:00
unknown
c3b79fcb3f today, yesterday fix 2021-09-02 01:34:32 +02:00
unknown
3cf57ac6d4 version bump 2021-09-02 01:28:06 +02:00
unknown
d72bf84a36 supporters 2021-09-02 01:27:59 +02:00
unknown
638b8c9413 limit text scaling 2021-09-02 01:27:29 +02:00
unknown
d5bdca698b commit 2021-09-02 00:18:58 +02:00
unknown
ea6b2ec73d commit 2021-09-02 00:18:41 +02:00
unknown
7ffb58c9ac art icon appears for geography 2021-09-01 14:11:30 +02:00
9 changed files with 75 additions and 9 deletions

View File

@@ -9,3 +9,4 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore. # Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties key.properties
.project

View File

@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:filcnaplo/models/config.dart'; import 'package:filcnaplo/models/config.dart';
import 'package:filcnaplo/models/news.dart'; import 'package:filcnaplo/models/news.dart';
import 'package:filcnaplo/models/release.dart'; import 'package:filcnaplo/models/release.dart';
import 'package:filcnaplo/models/supporter.dart';
import 'package:filcnaplo_kreta_api/models/school.dart'; import 'package:filcnaplo_kreta_api/models/school.dart';
import 'package:http/http.dart' as http; 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 SCHOOL_LIST = "https://filcnaplo.hu/v2/school_list.json";
static const CONFIG = "https://filcnaplo.hu/v2/config.json"; static const CONFIG = "https://filcnaplo.hu/v2/config.json";
static const NEWS = "https://filcnaplo.hu/v2/news.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 REPO = "filc/naplo";
static const RELEASES = "https://api.github.com/repos/$REPO/releases"; static const RELEASES = "https://api.github.com/repos/$REPO/releases";
@@ -18,7 +20,13 @@ class FilcAPI {
http.Response res = await http.get(Uri.parse(SCHOOL_LIST)); http.Response res = await http.get(Uri.parse(SCHOOL_LIST));
if (res.statusCode == 200) { if (res.statusCode == 200) {
return (jsonDecode(res.body) as List).cast<Map>().map((json) => School.fromJson(json)).toList(); List<School> schools = (jsonDecode(res.body) as List).cast<Map>().map((json) => School.fromJson(json)).toList();
schools.add(School(
city: "Tiszabura",
instituteCode: "supporttest-reni-tiszabura-teszt01",
name: "FILC Éles Reni tiszabura-teszt",
));
return schools;
} else { } else {
throw "HTTP ${res.statusCode}: ${res.body}"; throw "HTTP ${res.statusCode}: ${res.body}";
} }
@@ -55,6 +63,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 { static Future<List<Release>?> getReleases() async {
try { try {
http.Response res = await http.get(Uri.parse(RELEASES)); http.Response res = await http.get(Uri.parse(RELEASES));

View File

@@ -1,3 +1,5 @@
import 'dart:math';
import 'package:filcnaplo/api/client.dart'; import 'package:filcnaplo/api/client.dart';
import 'package:filcnaplo/api/providers/news_provider.dart'; import 'package:filcnaplo/api/providers/news_provider.dart';
import 'package:filcnaplo/api/providers/database_provider.dart'; import 'package:filcnaplo/api/providers/database_provider.dart';
@@ -77,8 +79,11 @@ class App extends StatelessWidget {
builder: (context, themeMode, child) { builder: (context, themeMode, child) {
return MaterialApp( return MaterialApp(
builder: (context, child) { builder: (context, child) {
// Limit font size scaling to 1.0
double textScaleFactor = min(MediaQuery.of(context).textScaleFactor, 1.0);
return MediaQuery( return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), data: MediaQuery.of(context).copyWith(textScaleFactor: textScaleFactor),
child: child ?? Container(), child: child ?? Container(),
); );
}, },

View File

@@ -14,9 +14,9 @@ class SubjectIcon {
if (RegExp("mate(k|matika)").hasMatch(name) || category == "matematika") return Icons.calculate_outlined; 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("magyar nyelv|nyelvtan").hasMatch(name)) return Icons.spellcheck_outlined;
if (RegExp("irodalom").hasMatch(name)) return Icons.menu_book_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("tor(i|tenelem)").hasMatch(name)) return Icons.hourglass_empty_outlined;
if (RegExp("foldrajz").hasMatch(name)) return Icons.public_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("fizika").hasMatch(name)) return Icons.emoji_objects_outlined;
if (RegExp("^enek|zene|szolfezs|zongora|korus").hasMatch(name)) return Icons.music_note_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; if (RegExp("^tes(i|tneveles)|sport").hasMatch(name)) return Icons.sports_soccer_outlined;

View 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(),
);
}
}

View File

@@ -18,7 +18,7 @@ extension StringFormatUtils on String {
String capital() => this.length > 0 ? this[0].toUpperCase() + this.substring(1) : ""; String capital() => this.length > 0 ? this[0].toUpperCase() + this.substring(1) : "";
String capitalize() => this.split(" ").map((w) => this.capital()).join(" "); String capitalize() => this.split(" ").map((w) => w.capital()).join(" ");
String escapeHtml() { String escapeHtml() {
String htmlString = this; String htmlString = this;
@@ -37,11 +37,11 @@ extension DateFormatUtils on DateTime {
if (timeOnly) return DateFormat("HH:mm").format(this); if (timeOnly) return DateFormat("HH:mm").format(this);
DateTime now = DateTime.now(); 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; if (this.hour == 0 && this.minute == 0 && this.second == 0) return "Today".i18n;
return DateFormat("HH:mm").format(this); 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; String formatString;
if (this.year == now.year) if (this.year == now.year)

View File

@@ -3,7 +3,7 @@ description: "Nem hivatalos e-napló alkalmazás az e-Kréta rendszerhez"
homepage: https://filcnaplo.hu homepage: https://filcnaplo.hu
publish_to: "none" publish_to: "none"
version: 3.0.0-beta.3+125 version: 3.0.0+128
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"