diff --git a/.gitignore b/.gitignore index b4db4b1..d0db3ea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,10 +12,10 @@ refilc/build/ refilc/android/key.properties refilc/android/debug.keystore -refilc_desktop_ui/.flutter-plugins -refilc_desktop_ui/.flutter-plugins-dependencies -refilc_desktop_ui/pubspec.lock -refilc_desktop_ui/.dart_tool/ +# refilc_desktop_ui/.flutter-plugins +# refilc_desktop_ui/.flutter-plugins-dependencies +# refilc_desktop_ui/pubspec.lock +# refilc_desktop_ui/.dart_tool/ refilc_kreta_api/.flutter-plugins refilc_kreta_api/.flutter-plugins-dependencies @@ -37,6 +37,7 @@ refilc_mobile_ui/.dart_tool/ .idea .gitmodules .gradle +.kotlin refilc/.DS_Store .DS_Store diff --git a/check-outdated.sh b/check-outdated.sh new file mode 100644 index 0000000..7282f6a --- /dev/null +++ b/check-outdated.sh @@ -0,0 +1,7 @@ +cd refilc && flutter pub outdated && cd .. +cd refilc_kreta_api && flutter pub outdated && cd .. +cd refilc_mobile_ui && flutter pub outdated && cd .. +# cd refilc_desktop_ui && flutter pub upgrade && cd .. +cd refilc_plus && flutter pub outdated && cd .. + +echo Outdated version list above. diff --git a/major-upgrade-pub.sh b/major-upgrade-pub.sh new file mode 100755 index 0000000..9f5ca35 --- /dev/null +++ b/major-upgrade-pub.sh @@ -0,0 +1,7 @@ +cd refilc && flutter pub upgrade --major-versions && cd .. +cd refilc_kreta_api && flutter pub upgrade --major-versions && cd .. +cd refilc_mobile_ui && flutter pub upgrade --major-versions && cd .. +# cd refilc_desktop_ui && flutter pub upgrade && cd .. +cd refilc_plus && flutter pub upgrade --major-versions && cd .. + +echo "Upgraded pub (major)." diff --git a/refilc/android/app/build.gradle b/refilc/android/app/build.gradle index 4437dee..ed504f6 100644 --- a/refilc/android/app/build.gradle +++ b/refilc/android/app/build.gradle @@ -39,8 +39,23 @@ def debugKeystoreProperties = new Properties() def debugKeystorePropertiesFile = rootProject.file("debugkey.properties") debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile)) +subprojects { + afterEvaluate { project -> + if (project.hasProperty('android')) { + project.android { + if (!hasProperty('namespace') || namespace == null || namespace.isEmpty()) { + // Assign a default namespace based on the project name or group + namespace = project.group.toString() ?: "com.example.${project.name}" + } + } + } + } +} + android { - ndkVersion "25.1.8937393" + namespace = "hu.refilc.naplo" + + ndkVersion "27.2.12479018" // compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion 34 @@ -67,11 +82,19 @@ android { } compileOptions { - // Flag to enable support for the new language APIs - coreLibraryDesugaringEnabled true - // Sets Java compatibility to Java 8 - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true + // Sets Java compatibility to Java 8 + // sourceCompatibility JavaVersion.VERSION_1_8 + // targetCompatibility JavaVersion.VERSION_1_8 + // sourceCompatibility JavaVersion.VERSION_21 + // targetCompatibility JavaVersion.VERSION_21 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 } signingConfigs { @@ -117,7 +140,7 @@ dependencies { implementation 'joda-time:joda-time:2.9.4' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3' implementation 'androidx.window:window:1.0.0' implementation 'androidx.window:window-java:1.0.0' } diff --git a/refilc/android/app/proguard-rules.pro b/refilc/android/app/proguard-rules.pro index 2f9ff85..31bcfd1 100644 --- a/refilc/android/app/proguard-rules.pro +++ b/refilc/android/app/proguard-rules.pro @@ -8,4 +8,7 @@ -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error -dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter --dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider \ No newline at end of file +-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider + +-dontwarn org.joda.convert.FromString +-dontwarn org.joda.convert.ToString \ No newline at end of file diff --git a/refilc/android/app/src/main/AndroidManifest.xml b/refilc/android/app/src/main/AndroidManifest.xml index f22abc0..0b2193c 100644 --- a/refilc/android/app/src/main/AndroidManifest.xml +++ b/refilc/android/app/src/main/AndroidManifest.xml @@ -2,9 +2,6 @@ xmlns:tools="http://schemas.android.com/tools" package="hu.refilc.naplo"> - some View { + var r, g, b, a: CGFloat + (r, g, b, a) = (0, 0, 0, 0) + UIColor(backgroundColor).getRed(&r, green: &g, blue: &b, alpha: &a) + let luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b + return luminance < 0.6 ? self.foregroundColor(.white) : self.foregroundColor(.black) + } +} + // Color Converter extension Color { init(hex: String, alpha: Double = 1.0) { @@ -62,7 +73,6 @@ struct LockScreenLiveActivityView: View { .font(.body) .bold() .padding(.trailing, 90) - } else { MultilineTextView(text: "\(context.state.index) \(context.state.title) - \(context.state.subtitle)", limit: 25) .font(.body) @@ -84,6 +94,7 @@ struct LockScreenLiveActivityView: View { .resizable() .aspectRatio(contentMode: .fit) .frame(width: CGFloat(8), height: CGFloat(8)) + .foregroundStyle(.secondary) Text("\(context.state.nextSubject) - \(context.state.nextRoom)") .font(.caption) } @@ -107,11 +118,15 @@ struct LockScreenLiveActivityView: View { .monospacedDigit() .padding(.trailing) } +// .activityBackgroundTint( +// context.state.color != "#676767" +// ? Color(hex: context.state.color) +// : Color.clear +// ) .activityBackgroundTint( - context.state.color != "#676767" - ? Color(hex: context.state.color) - : Color.clear + Color.clear ) + .foregroundStyle(Color(hex: context.state.color)) } } diff --git a/refilc/lib/api/client.dart b/refilc/lib/api/client.dart index 73f079f..c777dd4 100644 --- a/refilc/lib/api/client.dart +++ b/refilc/lib/api/client.dart @@ -22,18 +22,18 @@ class FilcAPI { // Public API static const schoolList = "$baseUrl/v3/public/school-list"; - static const news = "$baseUrl/v4/public/news"; + static const news = "0.0.0.0/v4/public/news"; static const supporters = "$baseUrl/v3/public/supporters"; // Private API - static const ads = "$baseUrl/v3/private/ads"; + static const ads = "0.0.0.0/v3/private/ads"; static const config = "$baseUrl/v3/private/config"; static const reportApi = "$baseUrl/v3/private/crash-report"; - static const rfPlus = "$baseUrl/v3/rf-plus"; - static const plusAuthLogin = "$rfPlus/auth/login"; - static const plusAuthCallback = "$rfPlus/auth/callback"; - static const plusActivation = "$rfPlus/activate"; - static const plusScopes = "$rfPlus/scopes"; + static const rfPlus = "0.0.0.0/v3/rf-plus"; + static const plusAuthLogin = "0.0.0.0/auth/login"; + static const plusAuthCallback = "0.0.0.0/auth/callback"; + static const plusActivation = "0.0.0.0/activate"; + static const plusScopes = "0.0.0.0/scopes"; // Updates static const repo = "refilc/naplo"; @@ -51,11 +51,12 @@ class FilcAPI { static const gradeColorsByID = "$gradeColorsGet/"; // Payment API - static const payment = "$baseUrl/v4/payment"; - static const stripeSheet = "$payment/stripe-sheet"; + static const payment = "0.0.0.0/v4/payment"; + static const stripeSheet = "0.0.0.0/stripe-sheet"; // Cloud Sync - static const cloudSyncApi = "$baseUrl/v4/me/cloud-sync"; + // cloud sync? for what reason + static const cloudSyncApi = "0.0.0.0/v4/me/cloud-sync"; static Future checkConnectivity() async => (await Connectivity().checkConnectivity())[0] != ConnectivityResult.none; diff --git a/refilc/lib/api/providers/database_provider.dart b/refilc/lib/api/providers/database_provider.dart index e242c45..e0c9d8c 100644 --- a/refilc/lib/api/providers/database_provider.dart +++ b/refilc/lib/api/providers/database_provider.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:refilc/database/query.dart'; import 'package:refilc/database/store.dart'; // ignore: depend_on_referenced_packages @@ -15,11 +13,7 @@ class DatabaseProvider { Future init() async { Database db; - if (Platform.isLinux || Platform.isWindows) { - db = await databaseFactoryFfi.openDatabase("app.db"); - } else { - db = await openDatabase("app.db"); - } + db = await openDatabase("app.db"); query = DatabaseQuery(db: db); store = DatabaseStore(db: db); diff --git a/refilc/lib/api/providers/live_card_provider.dart b/refilc/lib/api/providers/live_card_provider.dart index d1d2922..8b50a74 100644 --- a/refilc/lib/api/providers/live_card_provider.dart +++ b/refilc/lib/api/providers/live_card_provider.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'package:refilc/api/providers/liveactivity/platform_channel.dart'; import 'package:refilc/helpers/subject.dart'; import 'package:refilc/models/settings.dart'; +import 'package:refilc/ui/flutter_colorpicker/utils.dart'; import 'package:refilc_kreta_api/models/lesson.dart'; import 'package:refilc_kreta_api/models/week.dart'; import 'package:refilc/utils/format.dart'; @@ -84,11 +85,14 @@ class LiveCardProvider extends ChangeNotifier { } Map toMap() { + // print("LIVE ACTIVITY COLOR BELOW:"); + // print(_settings.liveActivityColor.toHexString().substring(2)); + String color = '#${_settings.liveActivityColor.toHexString().substring(2)}'; + switch (currentState) { case LiveCardState.morning: return { - "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + "color": color, "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", @@ -97,23 +101,22 @@ class LiveCardProvider extends ChangeNotifier { "description": "", "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - - (_delay.inMilliseconds)) - .toString() + (_delay.inMilliseconds)) + .toString() : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null ? nextLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: nextLesson?.subject).capital() + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; case LiveCardState.afternoon: return { - "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + "color": color, "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", @@ -122,23 +125,22 @@ class LiveCardProvider extends ChangeNotifier { "description": "", "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - - (_delay.inMilliseconds)) - .toString() + (_delay.inMilliseconds)) + .toString() : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null ? nextLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: nextLesson?.subject).capital() + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; case LiveCardState.night: return { - "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + "color": color, "icon": nextLesson != null ? SubjectIcon.resolveName(subject: nextLesson?.subject) : "book", @@ -147,44 +149,44 @@ class LiveCardProvider extends ChangeNotifier { "description": "", "startDate": storeFirstRunDate != null ? ((storeFirstRunDate?.millisecondsSinceEpoch ?? 0) - - (_delay.inMilliseconds)) - .toString() + (_delay.inMilliseconds)) + .toString() : "", "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null ? nextLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: nextLesson?.subject).capital() + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; case LiveCardState.duringLesson: return { - "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + "color": color, "icon": currentLesson != null ? SubjectIcon.resolveName(subject: currentLesson?.subject) : "book", "index": - currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "", + currentLesson != null ? '${currentLesson!.lessonIndex}. ' : "", "title": currentLesson != null ? currentLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: currentLesson?.subject) - .capital() + ShortSubject.resolve(subject: currentLesson?.subject) + .capital() : "", - "subtitle": "Terem: ${currentLesson?.room.replaceAll("_", " ") ?? ""}", + "subtitle": + "Terem: ${currentLesson?.room.replaceAll("_", " ") ?? ""}", "description": currentLesson?.description ?? "", "startDate": ((currentLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "endDate": ((currentLesson?.end.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": nextLesson != null ? nextLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: nextLesson?.subject).capital() + ShortSubject.resolve(subject: nextLesson?.subject).capital() : "", "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", }; @@ -199,24 +201,23 @@ class LiveCardProvider extends ChangeNotifier { final diff = getFloorDifference(); return { - "color": - '#${_settings.liveActivityColor.toString().substring(10, 16)}', + "color": color, "icon": iconFloorMap[diff] ?? "cup.and.saucer", "title": "Szünet", "description": "go $diff".i18n.fill([ diff != "to room" ? (nextLesson!.getFloor() ?? 0) : nextLesson!.room ]), "startDate": ((prevLesson?.end.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "endDate": ((nextLesson?.start.millisecondsSinceEpoch ?? 0) - - _delay.inMilliseconds) + _delay.inMilliseconds) .toString(), "nextSubject": (nextLesson != null - ? nextLesson?.subject.renamedTo ?? - ShortSubject.resolve(subject: nextLesson?.subject) - .capital() - : "") + ? nextLesson?.subject.renamedTo ?? + ShortSubject.resolve(subject: nextLesson?.subject) + .capital() + : "") .capital(), "nextRoom": nextLesson?.room.replaceAll("_", " ") ?? "", "index": "", @@ -243,8 +244,8 @@ class LiveCardProvider extends ChangeNotifier { DateTime now = _now().add(_delay); if ((currentState == LiveCardState.morning || - currentState == LiveCardState.afternoon || - currentState == LiveCardState.night) && + currentState == LiveCardState.afternoon || + currentState == LiveCardState.night) && storeFirstRunDate == null) { storeFirstRunDate = now; } @@ -253,9 +254,9 @@ class LiveCardProvider extends ChangeNotifier { // Filter label lessons #128 today = today .where((lesson) => - lesson.status?.name != "Elmaradt" && - lesson.subject.id != '' && - !lesson.isEmpty) + lesson.status?.name != "Elmaradt" && + lesson.subject.id != '' && + !lesson.isEmpty) .toList(); if (today.isNotEmpty) { @@ -263,7 +264,7 @@ class LiveCardProvider extends ChangeNotifier { today.sort((a, b) => a.start.compareTo(b.start)); final _lesson = today.firstWhere( - (l) => l.start.isBefore(now) && l.end.isAfter(now), + (l) => l.start.isBefore(now) && l.end.isAfter(now), orElse: () => Lesson.fromJson({})); if (_lesson.start.year != 0) { @@ -328,7 +329,7 @@ class LiveCardProvider extends ChangeNotifier { hasActivityStarted = true; } else if (!hasActivityStarted && ((currentState == LiveCardState.duringLesson && - currentLesson != null) || + currentLesson != null) || currentState == LiveCardState.duringBreak)) { debugPrint("Óra van, vagy szünet, de nincs LiveActivity. létrehozás..."); PlatformChannel.createLiveActivity(toMap()); @@ -362,7 +363,11 @@ class LiveCardProvider extends ChangeNotifier { } //END - if ((currentState == LiveCardState.afternoon || currentState == LiveCardState.morning || currentState == LiveCardState.night) && hasActivityStarted && nextLesson != null && + if ((currentState == LiveCardState.afternoon || + currentState == LiveCardState.morning || + currentState == LiveCardState.night) && + hasActivityStarted && + nextLesson != null && nextLesson!.start.difference(now).inMinutes > 60) { debugPrint("Több, mint 1 óra van az első óráig. Befejezés..."); PlatformChannel.endLiveActivity(); @@ -389,4 +394,4 @@ class LiveCardProvider extends ChangeNotifier { List _today(TimetableProvider p) => (p.getWeek(Week.current()) ?? []) .where((l) => _sameDate(l.date, _now())) .toList(); -} \ No newline at end of file +} diff --git a/refilc/lib/app.dart b/refilc/lib/app.dart index abf6158..849c0b9 100644 --- a/refilc/lib/app.dart +++ b/refilc/lib/app.dart @@ -39,11 +39,11 @@ import 'package:refilc_mobile_ui/screens/settings/settings_route.dart' import 'package:refilc_mobile_ui/screens/settings/settings_screen.dart' as mobile; -// Desktop UI -import 'package:refilc_desktop_ui/screens/navigation/navigation_screen.dart' - as desktop; -import 'package:refilc_desktop_ui/screens/login/login_screen.dart' as desktop; -import 'package:refilc_desktop_ui/screens/login/login_route.dart' as desktop; +// Desktop UI (no more desktop ui) +// import 'package:refilc_desktop_ui/screens/navigation/navigation_screen.dart' +// as desktop; +// import 'package:refilc_desktop_ui/screens/login/login_screen.dart' as desktop; +// import 'package:refilc_desktop_ui/screens/login/login_route.dart' as desktop; // Providers import 'package:refilc/models/settings.dart'; @@ -248,17 +248,18 @@ class App extends StatelessWidget { Route? rootNavigator(RouteSettings route) { if (kIsWeb) { - switch (route.name) { - case "login_back": - return CupertinoPageRoute( - builder: (context) => const desktop.LoginScreen(back: true)); - case "login": - return _rootRoute(const desktop.LoginScreen()); - case "navigation": - return _rootRoute(const desktop.NavigationScreen()); - case "login_to_navigation": - return desktop.loginRoute(const desktop.NavigationScreen()); - } + return null; + // switch (route.name) { + // case "login_back": + // return CupertinoPageRoute( + // builder: (context) => const desktop.LoginScreen(back: true)); + // case "login": + // return _rootRoute(const desktop.LoginScreen()); + // case "navigation": + // return _rootRoute(const desktop.NavigationScreen()); + // case "login_to_navigation": + // return desktop.loginRoute(const desktop.NavigationScreen()); + // } } else if (Platform.isAndroid || Platform.isIOS) { switch (route.name) { case "login_back": @@ -274,17 +275,18 @@ class App extends StatelessWidget { return mobile.settingsRoute(const mobile.SettingsScreen()); } } else if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { - switch (route.name) { - case "login_back": - return CupertinoPageRoute( - builder: (context) => const desktop.LoginScreen(back: true)); - case "login": - return _rootRoute(const desktop.LoginScreen()); - case "navigation": - return _rootRoute(const desktop.NavigationScreen()); - case "login_to_navigation": - return desktop.loginRoute(const desktop.NavigationScreen()); - } + return null; + // switch (route.name) { + // case "login_back": + // return CupertinoPageRoute( + // builder: (context) => const desktop.LoginScreen(back: true)); + // case "login": + // return _rootRoute(const desktop.LoginScreen()); + // case "navigation": + // return _rootRoute(const desktop.NavigationScreen()); + // case "login_to_navigation": + // return desktop.loginRoute(const desktop.NavigationScreen()); + // } } return null; } diff --git a/refilc/lib/database/init.dart b/refilc/lib/database/init.dart index 75826e6..6e7fad2 100644 --- a/refilc/lib/database/init.dart +++ b/refilc/lib/database/init.dart @@ -8,7 +8,7 @@ import 'package:refilc/models/settings.dart'; import 'package:flutter/foundation.dart'; // ignore: depend_on_referenced_packages import 'package:sqflite_common_ffi/sqflite_ffi.dart'; -import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart'; +// import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart'; const settingsDB = DatabaseStruct("settings", { "language": String, "start_page": int, "rounding": int, "theme": int, @@ -110,7 +110,8 @@ Future initDB(DatabaseProvider database) async { Database db; if (kIsWeb) { - db = await databaseFactoryFfiWeb.openDatabase("app.db"); + // db = await databaseFactoryFfiWeb.openDatabase("app.db"); + throw "web is not supported"; } else if (Platform.isLinux || Platform.isWindows) { sqfliteFfiInit(); db = await databaseFactoryFfi.openDatabase("app.db"); diff --git a/refilc/lib/helpers/notification_helper.dart b/refilc/lib/helpers/notification_helper.dart index f99ebfe..3916df0 100644 --- a/refilc/lib/helpers/notification_helper.dart +++ b/refilc/lib/helpers/notification_helper.dart @@ -1,25 +1,25 @@ -import 'package:flutter/foundation.dart'; -import 'package:refilc/api/providers/database_provider.dart'; -import 'package:refilc/api/providers/status_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/helpers/notification_helper.i18n.dart'; -import 'package:refilc/models/user.dart'; -import 'package:refilc/utils/navigation_service.dart'; -import 'package:refilc/utils/service_locator.dart'; -import 'package:refilc_kreta_api/client/api.dart'; -import 'package:refilc_kreta_api/client/client.dart'; -import 'package:refilc_kreta_api/models/absence.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:refilc_kreta_api/models/lesson.dart'; -import 'package:refilc_kreta_api/models/week.dart'; -import 'package:refilc_kreta_api/providers/grade_provider.dart'; -import 'package:refilc_kreta_api/providers/timetable_provider.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart' - hide Message; -import 'package:i18n_extension/i18n_extension.dart'; -import 'package:intl/intl.dart'; -import 'package:refilc_kreta_api/models/message.dart'; +// import 'package:flutter/foundation.dart'; +// import 'package:refilc/api/providers/database_provider.dart'; +// import 'package:refilc/api/providers/status_provider.dart'; +// import 'package:refilc/api/providers/user_provider.dart'; +// import 'package:refilc/models/settings.dart'; +// import 'package:refilc/helpers/notification_helper.i18n.dart'; +// import 'package:refilc/models/user.dart'; +// import 'package:refilc/utils/navigation_service.dart'; +// import 'package:refilc/utils/service_locator.dart'; +// import 'package:refilc_kreta_api/client/api.dart'; +// import 'package:refilc_kreta_api/client/client.dart'; +// import 'package:refilc_kreta_api/models/absence.dart'; +// import 'package:refilc_kreta_api/models/grade.dart'; +// import 'package:refilc_kreta_api/models/lesson.dart'; +// import 'package:refilc_kreta_api/models/week.dart'; +// import 'package:refilc_kreta_api/providers/grade_provider.dart'; +// import 'package:refilc_kreta_api/providers/timetable_provider.dart'; +// import 'package:flutter_local_notifications/flutter_local_notifications.dart' +// hide Message; +// import 'package:i18n_extension/i18n_extension.dart'; +// import 'package:intl/intl.dart'; +// import 'package:refilc_kreta_api/models/message.dart'; // if you want to add a new category, also add it to the DB or else the app will probably crash enum LastSeenCategory { @@ -30,690 +30,690 @@ enum LastSeenCategory { lesson } // didn't know a better place for this -class NotificationsHelper { - late DatabaseProvider database; - late SettingsProvider settingsProvider; - late UserProvider userProvider; - late KretaClient kretaClient; - FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); +// class NotificationsHelper { +// late DatabaseProvider database; +// late SettingsProvider settingsProvider; +// late UserProvider userProvider; +// late KretaClient kretaClient; +// FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = +// FlutterLocalNotificationsPlugin(); - String dayTitle(DateTime date) { - try { - String dayTitle = - DateFormat("EEEE", I18n.locale.languageCode).format(date); - dayTitle = dayTitle[0].toUpperCase() + - dayTitle.substring(1); // capitalize string - return dayTitle; - } catch (e) { - return "Unknown"; - } - } +// String dayTitle(DateTime date) { +// try { +// String dayTitle = +// DateFormat("EEEE", I18n.locale.languageCode).format(date); +// dayTitle = dayTitle[0].toUpperCase() + +// dayTitle.substring(1); // capitalize string +// return dayTitle; +// } catch (e) { +// return "Unknown"; +// } +// } - @pragma('vm:entry-point') - void backgroundJob() async { - // initialize providers - database = DatabaseProvider(); - await database.init(); - settingsProvider = await database.query.getSettings(database); - userProvider = await database.query.getUsers(settingsProvider); +// @pragma('vm:entry-point') +// void backgroundJob() async { +// // initialize providers +// database = DatabaseProvider(); +// await database.init(); +// settingsProvider = await database.query.getSettings(database); +// userProvider = await database.query.getUsers(settingsProvider); - if (userProvider.id != null && settingsProvider.notificationsEnabled) { - List users = userProvider.getUsers(); +// if (userProvider.id != null && settingsProvider.notificationsEnabled) { +// List users = userProvider.getUsers(); - // Process notifications for each user asynchronously - await Future.forEach(users, (User user) async { - // Create a new instance of userProvider for each user - UserProvider userProviderForUser = - await database.query.getUsers(settingsProvider); - userProviderForUser.setUser(user.id); +// // Process notifications for each user asynchronously +// await Future.forEach(users, (User user) async { +// // Create a new instance of userProvider for each user +// UserProvider userProviderForUser = +// await database.query.getUsers(settingsProvider); +// userProviderForUser.setUser(user.id); - // Refresh kreta login for current user - final status = StatusProvider(); - KretaClient kretaClientForUser = KretaClient( - user: userProviderForUser, - settings: settingsProvider, - database: database, - status: status, - ); - await kretaClientForUser.refreshLogin(); +// // Refresh kreta login for current user +// final status = StatusProvider(); +// KretaClient kretaClientForUser = KretaClient( +// user: userProviderForUser, +// settings: settingsProvider, +// database: database, +// status: status, +// ); +// await kretaClientForUser.refreshLogin(); - // Process notifications for current user - if (settingsProvider.notificationsGradesEnabled) { - await gradeNotification(userProviderForUser, kretaClientForUser); - } - if (settingsProvider.notificationsAbsencesEnabled) { - await absenceNotification(userProviderForUser, kretaClientForUser); - } - if (settingsProvider.notificationsMessagesEnabled) { - await messageNotification(userProviderForUser, kretaClientForUser); - } - if (settingsProvider.notificationsLessonsEnabled) { - await lessonNotification(userProviderForUser, kretaClientForUser); - } - }); - } - } +// // Process notifications for current user +// if (settingsProvider.notificationsGradesEnabled) { +// await gradeNotification(userProviderForUser, kretaClientForUser); +// } +// if (settingsProvider.notificationsAbsencesEnabled) { +// await absenceNotification(userProviderForUser, kretaClientForUser); +// } +// if (settingsProvider.notificationsMessagesEnabled) { +// await messageNotification(userProviderForUser, kretaClientForUser); +// } +// if (settingsProvider.notificationsLessonsEnabled) { +// await lessonNotification(userProviderForUser, kretaClientForUser); +// } +// }); +// } +// } -/* +// /* -ezt a kódot nagyon szépen megírta az AI, picit szerkesztgettem is rajta //pearoo what did you do - zypherift -nem lesz tőle használhatatlan az app, de kikommenteltem, mert még a végén kima bántani fog +// ezt a kódot nagyon szépen megírta az AI, picit szerkesztgettem is rajta //pearoo what did you do - zypherift +// nem lesz tőle használhatatlan az app, de kikommenteltem, mert még a végén kima bántani fog - Future liveNotification(UserProvider currentuserProvider, KretaClient currentKretaClient) async { - // create a permanent live notification that has a progress bar on how much is left from the current lesson, the title is the name of the class - // get current lesson - TimetableProvider timetableProvider = TimetableProvider( - user: currentuserProvider, - database: database, - kreta: currentKretaClient); - await timetableProvider.restoreUser(); - await timetableProvider.fetch(week: Week.current()); - List apilessons = timetableProvider.getWeek(Week.current()) ?? []; - Lesson? currentLesson; - for (Lesson lesson in apilessons) { - if (lesson.date.isBefore(DateTime.now()) && - lesson.end.isAfter(DateTime.now())) { - currentLesson = lesson; - break; - } - } - if (currentLesson == null) { - return; - } - final elapsedTime = DateTime.now() - .difference(currentLesson.start) - .inSeconds - .toDouble(); - final maxTime = currentLesson.end - .difference(currentLesson.start) - .inSeconds - .toDouble(); +// Future liveNotification(UserProvider currentuserProvider, KretaClient currentKretaClient) async { +// // create a permanent live notification that has a progress bar on how much is left from the current lesson, the title is the name of the class +// // get current lesson +// TimetableProvider timetableProvider = TimetableProvider( +// user: currentuserProvider, +// database: database, +// kreta: currentKretaClient); +// await timetableProvider.restoreUser(); +// await timetableProvider.fetch(week: Week.current()); +// List apilessons = timetableProvider.getWeek(Week.current()) ?? []; +// Lesson? currentLesson; +// for (Lesson lesson in apilessons) { +// if (lesson.date.isBefore(DateTime.now()) && +// lesson.end.isAfter(DateTime.now())) { +// currentLesson = lesson; +// break; +// } +// } +// if (currentLesson == null) { +// return; +// } +// final elapsedTime = DateTime.now() +// .difference(currentLesson.start) +// .inSeconds +// .toDouble(); +// final maxTime = currentLesson.end +// .difference(currentLesson.start) +// .inSeconds +// .toDouble(); - final showMinutes = maxTime - elapsedTime > 60; - // create a live notification - AndroidNotificationDetails androidNotificationDetails = - AndroidNotificationDetails( - 'LIVE', - 'Élő óra', - channelDescription: 'Értesítés az aktuális óráról', - importance: Importance.max, - priority: Priority.max, - color: settingsProvider.customAccentColor, - ticker: 'Élő óra', - maxProgress: maxTime.toInt(), - progress: elapsedTime.toInt(), - ); - NotificationDetails notificationDetails = - NotificationDetails(android: androidNotificationDetails); - await flutterLocalNotificationsPlugin.show( - currentLesson.id.hashCode, - currentLesson.name, - "body_live".i18n.fill( - [ - currentLesson.lessonIndex, - currentLesson.name, - dayTitle(currentLesson.date), - DateFormat("HH:mm").format(currentLesson.start), - DateFormat("HH:mm").format(currentLesson.end), - ], - ), - notificationDetails, - payload: "timetable", - ); +// final showMinutes = maxTime - elapsedTime > 60; +// // create a live notification +// AndroidNotificationDetails androidNotificationDetails = +// AndroidNotificationDetails( +// 'LIVE', +// 'Élő óra', +// channelDescription: 'Értesítés az aktuális óráról', +// importance: Importance.max, +// priority: Priority.max, +// color: settingsProvider.customAccentColor, +// ticker: 'Élő óra', +// maxProgress: maxTime.toInt(), +// progress: elapsedTime.toInt(), +// ); +// NotificationDetails notificationDetails = +// NotificationDetails(android: androidNotificationDetails); +// await flutterLocalNotificationsPlugin.show( +// currentLesson.id.hashCode, +// currentLesson.name, +// "body_live".i18n.fill( +// [ +// currentLesson.lessonIndex, +// currentLesson.name, +// dayTitle(currentLesson.date), +// DateFormat("HH:mm").format(currentLesson.start), +// DateFormat("HH:mm").format(currentLesson.end), +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); - } - */ - Future gradeNotification( - UserProvider currentuserProvider, KretaClient currentKretaClient) async { - // fetch grades - GradeProvider gradeProvider = GradeProvider( - settings: settingsProvider, - user: currentuserProvider, - database: database, - kreta: currentKretaClient); - await gradeProvider.fetch(); - database.userQuery - .getGrades(userId: currentuserProvider.id!) - .then((grades) async { - DateTime lastSeenGrade = await database.userQuery.lastSeen( - userId: currentuserProvider.id!, category: LastSeenCategory.grade); +// } +// */ +// Future gradeNotification( +// UserProvider currentuserProvider, KretaClient currentKretaClient) async { +// // fetch grades +// GradeProvider gradeProvider = GradeProvider( +// settings: settingsProvider, +// user: currentuserProvider, +// database: database, +// kreta: currentKretaClient); +// await gradeProvider.fetch(); +// database.userQuery +// .getGrades(userId: currentuserProvider.id!) +// .then((grades) async { +// DateTime lastSeenGrade = await database.userQuery.lastSeen( +// userId: currentuserProvider.id!, category: LastSeenCategory.grade); - // loop through grades and see which hasn't been seen yet - for (Grade grade in grades) { - // if grade is not a normal grade (1-5), don't show it - if ([1, 2, 3, 4, 5].contains(grade.value.value)) { - // if the grade was added over a week ago, don't show it to avoid notification spam - if (grade.date.isAfter(lastSeenGrade) && - DateTime.now().difference(grade.date).inDays < 7) { - // send notificiation about new grade - AndroidNotificationDetails androidNotificationDetails = - AndroidNotificationDetails( - 'GRADES', - 'Jegyek', - channelDescription: 'Értesítés jegyek beírásakor', - importance: Importance.max, - priority: Priority.max, - color: settingsProvider.customAccentColor, - ticker: 'Jegyek', - ); - NotificationDetails notificationDetails = - NotificationDetails(android: androidNotificationDetails); - if (currentuserProvider.getUsers().length == 1) { - await flutterLocalNotificationsPlugin.show( - grade.id.hashCode, - "title_grade".i18n, - "body_grade".i18n.fill( - [ - grade.subject.isRenamed && - settingsProvider.renamedSubjectsEnabled - ? grade.subject.renamedTo! - : grade.subject.name, - grade.value.value.toString() - ], - ), - notificationDetails, - payload: "grades"); - } else if (settingsProvider.gradeOpeningFun) { - // if surprise grades are enabled, show a notification without the grade - await flutterLocalNotificationsPlugin.show( - grade.id.hashCode, - "title_grade".i18n, - "body_grade_surprise".i18n.fill( - [ - grade.subject.isRenamed && - settingsProvider.renamedSubjectsEnabled - ? grade.subject.renamedTo! - : grade.subject.name, - grade.value.value.toString() - ], - ), - notificationDetails, - payload: "grades"); - } else { - // multiple users are added, also display student name - await flutterLocalNotificationsPlugin.show( - grade.id.hashCode, - "title_grade".i18n, - "body_grade_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - grade.subject.isRenamed && - settingsProvider.renamedSubjectsEnabled - ? grade.subject.renamedTo! - : grade.subject.name, - grade.value.value.toString() - ], - ), - notificationDetails, - payload: "grades"); - } - } - } - } - // set grade seen status - database.userStore.storeLastSeen(DateTime.now(), - userId: currentuserProvider.id!, category: LastSeenCategory.grade); - }); - } +// // loop through grades and see which hasn't been seen yet +// for (Grade grade in grades) { +// // if grade is not a normal grade (1-5), don't show it +// if ([1, 2, 3, 4, 5].contains(grade.value.value)) { +// // if the grade was added over a week ago, don't show it to avoid notification spam +// if (grade.date.isAfter(lastSeenGrade) && +// DateTime.now().difference(grade.date).inDays < 7) { +// // send notificiation about new grade +// AndroidNotificationDetails androidNotificationDetails = +// AndroidNotificationDetails( +// 'GRADES', +// 'Jegyek', +// channelDescription: 'Értesítés jegyek beírásakor', +// importance: Importance.max, +// priority: Priority.max, +// color: settingsProvider.customAccentColor, +// ticker: 'Jegyek', +// ); +// NotificationDetails notificationDetails = +// NotificationDetails(android: androidNotificationDetails); +// if (currentuserProvider.getUsers().length == 1) { +// await flutterLocalNotificationsPlugin.show( +// grade.id.hashCode, +// "title_grade".i18n, +// "body_grade".i18n.fill( +// [ +// grade.subject.isRenamed && +// settingsProvider.renamedSubjectsEnabled +// ? grade.subject.renamedTo! +// : grade.subject.name, +// grade.value.value.toString() +// ], +// ), +// notificationDetails, +// payload: "grades"); +// } else if (settingsProvider.gradeOpeningFun) { +// // if surprise grades are enabled, show a notification without the grade +// await flutterLocalNotificationsPlugin.show( +// grade.id.hashCode, +// "title_grade".i18n, +// "body_grade_surprise".i18n.fill( +// [ +// grade.subject.isRenamed && +// settingsProvider.renamedSubjectsEnabled +// ? grade.subject.renamedTo! +// : grade.subject.name, +// grade.value.value.toString() +// ], +// ), +// notificationDetails, +// payload: "grades"); +// } else { +// // multiple users are added, also display student name +// await flutterLocalNotificationsPlugin.show( +// grade.id.hashCode, +// "title_grade".i18n, +// "body_grade_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// grade.subject.isRenamed && +// settingsProvider.renamedSubjectsEnabled +// ? grade.subject.renamedTo! +// : grade.subject.name, +// grade.value.value.toString() +// ], +// ), +// notificationDetails, +// payload: "grades"); +// } +// } +// } +// } +// // set grade seen status +// database.userStore.storeLastSeen(DateTime.now(), +// userId: currentuserProvider.id!, category: LastSeenCategory.grade); +// }); +// } - Future absenceNotification( - UserProvider currentuserProvider, KretaClient currentKretaClient) async { - // get absences from api - List? absenceJson = await currentKretaClient - .getAPI(KretaAPI.absences(currentuserProvider.instituteCode ?? "")); - if (absenceJson == null) { - return; - } - DateTime lastSeenAbsence = await database.userQuery.lastSeen( - userId: currentuserProvider.id!, category: LastSeenCategory.absence); - // format api absences - List absences = - absenceJson.map((e) => Absence.fromJson(e)).toList(); - for (Absence absence in absences) { - if (absence.date.isAfter(lastSeenAbsence)) { - AndroidNotificationDetails androidNotificationDetails = - AndroidNotificationDetails( - 'ABSENCES', - 'Hiányzások', - channelDescription: 'Értesítés hiányzások beírásakor', - importance: Importance.max, - priority: Priority.max, - color: settingsProvider.customAccentColor, - ticker: 'Hiányzások', - ); - NotificationDetails notificationDetails = - NotificationDetails(android: androidNotificationDetails); - if (currentuserProvider.getUsers().length == 1) { - await flutterLocalNotificationsPlugin.show( - absence.id.hashCode, - "title_absence" - .i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528 - "body_absence".i18n.fill( - [ - DateFormat("yyyy-MM-dd").format(absence.date), - absence.subject.isRenamed && - settingsProvider.renamedSubjectsEnabled - ? absence.subject.renamedTo! - : absence.subject.name - ], - ), - notificationDetails, - payload: "absences"); - } else { - await flutterLocalNotificationsPlugin.show( - absence.id.hashCode, - "title_absence" - .i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528 - "body_absence_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - DateFormat("yyyy-MM-dd").format(absence.date), - absence.subject.isRenamed && - settingsProvider.renamedSubjectsEnabled - ? absence.subject.renamedTo! - : absence.subject.name - ], - ), - notificationDetails, - payload: "absences"); - } - } - } - await database.userStore.storeLastSeen(DateTime.now(), - userId: currentuserProvider.id!, category: LastSeenCategory.absence); - } +// Future absenceNotification( +// UserProvider currentuserProvider, KretaClient currentKretaClient) async { +// // get absences from api +// List? absenceJson = await currentKretaClient +// .getAPI(KretaAPI.absences(currentuserProvider.instituteCode ?? "")); +// if (absenceJson == null) { +// return; +// } +// DateTime lastSeenAbsence = await database.userQuery.lastSeen( +// userId: currentuserProvider.id!, category: LastSeenCategory.absence); +// // format api absences +// List absences = +// absenceJson.map((e) => Absence.fromJson(e)).toList(); +// for (Absence absence in absences) { +// if (absence.date.isAfter(lastSeenAbsence)) { +// AndroidNotificationDetails androidNotificationDetails = +// AndroidNotificationDetails( +// 'ABSENCES', +// 'Hiányzások', +// channelDescription: 'Értesítés hiányzások beírásakor', +// importance: Importance.max, +// priority: Priority.max, +// color: settingsProvider.customAccentColor, +// ticker: 'Hiányzások', +// ); +// NotificationDetails notificationDetails = +// NotificationDetails(android: androidNotificationDetails); +// if (currentuserProvider.getUsers().length == 1) { +// await flutterLocalNotificationsPlugin.show( +// absence.id.hashCode, +// "title_absence" +// .i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528 +// "body_absence".i18n.fill( +// [ +// DateFormat("yyyy-MM-dd").format(absence.date), +// absence.subject.isRenamed && +// settingsProvider.renamedSubjectsEnabled +// ? absence.subject.renamedTo! +// : absence.subject.name +// ], +// ), +// notificationDetails, +// payload: "absences"); +// } else { +// await flutterLocalNotificationsPlugin.show( +// absence.id.hashCode, +// "title_absence" +// .i18n, // https://discord.com/channels/1111649116020285532/1153273625206591528 +// "body_absence_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// DateFormat("yyyy-MM-dd").format(absence.date), +// absence.subject.isRenamed && +// settingsProvider.renamedSubjectsEnabled +// ? absence.subject.renamedTo! +// : absence.subject.name +// ], +// ), +// notificationDetails, +// payload: "absences"); +// } +// } +// } +// await database.userStore.storeLastSeen(DateTime.now(), +// userId: currentuserProvider.id!, category: LastSeenCategory.absence); +// } - Future messageNotification( - UserProvider currentuserProvider, KretaClient currentKretaClient) async { - // get messages from api - List? messageJson = - await currentKretaClient.getAPI(KretaAPI.messages("beerkezett")); - if (messageJson == null) { - return; - } - // format api messages to correct format - // Parse messages - List messages = []; - await Future.wait(List.generate(messageJson.length, (index) { - return () async { - Map message = messageJson.cast()[index]; - Map? innerMessageJson = await currentKretaClient - .getAPI(KretaAPI.message(message["azonosito"].toString())); - await Future.delayed(const Duration(seconds: 1)); - if (innerMessageJson != null) { - messages.add( - Message.fromJson(innerMessageJson, forceType: MessageType.inbox)); - } - }(); - })); +// Future messageNotification( +// UserProvider currentuserProvider, KretaClient currentKretaClient) async { +// // get messages from api +// List? messageJson = +// await currentKretaClient.getAPI(KretaAPI.messages("beerkezett")); +// if (messageJson == null) { +// return; +// } +// // format api messages to correct format +// // Parse messages +// List messages = []; +// await Future.wait(List.generate(messageJson.length, (index) { +// return () async { +// Map message = messageJson.cast()[index]; +// Map? innerMessageJson = await currentKretaClient +// .getAPI(KretaAPI.message(message["azonosito"].toString())); +// await Future.delayed(const Duration(seconds: 1)); +// if (innerMessageJson != null) { +// messages.add( +// Message.fromJson(innerMessageJson, forceType: MessageType.inbox)); +// } +// }(); +// })); - DateTime lastSeenMessage = await database.userQuery.lastSeen( - userId: currentuserProvider.id!, category: LastSeenCategory.message); +// DateTime lastSeenMessage = await database.userQuery.lastSeen( +// userId: currentuserProvider.id!, category: LastSeenCategory.message); - for (Message message in messages) { - if (message.date.isAfter(lastSeenMessage)) { - AndroidNotificationDetails androidNotificationDetails = - AndroidNotificationDetails( - 'MESSAGES', - 'Üzenetek', - channelDescription: 'Értesítés kapott üzenetekkor', - importance: Importance.max, - priority: Priority.max, - color: settingsProvider.customAccentColor, - ticker: 'Üzenetek', - ); - NotificationDetails notificationDetails = - NotificationDetails(android: androidNotificationDetails); - if (currentuserProvider.getUsers().length == 1) { - await flutterLocalNotificationsPlugin.show( - message.id.hashCode, - message.author, - message.content.replaceAll(RegExp(r'<[^>]*>'), ''), - notificationDetails, - payload: "messages", - ); - } else { - await flutterLocalNotificationsPlugin.show( - message.id.hashCode, - "(${currentuserProvider.displayName!}) ${message.author}", - message.content.replaceAll(RegExp(r'<[^>]*>'), ''), - notificationDetails, - payload: "messages", - ); - } - } - } - await database.userStore.storeLastSeen(DateTime.now(), - userId: currentuserProvider.id!, category: LastSeenCategory.message); - } +// for (Message message in messages) { +// if (message.date.isAfter(lastSeenMessage)) { +// AndroidNotificationDetails androidNotificationDetails = +// AndroidNotificationDetails( +// 'MESSAGES', +// 'Üzenetek', +// channelDescription: 'Értesítés kapott üzenetekkor', +// importance: Importance.max, +// priority: Priority.max, +// color: settingsProvider.customAccentColor, +// ticker: 'Üzenetek', +// ); +// NotificationDetails notificationDetails = +// NotificationDetails(android: androidNotificationDetails); +// if (currentuserProvider.getUsers().length == 1) { +// await flutterLocalNotificationsPlugin.show( +// message.id.hashCode, +// message.author, +// message.content.replaceAll(RegExp(r'<[^>]*>'), ''), +// notificationDetails, +// payload: "messages", +// ); +// } else { +// await flutterLocalNotificationsPlugin.show( +// message.id.hashCode, +// "(${currentuserProvider.displayName!}) ${message.author}", +// message.content.replaceAll(RegExp(r'<[^>]*>'), ''), +// notificationDetails, +// payload: "messages", +// ); +// } +// } +// } +// await database.userStore.storeLastSeen(DateTime.now(), +// userId: currentuserProvider.id!, category: LastSeenCategory.message); +// } - Future lessonNotification( - UserProvider currentuserProvider, KretaClient currentKretaClient) async { - // get lessons from api - TimetableProvider timetableProvider = TimetableProvider( - user: currentuserProvider, - database: database, - kreta: currentKretaClient); - await timetableProvider.restoreUser(); - await timetableProvider.fetch(week: Week.current()); - List apilessons = timetableProvider.getWeek(Week.current()) ?? []; +// Future lessonNotification( +// UserProvider currentuserProvider, KretaClient currentKretaClient) async { +// // get lessons from api +// TimetableProvider timetableProvider = TimetableProvider( +// user: currentuserProvider, +// database: database, +// kreta: currentKretaClient); +// await timetableProvider.restoreUser(); +// await timetableProvider.fetch(week: Week.current()); +// List apilessons = timetableProvider.getWeek(Week.current()) ?? []; - DateTime lastSeenLesson = await database.userQuery.lastSeen( - userId: currentuserProvider.id!, category: LastSeenCategory.lesson); - Lesson? latestLesson; +// DateTime lastSeenLesson = await database.userQuery.lastSeen( +// userId: currentuserProvider.id!, category: LastSeenCategory.lesson); +// Lesson? latestLesson; - for (Lesson lesson in apilessons) { - if ((lesson.status?.name != "Elmaradt" || - lesson.substituteTeacher?.name != "") && - lesson.date.isAfter(latestLesson?.start ?? DateTime(1970))) { - latestLesson = lesson; - } - if (lesson.date.isAfter(lastSeenLesson)) { - AndroidNotificationDetails androidNotificationDetails = - AndroidNotificationDetails( - 'LESSONS', - 'Órák', - channelDescription: 'Értesítés órák elmaradásáról, helyettesítésről', - importance: Importance.max, - priority: Priority.max, - color: settingsProvider.customAccentColor, - ticker: 'Órák', - ); - NotificationDetails notificationDetails = - NotificationDetails(android: androidNotificationDetails); - if (currentuserProvider.getUsers().length == 1) { - if (lesson.status?.name == "Elmaradt") { - switch (I18n.localeStr) { - case "en_en": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled".i18n.fill( - [ - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date) - ], - ), - notificationDetails, - payload: "timetable"); - break; - } - case "hu_hu": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled".i18n.fill( - [ - dayTitle(lesson.date), - lesson.lessonIndex, - lesson.name - ], - ), - notificationDetails, - payload: "timetable"); - break; - } - default: - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled".i18n.fill( - [ - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date) - ], - ), - notificationDetails, - payload: "timetable"); - break; - } - } - } else if (lesson.substituteTeacher?.name != "" && - lesson.substituteTeacher != null) { - switch (I18n.localeStr) { - case "en_en": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted".i18n.fill( - [ - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date), - ((lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher?.renamedTo! - : lesson.substituteTeacher?.name) ?? - '', - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - case "hu_hu": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted".i18n.fill( - [ - dayTitle(lesson.date), - lesson.lessonIndex, - lesson.name, - ((lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher?.renamedTo! - : lesson.substituteTeacher?.name) ?? - '', - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - default: - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted".i18n.fill( - [ - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date), - ((lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher?.renamedTo! - : lesson.substituteTeacher?.name) ?? - '', - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - } - } - } else { - if (lesson.status?.name == "Elmaradt") { - switch (I18n.localeStr) { - case "en_en": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date) - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - case "hu_hu": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - dayTitle(lesson.date), - lesson.lessonIndex, - lesson.name - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - default: - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_canceled_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date) - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - } - } else if (lesson.substituteTeacher?.name != "") { - switch (I18n.localeStr) { - case "en_en": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date), - ((lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher?.renamedTo! - : lesson.substituteTeacher?.name) ?? - '', - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - case "hu_hu": - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - dayTitle(lesson.date), - lesson.lessonIndex, - lesson.name, - ((lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher?.renamedTo! - : lesson.substituteTeacher?.name) ?? - '', - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - default: - { - await flutterLocalNotificationsPlugin.show( - lesson.id.hashCode, - "title_lesson".i18n, - "body_lesson_substituted_multiuser".i18n.fill( - [ - currentuserProvider.displayName!, - lesson.lessonIndex, - lesson.name, - dayTitle(lesson.date), - (lesson.substituteTeacher?.isRenamed ?? false) - ? lesson.substituteTeacher!.renamedTo! - : lesson.substituteTeacher!.name - ], - ), - notificationDetails, - payload: "timetable", - ); - break; - } - } - } - } - } - } - // lesson.date does not contain time, only the date - await database.userStore.storeLastSeen( - latestLesson?.start ?? DateTime.now(), - userId: currentuserProvider.id!, - category: LastSeenCategory.lesson); - } +// for (Lesson lesson in apilessons) { +// if ((lesson.status?.name != "Elmaradt" || +// lesson.substituteTeacher?.name != "") && +// lesson.date.isAfter(latestLesson?.start ?? DateTime(1970))) { +// latestLesson = lesson; +// } +// if (lesson.date.isAfter(lastSeenLesson)) { +// AndroidNotificationDetails androidNotificationDetails = +// AndroidNotificationDetails( +// 'LESSONS', +// 'Órák', +// channelDescription: 'Értesítés órák elmaradásáról, helyettesítésről', +// importance: Importance.max, +// priority: Priority.max, +// color: settingsProvider.customAccentColor, +// ticker: 'Órák', +// ); +// NotificationDetails notificationDetails = +// NotificationDetails(android: androidNotificationDetails); +// if (currentuserProvider.getUsers().length == 1) { +// if (lesson.status?.name == "Elmaradt") { +// switch (I18n.localeStr) { +// case "en_en": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled".i18n.fill( +// [ +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date) +// ], +// ), +// notificationDetails, +// payload: "timetable"); +// break; +// } +// case "hu_hu": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled".i18n.fill( +// [ +// dayTitle(lesson.date), +// lesson.lessonIndex, +// lesson.name +// ], +// ), +// notificationDetails, +// payload: "timetable"); +// break; +// } +// default: +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled".i18n.fill( +// [ +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date) +// ], +// ), +// notificationDetails, +// payload: "timetable"); +// break; +// } +// } +// } else if (lesson.substituteTeacher?.name != "" && +// lesson.substituteTeacher != null) { +// switch (I18n.localeStr) { +// case "en_en": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted".i18n.fill( +// [ +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date), +// ((lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher?.renamedTo! +// : lesson.substituteTeacher?.name) ?? +// '', +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// case "hu_hu": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted".i18n.fill( +// [ +// dayTitle(lesson.date), +// lesson.lessonIndex, +// lesson.name, +// ((lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher?.renamedTo! +// : lesson.substituteTeacher?.name) ?? +// '', +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// default: +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted".i18n.fill( +// [ +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date), +// ((lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher?.renamedTo! +// : lesson.substituteTeacher?.name) ?? +// '', +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// } +// } +// } else { +// if (lesson.status?.name == "Elmaradt") { +// switch (I18n.localeStr) { +// case "en_en": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date) +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// case "hu_hu": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// dayTitle(lesson.date), +// lesson.lessonIndex, +// lesson.name +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// default: +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_canceled_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date) +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// } +// } else if (lesson.substituteTeacher?.name != "") { +// switch (I18n.localeStr) { +// case "en_en": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date), +// ((lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher?.renamedTo! +// : lesson.substituteTeacher?.name) ?? +// '', +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// case "hu_hu": +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// dayTitle(lesson.date), +// lesson.lessonIndex, +// lesson.name, +// ((lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher?.renamedTo! +// : lesson.substituteTeacher?.name) ?? +// '', +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// default: +// { +// await flutterLocalNotificationsPlugin.show( +// lesson.id.hashCode, +// "title_lesson".i18n, +// "body_lesson_substituted_multiuser".i18n.fill( +// [ +// currentuserProvider.displayName!, +// lesson.lessonIndex, +// lesson.name, +// dayTitle(lesson.date), +// (lesson.substituteTeacher?.isRenamed ?? false) +// ? lesson.substituteTeacher!.renamedTo! +// : lesson.substituteTeacher!.name +// ], +// ), +// notificationDetails, +// payload: "timetable", +// ); +// break; +// } +// } +// } +// } +// } +// } +// // lesson.date does not contain time, only the date +// await database.userStore.storeLastSeen( +// latestLesson?.start ?? DateTime.now(), +// userId: currentuserProvider.id!, +// category: LastSeenCategory.lesson); +// } - // Called when the user taps a notification - void onDidReceiveNotificationResponse( - NotificationResponse notificationResponse) async { - final String? payload = notificationResponse.payload; - if (notificationResponse.payload != null) { - debugPrint('notification payload: $payload'); - } - switch (payload) { - case "timetable": - locator().navigateTo("timetable"); - break; - case "grades": - locator().navigateTo("grades"); - break; - case "messages": - locator().navigateTo("messages"); - break; - case "absences": - locator().navigateTo("absences"); - break; - case "settings": - locator().navigateTo("settings"); - break; - default: - break; - } - } +// // Called when the user taps a notification +// void onDidReceiveNotificationResponse( +// NotificationResponse notificationResponse) async { +// final String? payload = notificationResponse.payload; +// if (notificationResponse.payload != null) { +// debugPrint('notification payload: $payload'); +// } +// switch (payload) { +// case "timetable": +// locator().navigateTo("timetable"); +// break; +// case "grades": +// locator().navigateTo("grades"); +// break; +// case "messages": +// locator().navigateTo("messages"); +// break; +// case "absences": +// locator().navigateTo("absences"); +// break; +// case "settings": +// locator().navigateTo("settings"); +// break; +// default: +// break; +// } +// } - // Set all notification categories to seen - Future setAllCategoriesSeen(UserProvider userProvider) async { - if (userProvider.id != null) { - for (LastSeenCategory category in LastSeenCategory.values) { - await database.userStore.storeLastSeen(DateTime.now(), - userId: userProvider.id!, category: category); - } - } - } -} +// // Set all notification categories to seen +// Future setAllCategoriesSeen(UserProvider userProvider) async { +// if (userProvider.id != null) { +// for (LastSeenCategory category in LastSeenCategory.values) { +// await database.userStore.storeLastSeen(DateTime.now(), +// userId: userProvider.id!, category: category); +// } +// } +// } +// } diff --git a/refilc/lib/main.dart b/refilc/lib/main.dart index 5b0a3f4..2129c16 100644 --- a/refilc/lib/main.dart +++ b/refilc/lib/main.dart @@ -5,7 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/database/init.dart'; -import 'package:refilc/helpers/notification_helper.dart'; +// import 'package:refilc/helpers/notification_helper.dart'; import 'package:refilc/models/settings.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -104,7 +104,7 @@ class Startup { user = await database.query.getUsers(settings); // Set all notification categories to seen to avoid having notifications that the user has already seen in the app - NotificationsHelper().setAllCategoriesSeen(user); + // NotificationsHelper().setAllCategoriesSeen(user); late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; // Notifications setup @@ -146,30 +146,30 @@ class Startup { // Platform specific settings if (!kIsWeb) { - const DarwinInitializationSettings initializationSettingsDarwin = - DarwinInitializationSettings( - requestSoundPermission: true, - requestBadgePermission: true, - requestAlertPermission: false, - ); - const AndroidInitializationSettings initializationSettingsAndroid = - AndroidInitializationSettings('ic_notification'); - const LinuxInitializationSettings initializationSettingsLinux = - LinuxInitializationSettings(defaultActionName: 'Open notification'); - const InitializationSettings initializationSettings = - InitializationSettings( - android: initializationSettingsAndroid, - iOS: initializationSettingsDarwin, - macOS: initializationSettingsDarwin, - linux: initializationSettingsLinux, - ); + // const DarwinInitializationSettings initializationSettingsDarwin = + // DarwinInitializationSettings( + // requestSoundPermission: true, + // requestBadgePermission: true, + // requestAlertPermission: false, + // ); + // const AndroidInitializationSettings initializationSettingsAndroid = + // AndroidInitializationSettings('ic_notification'); + // const LinuxInitializationSettings initializationSettingsLinux = + // LinuxInitializationSettings(defaultActionName: 'Open notification'); + // const InitializationSettings initializationSettings = + // InitializationSettings( + // android: initializationSettingsAndroid, + // iOS: initializationSettingsDarwin, + // macOS: initializationSettingsDarwin, + // linux: initializationSettingsLinux, + // ); // Initialize notifications - await flutterLocalNotificationsPlugin.initialize( - initializationSettings, - onDidReceiveNotificationResponse: - NotificationsHelper().onDidReceiveNotificationResponse, - ); + // await flutterLocalNotificationsPlugin.initialize( + // initializationSettings, + // onDidReceiveNotificationResponse: + // NotificationsHelper().onDidReceiveNotificationResponse, + // ); } // if (Platform.isAndroid || Platform.isIOS) { @@ -214,7 +214,7 @@ Widget errorBuilder(FlutterErrorDetails details) { } }); - return Container(); + return Container(); }); } @@ -239,7 +239,7 @@ Future initPlatformState() async { if (!Platform.isIOS) return; LiveActivityHelper().backgroundJob(); } else { - NotificationsHelper().backgroundJob(); + // NotificationsHelper().backgroundJob(); } BackgroundFetch.finish(taskId); }, (String taskId) async { @@ -279,7 +279,7 @@ void backgroundHeadlessTask(HeadlessTask task) { if (!Platform.isIOS) return; LiveActivityHelper().backgroundJob(); } else { - NotificationsHelper().backgroundJob(); + // NotificationsHelper().backgroundJob(); } BackgroundFetch.finish(task.taskId); } diff --git a/refilc/lib/models/settings.dart b/refilc/lib/models/settings.dart index bc75a50..2f295a0 100644 --- a/refilc/lib/models/settings.dart +++ b/refilc/lib/models/settings.dart @@ -500,7 +500,7 @@ class SettingsProvider extends ChangeNotifier { renameSubjectsItalics: false, renameTeachersEnabled: false, renameTeachersItalics: false, - liveActivityColor: const Color(0xFF676767), + liveActivityColor: const Color(0x00000000), welcomeMessage: '', appIcon: 'refilc_default', currentThemeId: '', diff --git a/refilc/lib/theme/colors/colors.dart b/refilc/lib/theme/colors/colors.dart index cb81d81..a933396 100644 --- a/refilc/lib/theme/colors/colors.dart +++ b/refilc/lib/theme/colors/colors.dart @@ -1,8 +1,8 @@ import 'dart:io'; -import 'package:refilc/theme/colors/dark_desktop.dart'; +// import 'package:refilc/theme/colors/dark_desktop.dart'; import 'package:refilc/theme/colors/dark_mobile.dart'; -import 'package:refilc/theme/colors/light_desktop.dart'; +// import 'package:refilc/theme/colors/light_desktop.dart'; import 'package:refilc/theme/colors/light_mobile.dart'; import 'package:flutter/material.dart'; @@ -21,10 +21,16 @@ class AppColors { } else { switch (brightness) { case Brightness.light: - return LightDesktopAppColors(); + return LightMobileAppColors(); case Brightness.dark: - return DarkDesktopAppColors(); + return DarkMobileAppColors(); } + // switch (brightness) { + // case Brightness.light: + // return LightDesktopAppColors(); + // case Brightness.dark: + // return DarkDesktopAppColors(); + // } } } } diff --git a/refilc/lib/theme/theme.dart b/refilc/lib/theme/theme.dart index 405ac95..0d85638 100644 --- a/refilc/lib/theme/theme.dart +++ b/refilc/lib/theme/theme.dart @@ -115,42 +115,42 @@ class AppTheme { primary: accent, onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), secondary: newSecondary, onSecondary: (newSecondary.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), tertiary: newTertiary, onTertiary: (newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), brightness: Brightness.light, error: lightColors.red, - onError: Colors.white.withOpacity(.9), + onError: Colors.white.withValues(alpha: .9), surface: highlightColor, - onSurface: Colors.black.withOpacity(.9), + onSurface: Colors.black.withValues(alpha: .9), ), - shadowColor: lightColors.shadow.withOpacity(.5), + shadowColor: lightColors.shadow.withValues(alpha: .5), appBarTheme: AppBarTheme(backgroundColor: backgroundColor), indicatorColor: accent, - iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)), + iconTheme: IconThemeData(color: lightColors.text.withValues(alpha: .75)), navigationBarTheme: NavigationBarThemeData( - indicatorColor: - accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8), + indicatorColor: accent.withValues( + alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8), iconTheme: WidgetStateProperty.all(IconThemeData(color: lightColors.text)), backgroundColor: highlightColor, labelTextStyle: WidgetStateProperty.all(TextStyle( fontSize: 13.0, fontWeight: FontWeight.w500, - color: lightColors.text.withOpacity(0.8), + color: lightColors.text.withValues(alpha: 0.8), )), labelBehavior: NavigationDestinationLabelBehavior.alwaysShow, height: 76.0, ), sliderTheme: SliderThemeData( - inactiveTrackColor: accent.withOpacity(.3), + inactiveTrackColor: accent.withValues(alpha: .3), ), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent), @@ -238,48 +238,48 @@ class AppTheme { primary: accent, onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), secondary: newSecondary, onSecondary: (newSecondary.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), tertiary: newTertiary, onTertiary: (newTertiary.computeLuminance() > 0.5 ? Colors.black : Colors.white) - .withOpacity(.9), + .withValues(alpha: .9), brightness: Brightness.dark, error: darkColors.red, - onError: Colors.black.withOpacity(.9), + onError: Colors.black.withValues(alpha: .9), surface: highlightColor, - onSurface: Colors.white.withOpacity(.9), + onSurface: Colors.white.withValues(alpha: .9), ), - shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow, + shadowColor: highlightColor.withValues(alpha: .5), //darkColors.shadow, appBarTheme: AppBarTheme(backgroundColor: backgroundColor), indicatorColor: accent, - iconTheme: IconThemeData(color: darkColors.text.withOpacity(.75)), + iconTheme: IconThemeData(color: darkColors.text.withValues(alpha: .75)), navigationBarTheme: NavigationBarThemeData( - indicatorColor: - accent.withOpacity(accentColor == AccentColor.adaptive ? 0.4 : 0.8), + indicatorColor: accent.withValues( + alpha: accentColor == AccentColor.adaptive ? 0.4 : 0.8), iconTheme: WidgetStateProperty.all(IconThemeData(color: darkColors.text)), backgroundColor: highlightColor, labelTextStyle: WidgetStateProperty.all(TextStyle( fontSize: 13.0, fontWeight: FontWeight.w500, - color: darkColors.text.withOpacity(0.8), + color: darkColors.text.withValues(alpha: 0.8), )), labelBehavior: NavigationDestinationLabelBehavior.alwaysShow, height: 76.0, ), sliderTheme: SliderThemeData( - inactiveTrackColor: accent.withOpacity(.3), + inactiveTrackColor: accent.withValues(alpha: .3), ), progressIndicatorTheme: ProgressIndicatorThemeData(color: accent), expansionTileTheme: ExpansionTileThemeData(iconColor: accent), cardColor: highlightColor, chipTheme: ChipThemeData( - backgroundColor: accent.withOpacity(.2), + backgroundColor: accent.withValues(alpha: .2), elevation: 1, ), bottomNavigationBarTheme: BottomNavigationBarThemeData( diff --git a/refilc/lib/ui/filter/sort.dart b/refilc/lib/ui/filter/sort.dart index a955ca5..0b255be 100644 --- a/refilc/lib/ui/filter/sort.dart +++ b/refilc/lib/ui/filter/sort.dart @@ -191,7 +191,7 @@ List sortDateWidgets( width: 150.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.0), - color: AppColors.of(context).text.withOpacity(.25), + color: AppColors.of(context).text.withValues(alpha: .25), ), ), ), diff --git a/refilc/lib/ui/filter/widgets.dart b/refilc/lib/ui/filter/widgets.dart index b9bcec1..16953c2 100644 --- a/refilc/lib/ui/filter/widgets.dart +++ b/refilc/lib/ui/filter/widgets.dart @@ -178,8 +178,7 @@ Future> getFilterWidgets(FilterType activeData, // Ads case FilterType.ads: if (adProvider.available) { - items = ad_filter.getWidgets( - adProvider.ads, context); + items = ad_filter.getWidgets(adProvider.ads, context); } break; } @@ -233,8 +232,8 @@ Widget filterItemBuilder( BoxShadow( offset: const Offset(0, 21), blurRadius: 23.0, - color: Theme.of(context).shadowColor.withOpacity( - Theme.of(context).shadowColor.opacity * + color: Theme.of(context).shadowColor.withValues( + alpha: Theme.of(context).shadowColor.opacity * CurvedAnimation( parent: CurvedAnimation( parent: animation, diff --git a/refilc/lib/ui/filter/widgets/certifications.dart b/refilc/lib/ui/filter/widgets/certifications.dart index 78f379c..1fd1f70 100644 --- a/refilc/lib/ui/filter/widgets/certifications.dart +++ b/refilc/lib/ui/filter/widgets/certifications.dart @@ -8,7 +8,9 @@ List getWidgets(List providerGrades) { List items = []; for (var gradeType in GradeType.values) { if ([GradeType.midYear, GradeType.unknown, GradeType.levelExam] - .contains(gradeType)) continue; + .contains(gradeType)) { + continue; + } List grades = providerGrades.where((grade) => grade.type == gradeType).toList(); diff --git a/refilc/lib/ui/filter/widgets/grades.dart b/refilc/lib/ui/filter/widgets/grades.dart index dbb54f7..447f14e 100644 --- a/refilc/lib/ui/filter/widgets/grades.dart +++ b/refilc/lib/ui/filter/widgets/grades.dart @@ -1,12 +1,9 @@ import 'package:refilc/ui/date_widget.dart'; -import 'package:refilc/utils/platform.dart'; import 'package:refilc_kreta_api/models/grade.dart'; import 'package:refilc_mobile_ui/common/widgets/grade/grade_viewable.dart' as mobile; import 'package:refilc_mobile_ui/common/widgets/grade/new_grades.dart' as mobile; -import 'package:refilc_desktop_ui/common/widgets/grade/grade_viewable.dart' - as desktop; List getWidgets( List providerGrades, DateTime? lastSeenDate) { @@ -19,9 +16,7 @@ List getWidgets( items.add(DateWidget( key: grade.id, date: grade.date, - widget: PlatformUtils.isMobile - ? mobile.GradeViewable(grade) - : desktop.GradeViewable(grade), + widget: mobile.GradeViewable(grade), )); } } diff --git a/refilc/lib/ui/flutter_colorpicker/block_picker.dart b/refilc/lib/ui/flutter_colorpicker/block_picker.dart index 8236d31..83cd8f3 100644 --- a/refilc/lib/ui/flutter_colorpicker/block_picker.dart +++ b/refilc/lib/ui/flutter_colorpicker/block_picker.dart @@ -5,7 +5,7 @@ /// Blocky Color Picker -library block_colorpicker; +library; import 'package:flutter/material.dart'; import 'package:refilc/theme/colors/accent.dart'; @@ -73,7 +73,7 @@ Widget _defaultItemBuilder( color: color, boxShadow: [ BoxShadow( - color: color.withOpacity(0.8), + color: color.withValues(alpha: 0.8), offset: const Offset(1, 2), blurRadius: 5) ], diff --git a/refilc/lib/ui/flutter_colorpicker/colorpicker.dart b/refilc/lib/ui/flutter_colorpicker/colorpicker.dart index 58333f9..caa749a 100644 --- a/refilc/lib/ui/flutter_colorpicker/colorpicker.dart +++ b/refilc/lib/ui/flutter_colorpicker/colorpicker.dart @@ -9,7 +9,7 @@ // ignore_for_file: use_build_context_synchronously -library hsv_picker; +library; import 'package:refilc/models/shared_theme.dart'; import 'package:refilc_mobile_ui/common/custom_snack_bar.dart'; @@ -380,7 +380,7 @@ class FilcColorPickerState extends State { fontSize: 16.0, color: AppColors.of(context) .text - .withOpacity(isAdvancedView ? 1.0 : .5), + .withValues(alpha: isAdvancedView ? 1.0 : .5), ), ), ], diff --git a/refilc/lib/ui/flutter_colorpicker/palette.dart b/refilc/lib/ui/flutter_colorpicker/palette.dart index b569b2b..7869fee 100644 --- a/refilc/lib/ui/flutter_colorpicker/palette.dart +++ b/refilc/lib/ui/flutter_colorpicker/palette.dart @@ -210,32 +210,32 @@ class TrackPainter extends CustomPainter { break; case TrackType.red: final List colors = [ - hsvColor.toColor().withRed(0).withOpacity(1.0), - hsvColor.toColor().withRed(255).withOpacity(1.0), + hsvColor.toColor().withRed(0).withValues(alpha: 1.0), + hsvColor.toColor().withRed(255).withValues(alpha: 1.0), ]; Gradient gradient = LinearGradient(colors: colors); canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect)); break; case TrackType.green: final List colors = [ - hsvColor.toColor().withGreen(0).withOpacity(1.0), - hsvColor.toColor().withGreen(255).withOpacity(1.0), + hsvColor.toColor().withGreen(0).withValues(alpha: 1.0), + hsvColor.toColor().withGreen(255).withValues(alpha: 1.0), ]; Gradient gradient = LinearGradient(colors: colors); canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect)); break; case TrackType.blue: final List colors = [ - hsvColor.toColor().withBlue(0).withOpacity(1.0), - hsvColor.toColor().withBlue(255).withOpacity(1.0), + hsvColor.toColor().withBlue(0).withValues(alpha: 1.0), + hsvColor.toColor().withBlue(255).withValues(alpha: 1.0), ]; Gradient gradient = LinearGradient(colors: colors); canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect)); break; case TrackType.alpha: final List colors = [ - hsvColor.toColor().withOpacity(0.0), - hsvColor.toColor().withOpacity(1.0), + hsvColor.toColor().withValues(alpha: 0.0), + hsvColor.toColor().withValues(alpha: 1.0), ]; Gradient gradient = LinearGradient(colors: colors); canvas.drawRect(rect, Paint()..shader = gradient.createShader(rect)); @@ -390,7 +390,7 @@ class ColorPickerInputState extends State { ), contentPadding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 8.0), - fillColor: AppColors.of(context).text.withOpacity(.1), + fillColor: AppColors.of(context).text.withValues(alpha: .1), ), onChanged: (String value) { String input = value; @@ -603,20 +603,20 @@ class ColorPickerSlider extends StatelessWidget { break; case TrackType.red: thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().red / 0xff; - thumbColor = hsvColor.toColor().withOpacity(1.0); + thumbColor = hsvColor.toColor().withValues(alpha: 1.0); break; case TrackType.green: thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().green / 0xff; - thumbColor = hsvColor.toColor().withOpacity(1.0); + thumbColor = hsvColor.toColor().withValues(alpha: 1.0); break; case TrackType.blue: thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().blue / 0xff; - thumbColor = hsvColor.toColor().withOpacity(1.0); + thumbColor = hsvColor.toColor().withValues(alpha: 1.0); break; case TrackType.alpha: thumbOffset += (box.maxWidth - 30.0) * hsvColor.toColor().opacity; - thumbColor = hsvColor.toColor().withOpacity(hsvColor.alpha); + thumbColor = hsvColor.toColor().withValues(alpha: hsvColor.alpha); break; } @@ -709,8 +709,8 @@ class ColorIndicator extends StatelessWidget { boxShadow: [ BoxShadow( color: useWhiteForeground(color) - ? Colors.white.withOpacity(.5) - : Colors.black.withOpacity(.5), + ? Colors.white.withValues(alpha: .5) + : Colors.black.withValues(alpha: .5), offset: const Offset(0, 0), blurRadius: 5) ], diff --git a/refilc/lib/ui/widgets/grade/grade_tile.dart b/refilc/lib/ui/widgets/grade/grade_tile.dart index c86b3db..92d87f4 100644 --- a/refilc/lib/ui/widgets/grade/grade_tile.dart +++ b/refilc/lib/ui/widgets/grade/grade_tile.dart @@ -199,7 +199,7 @@ class GradeTile extends StatelessWidget { : Icon( SubjectIcon.resolveVariant( context: context, subject: grade.subject), - color: AppColors.of(context).text.withOpacity(.5), + color: AppColors.of(context).text.withValues(alpha: .5), ), minLeadingWidth: isSubjectView ? 32.0 : 0, ), @@ -288,7 +288,8 @@ class GradeValueWidget extends StatelessWidget { shadows: [ if (value.weight >= 200) Shadow( - color: (contrast ? Colors.white : color).withOpacity(.4), + color: + (contrast ? Colors.white : color).withValues(alpha: .4), offset: const Offset(-4, -3), ) ], @@ -312,7 +313,7 @@ class GradeValueWidget extends StatelessWidget { width: size * 1.4, height: size * 1.4, decoration: BoxDecoration( - color: color.withOpacity(contrast ? 1.0 : .25), + color: color.withValues(alpha: contrast ? 1.0 : .25), shape: BoxShape.circle, boxShadow: [ if (shadow && diff --git a/refilc/lib/ui/widgets/lesson/lesson_tile.dart b/refilc/lib/ui/widgets/lesson/lesson_tile.dart index b7ab6f1..dcea5eb 100644 --- a/refilc/lib/ui/widgets/lesson/lesson_tile.dart +++ b/refilc/lib/ui/widgets/lesson/lesson_tile.dart @@ -75,7 +75,7 @@ class LessonTile extends StatelessWidget { } if (lesson.isEmpty) { - accent = AppColors.of(context).text.withOpacity(0.6); + accent = AppColors.of(context).text.withValues(alpha: 0.6); } if (!lesson.studentPresence) { @@ -182,9 +182,8 @@ class LessonTile extends StatelessWidget { fontSize: 16.5, color: fill ? accent - : AppColors.of(context) - .text - .withOpacity(!lesson.isEmpty ? 1.0 : 0.5), + : AppColors.of(context).text.withValues( + alpha: !lesson.isEmpty ? 1.0 : 0.5), fontStyle: lesson.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic @@ -199,8 +198,10 @@ class LessonTile extends StatelessWidget { fontWeight: FontWeight.w600, fontSize: 14.0, color: fill - ? accent.withOpacity(.9) - : AppColors.of(context).text.withOpacity(.9), + ? accent.withValues(alpha: .9) + : AppColors.of(context) + .text + .withValues(alpha: .9), ), ), ), @@ -217,7 +218,7 @@ class LessonTile extends StatelessWidget { // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(.15), + // .withValues(alpha: .15), // borderRadius: BorderRadius.circular(10.0), // ), // child: Text( @@ -229,7 +230,7 @@ class LessonTile extends StatelessWidget { // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(.9), + // .withValues(alpha: .9), // ), // ), // ) @@ -246,11 +247,11 @@ class LessonTile extends StatelessWidget { horizontal: 5.5, vertical: 3.0), decoration: BoxDecoration( color: fill - ? accent.withOpacity(.15) + ? accent.withValues(alpha: .15) : Theme.of(context) .colorScheme .tertiary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), child: Text( @@ -261,11 +262,11 @@ class LessonTile extends StatelessWidget { fontSize: 12.0, fontWeight: FontWeight.w600, color: fill - ? accent.withOpacity(0.9) + ? accent.withValues(alpha: 0.9) : Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), @@ -277,7 +278,9 @@ class LessonTile extends StatelessWidget { textAlign: TextAlign.start, style: TextStyle( fontSize: 14.0, - color: fill ? accent.withOpacity(0.5) : null, + color: fill + ? accent.withValues(alpha: 0.5) + : null, ), ), ], @@ -344,7 +347,7 @@ class LessonTile extends StatelessWidget { ? Theme.of(context) .colorScheme .secondary - .withOpacity(.3) + .withValues(alpha: .3) : const Color(0x00000000), borderRadius: BorderRadius.circular(12.0), boxShadow: [ @@ -353,7 +356,7 @@ class LessonTile extends StatelessWidget { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.25), + .withValues(alpha: .25), blurRadius: 6.0, ) ], @@ -386,7 +389,7 @@ class LessonTile extends StatelessWidget { // fontWeight: FontWeight.w500, // color: AppColors.of(context) // .text - // .withOpacity(.75), + // .withValues(alpha: .75), // ), // ), // ), @@ -398,11 +401,11 @@ class LessonTile extends StatelessWidget { horizontal: 6.0, vertical: 3.5), decoration: BoxDecoration( color: fill - ? accent.withOpacity(.15) + ? accent.withValues(alpha: .15) : Theme.of(context) .colorScheme .tertiary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), child: Text( @@ -413,11 +416,11 @@ class LessonTile extends StatelessWidget { fontSize: 12.5, fontWeight: FontWeight.w600, color: fill - ? accent.withOpacity(0.9) + ? accent.withValues(alpha: 0.9) : Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), @@ -438,10 +441,10 @@ class LessonTile extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, color: fill - ? accent.withOpacity(.9) + ? accent.withValues(alpha: .9) : AppColors.of(context) .text - .withOpacity(.9), + .withValues(alpha: .9), ), ), ], @@ -502,8 +505,8 @@ class LessonSubtile extends StatelessWidget { Center( child: SizedBox( width: 30.0, - child: - Icon(icon, color: iconColor.withOpacity(.75), size: 20.0), + child: Icon(icon, + color: iconColor.withValues(alpha: .75), size: 20.0), ), ), Expanded( @@ -515,7 +518,8 @@ class LessonSubtile extends StatelessWidget { overflow: TextOverflow.ellipsis, style: TextStyle( fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(.65)), + color: + AppColors.of(context).text.withValues(alpha: .65)), ), ), ), diff --git a/refilc/lib/ui/widgets/message/message_tile.dart b/refilc/lib/ui/widgets/message/message_tile.dart index 62428f4..affc357 100644 --- a/refilc/lib/ui/widgets/message/message_tile.dart +++ b/refilc/lib/ui/widgets/message/message_tile.dart @@ -58,7 +58,8 @@ class MessageTile extends StatelessWidget { width: 105, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.85), + color: + AppColors.of(context).text.withValues(alpha: .85), borderRadius: BorderRadius.circular(8.0), ), ), @@ -89,7 +90,8 @@ class MessageTile extends StatelessWidget { width: 150, height: 10, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: + AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ), @@ -109,7 +111,8 @@ class MessageTile extends StatelessWidget { width: 35, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: + AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ), @@ -120,7 +123,7 @@ class MessageTile extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14.0, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), ), ), diff --git a/refilc/lib/utils/format.dart b/refilc/lib/utils/format.dart index ac69d8c..a88684b 100644 --- a/refilc/lib/utils/format.dart +++ b/refilc/lib/utils/format.dart @@ -58,7 +58,9 @@ extension DateFormatUtils on DateTime { } if (now.year == year && now.month == month && - now.add(const Duration(days: 1)).day == day) return "Tomorrow".i18n; + now.add(const Duration(days: 1)).day == day) { + return "Tomorrow".i18n; + } String formatString; diff --git a/refilc/pubspec.yaml b/refilc/pubspec.yaml index 0797927..f0d15c9 100644 --- a/refilc/pubspec.yaml +++ b/refilc/pubspec.yaml @@ -3,10 +3,10 @@ description: "Egy nem hivatalos e-KRÉTA kliens, diákoktól diákoknak." homepage: https://refilc.hu publish_to: "none" -version: 5.0.6+277 +version: 5.1.1+283 environment: - sdk: ">=3.3.2 <=3.6.0" + sdk: ^3.6.0 dependencies: flutter: @@ -16,8 +16,8 @@ dependencies: # reFilc packages refilc_mobile_ui: path: "../refilc_mobile_ui/" - refilc_desktop_ui: - path: "../refilc_desktop_ui/" + # refilc_desktop_ui: + # path: "../refilc_desktop_ui/" refilc_kreta_api: path: "../refilc_kreta_api/" refilc_plus: @@ -33,10 +33,6 @@ dependencies: uuid: ^4.2.1 html: ^0.15.0 open_filex: ^4.3.4 - # open_file: - # git: - # url: https://github.com/crazecoder/open_file - # ref: master path_provider: ^2.0.2 permission_handler: ^11.0.1 share_plus: ^10.0.3 @@ -55,17 +51,9 @@ dependencies: rive: ^0.12.4 animated_background: ^2.0.0 dropdown_button2: ^2.3.9 - home_widget: - git: - url: https://github.com/refilc/home_widget.git - ref: flutter-beta + home_widget: ^0.7.0+1 flutter_expandable_fab: ^2.0.0 - uni_links: ^0.5.1 url_launcher: ^6.1.6 - # workmanager: - # git: - # url: https://github.com/refilc/flutter_workmanager.git - # ref: v0.5.1 flutter_svg: ^2.0.10+1 image_picker: ^1.0.7 animations: ^2.0.1 @@ -74,16 +62,12 @@ dependencies: package_info_plus: ^8.0.0 screenshot: ^3.0.0 flutter_staggered_grid_view: ^0.7.0 - sqflite_common_ffi_web: ^0.4.0 - image_crop: - git: - url: https://github.com/kimaah/image_crop.git + image_crop_plus: ^1.0.0 googleapis: ^13.2.0 google_sign_in: ^6.2.1 extension_google_sign_in_as_googleapis_auth: ^2.0.12 - maps_launcher: ^2.2.0 + maps_launcher: ^3.0.0+1 google_fonts: ^6.1.0 - # flutter_stripe: ^11.3.0 get_it: ^7.6.7 xml: ^6.5.0 carousel_slider: ^5.0.0 @@ -96,6 +80,9 @@ dev_dependencies: flutter_native_splash: "^2.3.10" sqflite_common_ffi: ^2.0.0+3 +dependency_overrides: + webview_flutter_wkwebview: 3.17.0 + flutter: uses-material-design: true diff --git a/refilc_desktop_ui/LICENSE b/refilc_desktop_ui/LICENSE deleted file mode 100644 index f288702..0000000 --- a/refilc_desktop_ui/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/refilc_desktop_ui/README.md b/refilc_desktop_ui/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/refilc_desktop_ui/analysis_options.yaml b/refilc_desktop_ui/analysis_options.yaml deleted file mode 100644 index fd16f92..0000000 --- a/refilc_desktop_ui/analysis_options.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml - -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options diff --git a/refilc_desktop_ui/lib/common/filter_bar.dart b/refilc_desktop_ui/lib/common/filter_bar.dart deleted file mode 100644 index 790f9e9..0000000 --- a/refilc_desktop_ui/lib/common/filter_bar.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:refilc/theme/colors/colors.dart'; -import 'package:flutter/material.dart'; - -class FilterBar extends StatelessWidget implements PreferredSizeWidget { - const FilterBar({ - super.key, - required this.items, - required this.controller, - this.onTap, - this.padding = const EdgeInsets.symmetric(horizontal: 24.0), - this.disableFading = false, - this.scrollable = true, - }) : assert(items.length == controller.length); - - final List items; - final TabController controller; - final EdgeInsetsGeometry padding; - final Function(int)? onTap; - @override - final Size preferredSize = const Size.fromHeight(42.0); - final bool disableFading; - final bool scrollable; - - @override - Widget build(BuildContext context) { - final tabbar = TabBar( - controller: controller, - isScrollable: scrollable, - physics: const BouncingScrollPhysics(), - // Label - labelStyle: Theme.of(context).textTheme.titleMedium!.copyWith( - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - labelPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3), - labelColor: Theme.of(context).colorScheme.secondary, - unselectedLabelColor: AppColors.of(context).text.withOpacity(0.65), - // Indicator - indicatorPadding: const EdgeInsets.symmetric(vertical: 8), - indicator: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.25), - borderRadius: BorderRadius.circular(45.0), - ), - overlayColor: WidgetStateProperty.all(const Color(0x00000000)), - // Tabs - padding: EdgeInsets.zero, - tabs: items, - onTap: onTap, - ); - - return Container( - width: MediaQuery.of(context).size.width, - height: 48.0, - padding: padding, - child: disableFading - ? tabbar - : AnimatedBuilder( - animation: controller.animation!, - builder: (ctx, child) { - // avoid fading over selected tab - return ShaderMask( - shaderCallback: (Rect bounds) { - final Color bg = - Theme.of(context).scaffoldBackgroundColor; - final double index = controller.animation!.value; - return LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - index < 0.2 ? Colors.transparent : bg, - Colors.transparent, - Colors.transparent, - index > controller.length - 1.2 - ? Colors.transparent - : bg - ], - stops: const [ - 0, - 0.1, - 0.9, - 1 - ]).createShader(bounds); - }, - blendMode: BlendMode.dstOut, - child: child); - }, - child: tabbar, - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/common/panel_button.dart b/refilc_desktop_ui/lib/common/panel_button.dart deleted file mode 100644 index 4f68917..0000000 --- a/refilc_desktop_ui/lib/common/panel_button.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'package:refilc/theme/colors/colors.dart'; -import 'package:flutter/material.dart'; - -class PanelButton extends StatelessWidget { - const PanelButton({ - super.key, - this.onPressed, - this.padding = const EdgeInsets.symmetric(horizontal: 14.0), - this.leading, - this.title, - this.trailing, - this.trailingDivider = false, - }); - - final void Function()? onPressed; - final EdgeInsetsGeometry padding; - final Widget? leading; - final Widget? title; - final Widget? trailing; - final bool trailingDivider; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: RawMaterialButton( - onPressed: onPressed, - padding: padding, - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), - child: ListTile( - leading: leading != null - ? Theme( - data: Theme.of(context).copyWith( - iconTheme: IconThemeData( - color: Theme.of(context).colorScheme.secondary)), - child: leading!, - ) - : null, - trailing: trailingDivider - ? Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: const EdgeInsets.only(right: 6.0), - width: 2.0, - height: 32.0, - decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.15), - borderRadius: BorderRadius.circular(45.0), - ), - ), - if (trailing != null) trailing!, - ], - ) - : trailing, - title: title != null - ? DefaultTextStyle( - style: Theme.of(context) - .textTheme - .titleMedium! - .copyWith(fontWeight: FontWeight.w600, fontSize: 14.0), - child: title!, - ) - : null, - contentPadding: EdgeInsets.zero, - visualDensity: VisualDensity.compact, - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/common/profile_image.dart b/refilc_desktop_ui/lib/common/profile_image.dart deleted file mode 100644 index 15c3215..0000000 --- a/refilc_desktop_ui/lib/common/profile_image.dart +++ /dev/null @@ -1,78 +0,0 @@ -import 'package:refilc/models/user.dart'; -import 'package:refilc/utils/color.dart'; -import 'package:flutter/material.dart'; -import 'package:refilc/theme/colors/colors.dart'; - -class ProfileImage extends StatelessWidget { - const ProfileImage({ - super.key, - this.name, - this.radius = 20.0, - this.role = Role.student, - this.backgroundColor, - }); - - final String? name; - final double radius; - final Role? role; - final Color? backgroundColor; - - @override - Widget build(BuildContext context) { - Color color = ColorUtils.foregroundColor( - backgroundColor ?? Theme.of(context).scaffoldBackgroundColor); - Color roleColor; - - if (Theme.of(context).brightness == Brightness.light) { - roleColor = const Color(0xFF444444); - } else { - roleColor = const Color(0xFF555555); - } - - return Stack( - alignment: Alignment.center, - children: [ - Material( - clipBehavior: Clip.hardEdge, - shape: const CircleBorder(), - color: backgroundColor ?? AppColors.of(context).text.withOpacity(.15), - child: InkWell( - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - height: radius * 2, - width: radius * 2, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: name != null && (name?.trim().length ?? 0) > 0 - ? Center( - child: Text( - (name?.trim().length ?? 0) > 0 - ? (name ?? "?").trim()[0] - : "?", - style: TextStyle( - color: color, - fontWeight: FontWeight.w600, - fontSize: 18.0 * (radius / 20.0), - ), - ), - ) - : Container(), - ), - ), - ), - - // Role indicator - if (role == Role.parent) - SizedBox( - height: radius * 2, - width: radius * 2, - child: Container( - alignment: Alignment.bottomRight, - child: Icon(Icons.shield, color: roleColor, size: radius / 1.3), - ), - ), - ], - ); - } -} diff --git a/refilc_desktop_ui/lib/common/widgets/grade/grade_viewable.dart b/refilc_desktop_ui/lib/common/widgets/grade/grade_viewable.dart deleted file mode 100644 index 3f9fdbd..0000000 --- a/refilc_desktop_ui/lib/common/widgets/grade/grade_viewable.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:refilc/ui/widgets/grade/grade_tile.dart'; - -class GradeViewable extends StatelessWidget { - const GradeViewable(this.grade, {super.key}); - - final Grade grade; - - @override - Widget build(BuildContext context) { - return GradeTile(grade); - } -} diff --git a/refilc_desktop_ui/lib/common/widgets/lesson/lesson_viewable.dart b/refilc_desktop_ui/lib/common/widgets/lesson/lesson_viewable.dart deleted file mode 100644 index 2ce76cb..0000000 --- a/refilc_desktop_ui/lib/common/widgets/lesson/lesson_viewable.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:refilc_kreta_api/models/lesson.dart'; -import 'package:refilc/ui/widgets/lesson/lesson_tile.dart'; -import 'package:flutter/material.dart'; - -class LessonViewable extends StatelessWidget { - const LessonViewable(this.lesson, {super.key, this.swapDesc = false}); - - final Lesson lesson; - final bool swapDesc; - - @override - Widget build(BuildContext context) { - final tile = LessonTile(lesson, swapDesc: swapDesc); - - if (lesson.subject.id == '' || tile.lesson.isEmpty) return tile; - - return tile; - } -} diff --git a/refilc_desktop_ui/lib/pages/absences/absences_page.dart b/refilc_desktop_ui/lib/pages/absences/absences_page.dart deleted file mode 100644 index 33e0906..0000000 --- a/refilc_desktop_ui/lib/pages/absences/absences_page.dart +++ /dev/null @@ -1,408 +0,0 @@ -import 'dart:math'; - -import 'package:animations/animations.dart'; -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:refilc/api/providers/update_provider.dart'; -import 'package:refilc/ui/date_widget.dart'; -import 'package:refilc_kreta_api/models/absence.dart'; -import 'package:refilc_kreta_api/models/lesson.dart'; -import 'package:refilc_kreta_api/models/subject.dart'; -import 'package:refilc_kreta_api/models/week.dart'; -import 'package:refilc_kreta_api/providers/absence_provider.dart'; -import 'package:refilc_kreta_api/providers/note_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc_kreta_api/providers/timetable_provider.dart'; -import 'package:refilc_mobile_ui/common/action_button.dart'; -import 'package:refilc_mobile_ui/common/empty.dart'; -import 'package:refilc_mobile_ui/common/filter_bar.dart'; -import 'package:refilc_mobile_ui/common/panel/panel.dart'; -import 'package:refilc_mobile_ui/common/widgets/absence/absence_subject_tile.dart'; -import 'package:refilc_mobile_ui/common/widgets/absence/absence_viewable.dart'; -import 'package:refilc_mobile_ui/common/widgets/statistics_tile.dart'; -import 'package:refilc_mobile_ui/common/widgets/miss_tile.dart'; -import 'package:refilc_mobile_ui/pages/absences/absence_subject_view.dart'; -import 'package:refilc/ui/filter/sort.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:provider/provider.dart'; -import 'absences_page.i18n.dart'; - -enum AbsenceFilter { absences, delays, misses } - -class SubjectAbsence { - GradeSubject subject; - List absences; - double percentage; - - SubjectAbsence( - {required this.subject, this.absences = const [], this.percentage = 0.0}); -} - -class AbsencesPage extends StatefulWidget { - const AbsencesPage({super.key}); - - @override - AbsencesPageState createState() => AbsencesPageState(); -} - -class AbsencesPageState extends State - with TickerProviderStateMixin { - late UserProvider user; - late AbsenceProvider absenceProvider; - late TimetableProvider timetableProvider; - late NoteProvider noteProvider; - late UpdateProvider updateProvider; - late String firstName; - late TabController _tabController; - late List absences = []; - final Map _lessonCount = {}; - - @override - void initState() { - super.initState(); - - _tabController = TabController(length: 3, vsync: this); - timetableProvider = Provider.of(context, listen: false); - - WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { - for (final lesson in timetableProvider.getWeek(Week.current()) ?? []) { - if (!lesson.isEmpty && - lesson.subject.id != '' && - lesson.lessonYearIndex != null) { - _lessonCount.update( - lesson.subject, - (value) { - if (lesson.lessonYearIndex! > value.lessonYearIndex!) { - return lesson; - } else { - return value; - } - }, - ifAbsent: () => lesson, - ); - } - } - }); - } - - void buildSubjectAbsences() { - // ignore: no_leading_underscores_for_local_identifiers - Map _absences = {}; - - for (final absence in absenceProvider.absences) { - if (absence.delay != 0) continue; - - if (!_absences.containsKey(absence.subject)) { - _absences[absence.subject] = - SubjectAbsence(subject: absence.subject, absences: [absence]); - } else { - _absences[absence.subject]?.absences.add(absence); - } - } - - _absences.forEach((subject, absence) { - final absentLessonsOfSubject = absenceProvider.absences - .where((e) => e.subject == subject && e.delay == 0) - .length; - final totalLessonsOfSubject = _lessonCount[subject]?.lessonYearIndex ?? 0; - - double absentLessonsOfSubjectPercentage; - - if (absentLessonsOfSubject <= totalLessonsOfSubject) { - absentLessonsOfSubjectPercentage = - absentLessonsOfSubject / totalLessonsOfSubject * 100; - } else { - absentLessonsOfSubjectPercentage = -1; - } - - _absences[subject]?.percentage = - absentLessonsOfSubjectPercentage.clamp(-1, 100.0); - }); - - absences = _absences.values.toList(); - absences.sort((a, b) => -a.percentage.compareTo(b.percentage)); - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - absenceProvider = Provider.of(context); - noteProvider = Provider.of(context); - updateProvider = Provider.of(context); - timetableProvider = Provider.of(context); - - List nameParts = user.displayName?.split(" ") ?? ["?"]; - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - - buildSubjectAbsences(); - - return Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 12.0), - child: NestedScrollView( - physics: const BouncingScrollPhysics( - parent: AlwaysScrollableScrollPhysics()), - headerSliverBuilder: (context, _) => [ - SliverAppBar( - pinned: true, - floating: false, - snap: false, - centerTitle: false, - automaticallyImplyLeading: false, - shadowColor: Theme.of(context).shadowColor, - surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, - title: Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Text( - "Absences".i18n, - style: TextStyle( - color: AppColors.of(context).text, - fontSize: 32.0, - fontWeight: FontWeight.bold), - ), - ), - bottom: FilterBar(items: [ - Tab(text: "Absences".i18n), - Tab(text: "Delays".i18n), - Tab(text: "Misses".i18n), - ], controller: _tabController, disableFading: true), - ), - ], - body: TabBarView( - physics: const BouncingScrollPhysics(), - controller: _tabController, - children: List.generate( - 3, (index) => filterViewBuilder(context, index))), - ), - ), - ); - } - - List getFilterWidgets(AbsenceFilter activeData) { - List items = []; - switch (activeData) { - case AbsenceFilter.absences: - for (var a in absences) { - items.add(DateWidget( - date: DateTime.fromMillisecondsSinceEpoch(0), - widget: AbsenceSubjectTile( - a.subject, - percentage: a.percentage, - excused: a.absences - .where((a) => a.state == Justification.excused) - .length, - unexcused: a.absences - .where((a) => a.state == Justification.unexcused) - .length, - pending: a.absences - .where((a) => a.state == Justification.pending) - .length, - onTap: () => AbsenceSubjectView.show(a.subject, a.absences, - context: context), - ), - )); - } - break; - case AbsenceFilter.delays: - for (var absence in absenceProvider.absences) { - if (absence.delay != 0) { - items.add(DateWidget( - date: absence.date, - widget: AbsenceViewable( - absence, - padding: EdgeInsets.zero, - ))); - } - } - break; - case AbsenceFilter.misses: - for (var note in noteProvider.notes) { - if (note.type?.name == "HaziFeladatHiany" || - note.type?.name == "Felszereleshiany") { - items.add(DateWidget( - date: note.date, - widget: MissTile(note), - )); - } - } - break; - } - return items; - } - - Widget filterViewBuilder(context, int activeData) { - List filterWidgets = []; - - if (activeData > 0) { - filterWidgets = sortDateWidgets( - context, - dateWidgets: getFilterWidgets(AbsenceFilter.values[activeData]), - padding: EdgeInsets.zero, - hasShadow: true, - ); - } else { - filterWidgets = [ - Padding( - padding: const EdgeInsets.only(bottom: 24.0), - child: Panel( - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("Subjects".i18n), - Padding( - padding: const EdgeInsets.only(right: 4.0), - child: IconButton( - onPressed: () { - showDialog( - context: context, - builder: (context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12.0)), - title: Text("attention".i18n), - content: Text("attention_body".i18n), - actions: [ - ActionButton( - label: "Ok", - onTap: () => Navigator.of(context).pop()) - ], - ), - ); - }, - padding: EdgeInsets.zero, - splashRadius: 24.0, - visualDensity: VisualDensity.compact, - constraints: BoxConstraints.tight(const Size(42.0, 42.0)), - icon: const Icon(FeatherIcons.info), - ), - ), - ], - ), - child: PageTransitionSwitcher( - transitionBuilder: ( - Widget child, - Animation primaryAnimation, - Animation secondaryAnimation, - ) { - return FadeThroughTransition( - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - fillColor: Theme.of(context).colorScheme.surface, - child: child, - ); - }, - child: Column( - children: getFilterWidgets(AbsenceFilter.values[activeData]) - .map((e) => e.widget) - .cast() - .toList(), - ), - ), - ), - ) - ]; - } - - return Padding( - padding: const EdgeInsets.only(top: 12.0), - child: RefreshIndicator( - color: Theme.of(context).colorScheme.secondary, - onRefresh: () async { - await absenceProvider.fetch(); - await noteProvider.fetch(); - }, - child: ListView.builder( - padding: EdgeInsets.zero, - physics: const BouncingScrollPhysics(), - itemCount: max(filterWidgets.length + (activeData <= 1 ? 1 : 0), 1), - itemBuilder: (context, index) { - if (filterWidgets.isNotEmpty) { - if ((index == 0 && activeData == 1) || - (index == 0 && activeData == 0)) { - int value1 = 0; - int value2 = 0; - String title1 = ""; - String title2 = ""; - String suffix = ""; - - if (activeData == AbsenceFilter.absences.index) { - value1 = absenceProvider.absences - .where((e) => - e.delay == 0 && e.state == Justification.excused) - .length; - value2 = absenceProvider.absences - .where((e) => - e.delay == 0 && e.state == Justification.unexcused) - .length; - title1 = "stat_1".i18n; - title2 = "stat_2".i18n; - suffix = " ${"hr".i18n}"; - } else if (activeData == AbsenceFilter.delays.index) { - value1 = absenceProvider.absences - .where((e) => - e.delay != 0 && e.state == Justification.excused) - .map((e) => e.delay) - .fold(0, (a, b) => a + b); - value2 = absenceProvider.absences - .where((e) => - e.delay != 0 && e.state == Justification.unexcused) - .map((e) => e.delay) - .fold(0, (a, b) => a + b); - title1 = "stat_3".i18n; - title2 = "stat_4".i18n; - suffix = " ${"min".i18n}"; - } - - return Padding( - padding: const EdgeInsets.only( - bottom: 24.0, left: 24.0, right: 24.0), - child: Row(children: [ - Expanded( - child: StatisticsTile( - title: AutoSizeText( - title1, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - valueSuffix: suffix, - value: value1.toDouble(), - decimal: false, - color: AppColors.of(context).green, - ), - ), - const SizedBox(width: 24.0), - Expanded( - child: StatisticsTile( - title: AutoSizeText( - title2, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - valueSuffix: suffix, - value: value2.toDouble(), - decimal: false, - color: AppColors.of(context).red, - ), - ), - ]), - ); - } - - return Padding( - padding: - const EdgeInsets.symmetric(horizontal: 24.0, vertical: 6.0), - child: filterWidgets[index - (activeData <= 1 ? 1 : 0)], - ); - } else { - return activeData == 1 - ? Empty(subtitle: "emptyDelays".i18n) - : Empty(subtitle: "emptyMisses".i18n); - } - }, - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/absences/absences_page.i18n.dart b/refilc_desktop_ui/lib/pages/absences/absences_page.i18n.dart deleted file mode 100644 index 9984034..0000000 --- a/refilc_desktop_ui/lib/pages/absences/absences_page.i18n.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension ScreensLocalization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "Absences": "Absences", - "Delays": "Delays", - "Misses": "Misses", - "emptyDelays": "You have no delays.", - "emptyMisses": "You have no missing homeworks or equipments.", - "stat_1": "Excused Absences", - "stat_2": "Unexcused Absences", - "stat_3": "Excused Delay", - "stat_4": "Unexcused Delay", - "min": "min", - "hr": "hrs", - "Subjects": "Subjects", - "attention": "Attention!", - "attention_body": "Percentage calculations are only an approximation so they may not be accurate.", - }, - "hu_hu": { - "Absences": "Hiányzások", - "Delays": "Késések", - "Misses": "Hiányok", - "emptyDelays": "Nincsenek késéseid.", - "emptyMisses": "Nincsenek hiányzó házi feladataid, felszereléseid.", - "stat_1": "Igazolt hiányzások", - "stat_2": "Igazolatlan hiányzások", - "stat_3": "Igazolt Késés", - "stat_4": "Igazolatlan Késés", - "min": "perc", - "hr": "óra", - "Subjects": "Tantárgyak", - "attention": "Figyelem!", - "attention_body": "A százalékos számítások csak közelítések, ezért előfordulhat, hogy nem pontosak.", - }, - "de_de": { - "Absences": "Fehlen", - "Delays": "Verspätung", - "Misses": "Fehlt", - "emptyDelays": "Sie haben keine Abwesenheiten.", - "emptyMisses": "Sie haben noch keine fehlende Hausaufgaben oder Austattung.", - "stat_1": "Entschuldigte Fehlen", - "stat_2": "Unentschuldigte Fehlen", - "stat_3": "Entschuldigte Verspätung", - "stat_4": "Unentschuldigte Verspätung", - "min": "min", - "hr": "hrs", - "Subjects": "Fächer", - "attention": "Achtung!", - "attention_body": "Prozentberechnungen sind nur eine Annäherung und können daher ungenau sein.", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/pages/grades/grade_subject_view.dart b/refilc_desktop_ui/lib/pages/grades/grade_subject_view.dart deleted file mode 100644 index 2b417c0..0000000 --- a/refilc_desktop_ui/lib/pages/grades/grade_subject_view.dart +++ /dev/null @@ -1,296 +0,0 @@ -import 'dart:math'; - -import 'package:animations/animations.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/utils/format.dart'; -import 'package:refilc_kreta_api/providers/grade_provider.dart'; -import 'package:refilc/helpers/average_helper.dart'; -import 'package:refilc/helpers/subject.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:refilc_kreta_api/models/subject.dart'; -import 'package:refilc_mobile_ui/common/average_display.dart'; -import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart'; -import 'package:refilc_mobile_ui/common/panel/panel.dart'; -import 'package:refilc_mobile_ui/common/trend_display.dart'; -import 'package:refilc_mobile_ui/common/widgets/cretification/certification_tile.dart'; -import 'package:refilc/ui/widgets/grade/grade_tile.dart'; -import 'package:refilc_mobile_ui/common/widgets/grade/grade_viewable.dart'; -import 'package:refilc_mobile_ui/common/hero_scrollview.dart'; -import 'package:refilc_mobile_ui/pages/grades/calculator/grade_calculator.dart'; -import 'package:refilc_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart'; -import 'package:refilc_desktop_ui/pages/grades/grades_count.dart'; -import 'package:refilc_mobile_ui/pages/grades/graph.dart'; -import 'package:refilc_mobile_ui/pages/grades/subject_grades_container.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_expandable_fab/flutter_expandable_fab.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:provider/provider.dart'; -import 'grades_page.i18n.dart'; -//import 'package:refilc_plus/ui/mobile/goal_planner/new_goal.dart'; - -class GradeSubjectView extends StatefulWidget { - const GradeSubjectView(this.subject, {super.key, this.groupAverage = 0.0}); - - final GradeSubject subject; - final double groupAverage; - - void push(BuildContext context, {bool root = false}) { - Navigator.of(context, rootNavigator: root) - .push(CupertinoPageRoute(builder: (context) => this)); - } - - @override - State createState() => _GradeSubjectViewState(); -} - -class _GradeSubjectViewState extends State { - final GlobalKey _scaffoldKey = GlobalKey(); - - // Controllers - PersistentBottomSheetController? _sheetController; - final ScrollController _scrollController = ScrollController(); - - List gradeTiles = []; - - // Providers - late GradeProvider gradeProvider; - late GradeCalculatorProvider calculatorProvider; - late SettingsProvider settingsProvider; - - late double average; - late Widget gradeGraph; - - bool gradeCalcMode = false; - - List getSubjectGrades(GradeSubject subject) => !gradeCalcMode - ? gradeProvider.grades.where((e) => e.subject == subject).toList() - : calculatorProvider.grades.where((e) => e.subject == subject).toList(); - - bool showGraph(List subjectGrades) { - if (gradeCalcMode) return true; - - final gradeDates = subjectGrades.map((e) => e.date.millisecondsSinceEpoch); - final maxGradeDate = gradeDates.fold(0, max); - final minGradeDate = gradeDates.fold(0, min); - if (maxGradeDate - minGradeDate < const Duration(days: 5).inMilliseconds) { - return false; // naplo/#78 - } - - return subjectGrades.where((e) => e.type == GradeType.midYear).length > 1; - } - - void buildTiles(List subjectGrades) { - List tiles = []; - - if (showGraph(subjectGrades)) { - tiles.add(gradeGraph); - } else { - tiles.add(Container(height: 24.0)); - } - - // ignore: no_leading_underscores_for_local_identifiers - List _gradeTiles = []; - - if (!gradeCalcMode) { - subjectGrades.sort((a, b) => -a.date.compareTo(b.date)); - for (var grade in subjectGrades) { - if (grade.type == GradeType.midYear) { - _gradeTiles.add(GradeViewable(grade)); - } else { - _gradeTiles.add(CertificationTile(grade, padding: EdgeInsets.zero)); - } - } - } else if (subjectGrades.isNotEmpty) { - subjectGrades.sort((a, b) => -a.date.compareTo(b.date)); - for (var grade in subjectGrades) { - _gradeTiles.add(GradeTile(grade)); - } - } - tiles.add( - PageTransitionSwitcher( - transitionBuilder: ( - Widget child, - Animation primaryAnimation, - Animation secondaryAnimation, - ) { - return SharedAxisTransition( - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - transitionType: SharedAxisTransitionType.vertical, - fillColor: Colors.transparent, - child: child, - ); - }, - child: _gradeTiles.isNotEmpty - ? Panel( - key: ValueKey(gradeCalcMode), - title: Text( - gradeCalcMode ? "Ghost Grades".i18n : "Grades".i18n, - ), - child: Column( - children: _gradeTiles, - )) - : const SizedBox(), - ), - ); - - tiles.add(Padding( - padding: EdgeInsets.only(bottom: !gradeCalcMode ? 24.0 : 250.0))); - gradeTiles = List.castFrom(tiles); - } - - @override - Widget build(BuildContext context) { - gradeProvider = Provider.of(context); - calculatorProvider = Provider.of(context); - settingsProvider = Provider.of(context); - - List subjectGrades = getSubjectGrades(widget.subject).toList(); - average = AverageHelper.averageEvals(subjectGrades); - final prevAvg = subjectGrades.isNotEmpty - ? AverageHelper.averageEvals(subjectGrades - .where((e) => e.date.isBefore(subjectGrades - .reduce((v, e) => e.date.isAfter(v.date) ? e : v) - .date - .subtract(const Duration(days: 30)))) - .toList()) - : 0.0; - - gradeGraph = Padding( - padding: const EdgeInsets.only(top: 16.0, bottom: 8.0), - child: Panel( - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("annual_average".i18n), - if (average != prevAvg) - TrendDisplay(current: average, previous: prevAvg), - ], - ), - child: Container( - padding: const EdgeInsets.only(top: 12.0, right: 12.0), - child: Row( - children: [ - Expanded( - child: GradeGraph(subjectGrades, - dayThreshold: 5, classAvg: widget.groupAverage)), - Padding( - padding: const EdgeInsets.only(bottom: 24.0), - child: GradesCount(grades: subjectGrades), - ), - ], - ), - ), - ), - ); - - if (!gradeCalcMode) { - buildTiles(subjectGrades); - } else { - List ghostGrades = calculatorProvider.ghosts - .where((e) => e.subject == widget.subject) - .toList(); - buildTiles(ghostGrades); - } - - return Scaffold( - key: _scaffoldKey, - floatingActionButtonLocation: ExpandableFab.location, - floatingActionButton: Visibility( - visible: !gradeCalcMode && - subjectGrades - .where((e) => e.type == GradeType.midYear) - .isNotEmpty, - child: ExpandableFab( - type: ExpandableFabType.up, - distance: 50, - children: [ - FloatingActionButton.small( - child: const Icon(FeatherIcons.plus), - onPressed: () { - gradeCalc(context); - }, - ), - // FloatingActionButton.small( - // child: const Icon(FeatherIcons.flag, size: 20.0), - // onPressed: () { - // Navigator.of(context).push(CupertinoPageRoute(builder: (context) => PremiumGoalplannerNewGoalScreen(subject: widget.subject))); - // }, - // ), - ], - ), - ), - body: RefreshIndicator( - onRefresh: () async {}, - color: Theme.of(context).colorScheme.secondary, - child: HeroScrollView( - onClose: () { - if (_sheetController != null && gradeCalcMode) { - _sheetController!.close(); - } else { - Navigator.of(context).pop(); - } - }, - navBarItems: [ - const SizedBox(width: 6.0), - if (widget.groupAverage != 0) - Center( - child: AverageDisplay( - average: widget.groupAverage, border: true)), - const SizedBox(width: 6.0), - if (average != 0) - Center(child: AverageDisplay(average: average)), - const SizedBox(width: 12.0), - ], - icon: SubjectIcon.resolveVariant( - subject: widget.subject, context: context), - scrollController: _scrollController, - title: widget.subject.renamedTo ?? widget.subject.name.capital(), - italic: widget.subject.isRenamed && - settingsProvider.renamedSubjectsItalics, - child: SubjectGradesContainer( - child: CupertinoScrollbar( - child: ListView.builder( - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.symmetric(horizontal: 24.0), - shrinkWrap: true, - itemBuilder: (context, index) => gradeTiles[index], - itemCount: gradeTiles.length, - ), - ), - )), - )); - } - - void gradeCalc(BuildContext context) { - // Scroll to the top of the page - _scrollController.animateTo(75, - duration: const Duration(milliseconds: 500), curve: Curves.ease); - - calculatorProvider.clear(); - calculatorProvider.addAllGrades(gradeProvider.grades); - - _sheetController = _scaffoldKey.currentState?.showBottomSheet( - (context) => RoundedBottomSheet( - borderRadius: 14.0, - child: GradeCalculator(widget.subject)), - backgroundColor: const Color(0x00000000), - elevation: 12.0, - ); - - // Hide the fab and grades - setState(() { - gradeCalcMode = true; - }); - - _sheetController!.closed.then((value) { - // Show fab and grades - if (mounted) { - setState(() { - gradeCalcMode = false; - }); - } - }); - } -} diff --git a/refilc_desktop_ui/lib/pages/grades/grades_count.dart b/refilc_desktop_ui/lib/pages/grades/grades_count.dart deleted file mode 100644 index 104f70d..0000000 --- a/refilc_desktop_ui/lib/pages/grades/grades_count.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:refilc_desktop_ui/pages/grades/grades_count_item.dart'; -import 'package:collection/collection.dart'; - -class GradesCount extends StatelessWidget { - const GradesCount({super.key, required this.grades}); - - final List grades; - - @override - Widget build(BuildContext context) { - List gradesCount = List.generate(5, - (int index) => grades.where((e) => e.value.value == index + 1).length); - - return Container( - width: 75, - padding: - const EdgeInsets.only(bottom: 6.0, top: 6.0, left: 12.0, right: 0.0), - margin: const EdgeInsets.symmetric(horizontal: 12.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: gradesCount - .mapIndexed( - (index, e) => GradesCountItem(count: e, value: index + 1)) - .toList(), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/grades/grades_count_item.dart b/refilc_desktop_ui/lib/pages/grades/grades_count_item.dart deleted file mode 100644 index 0bd99c2..0000000 --- a/refilc_desktop_ui/lib/pages/grades/grades_count_item.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:refilc/ui/widgets/grade/grade_tile.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:flutter/material.dart'; - -class GradesCountItem extends StatelessWidget { - const GradesCountItem({super.key, required this.count, required this.value}); - - final int count; - final int value; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text.rich( - TextSpan(children: [ - TextSpan( - text: count.toString(), - style: const TextStyle(fontWeight: FontWeight.w600), - ), - const TextSpan( - text: "x", - style: TextStyle(fontSize: 13.0), - ), - ]), - style: const TextStyle(fontSize: 15.0), - ), - const SizedBox(width: 5.0), - GradeValueWidget(GradeValue(value, "Value", "Value", 100), - size: 19.0, fill: true, shadow: false), - ], - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/grades/grades_page.dart b/refilc_desktop_ui/lib/pages/grades/grades_page.dart deleted file mode 100644 index 24c9ec2..0000000 --- a/refilc_desktop_ui/lib/pages/grades/grades_page.dart +++ /dev/null @@ -1,314 +0,0 @@ -import 'dart:math'; - -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:refilc/api/providers/update_provider.dart'; -import 'package:refilc_kreta_api/providers/grade_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc_kreta_api/models/grade.dart'; -import 'package:refilc_kreta_api/models/subject.dart'; -import 'package:refilc_kreta_api/models/group_average.dart'; -import 'package:refilc_mobile_ui/common/average_display.dart'; -import 'package:refilc_mobile_ui/common/empty.dart'; -import 'package:refilc_mobile_ui/common/panel/panel.dart'; -import 'package:refilc_mobile_ui/common/widgets/statistics_tile.dart'; -import 'package:refilc_mobile_ui/common/widgets/grade/grade_subject_tile.dart'; -import 'package:refilc_mobile_ui/common/trend_display.dart'; -import 'package:refilc_mobile_ui/pages/grades/fail_warning.dart'; -import 'package:refilc_desktop_ui/pages/grades/grades_count.dart'; -import 'package:refilc_mobile_ui/pages/grades/graph.dart'; -import 'package:refilc_desktop_ui/pages/grades/grade_subject_view.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc/helpers/average_helper.dart'; -import 'package:refilc_mobile_ui/pages/grades/average_selector.dart'; -import 'grades_page.i18n.dart'; - -class GradesPage extends StatefulWidget { - const GradesPage({super.key}); - - @override - GradesPageState createState() => GradesPageState(); -} - -class GradesPageState extends State { - late UserProvider user; - late GradeProvider gradeProvider; - late UpdateProvider updateProvider; - late String firstName; - late Widget yearlyGraph; - List subjectTiles = []; - - int avgDropValue = 0; - - List getSubjectGrades(GradeSubject subject, {int days = 0}) => - gradeProvider.grades - .where((e) => - e.subject == subject && - e.type == GradeType.midYear && - (days == 0 || - e.date - .isBefore(DateTime.now().subtract(Duration(days: days))))) - .toList(); - - void generateTiles() { - List subjects = gradeProvider.grades - .map((e) => e.subject) - .toSet() - .toList() - ..sort((a, b) => a.name.compareTo(b.name)); - List tiles = []; - - Map subjectAvgs = {}; - - tiles.addAll(subjects.map((subject) { - List subjectGrades = getSubjectGrades(subject); - - double avg = AverageHelper.averageEvals(subjectGrades); - double averageBefore = 0.0; - - if (avgDropValue != 0) { - List gradesBefore = - getSubjectGrades(subject, days: avgDropValue); - averageBefore = - avgDropValue == 0 ? 0.0 : AverageHelper.averageEvals(gradesBefore); - } - var nullavg = GroupAverage(average: 0.0, subject: subject, uid: "0"); - double groupAverage = gradeProvider.groupAverages - .firstWhere((e) => e.subject == subject, orElse: () => nullavg) - .average; - - if (avg != 0) subjectAvgs[subject] = avg; - - return GradeSubjectTile( - subject, - averageBefore: averageBefore, - average: avg, - groupAverage: avgDropValue == 0 ? groupAverage : 0.0, - onTap: () { - GradeSubjectView(subject, groupAverage: groupAverage) - .push(context, root: true); - }, - ); - })); - - if (tiles.isNotEmpty) { - tiles.insert(0, yearlyGraph); - tiles.insert(1, FailWarning(subjectAvgs: subjectAvgs)); - tiles.insert( - 2, - PanelTitle( - title: Text(avgDropValue == 0 - ? "Subjects".i18n - : "Subjects_changes".i18n))); - tiles.insert(3, const PanelHeader(padding: EdgeInsets.only(top: 12.0))); - tiles.add(const PanelFooter(padding: EdgeInsets.only(bottom: 12.0))); - tiles.add(const Padding(padding: EdgeInsets.only(bottom: 24.0))); - } else { - tiles.insert( - 0, - Padding( - padding: const EdgeInsets.only(top: 24.0), - child: Empty(subtitle: "empty".i18n), - ), - ); - } - - double subjectAvg = subjectAvgs.isNotEmpty - ? subjectAvgs.values.fold(0.0, (double a, double b) => a + b) / - subjectAvgs.length - : 0.0; - final double classAvg = gradeProvider.groupAverages.isNotEmpty - ? gradeProvider.groupAverages - .map((e) => e.average) - .fold(0.0, (double a, double b) => a + b) / - gradeProvider.groupAverages.length - : 0.0; - - if (subjectAvg > 0) { - tiles.add(Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: StatisticsTile( - fill: true, - title: AutoSizeText( - "subjectavg".i18n, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - value: subjectAvg, - ), - ), - const SizedBox(width: 24.0), - Expanded( - child: StatisticsTile( - outline: true, - title: AutoSizeText( - // https://discord.com/channels/1111649116020285532/1153397476578050130 - "classavg".i18n, - textAlign: TextAlign.center, - maxLines: 2, - wrapWords: false, - overflow: TextOverflow.ellipsis, - ), - value: classAvg, - ), - ), - ], - )); - } - - // padding - tiles.add(const SizedBox(height: 32.0)); - - subjectTiles = List.castFrom(tiles); - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - gradeProvider = Provider.of(context); - updateProvider = Provider.of(context); - - List nameParts = user.displayName?.split(" ") ?? ["?"]; - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - - final double totalClassAvg = gradeProvider.groupAverages.isEmpty - ? 0.0 - : gradeProvider.groupAverages - .map((e) => e.average) - .fold(0.0, (double a, double b) => a + b) / - gradeProvider.groupAverages.length; - - final now = gradeProvider.grades.isNotEmpty - ? gradeProvider.grades - .reduce((v, e) => e.date.isAfter(v.date) ? e : v) - .date - : DateTime.now(); - - final currentStudentAvg = AverageHelper.averageEvals(gradeProvider.grades - .where((e) => e.type == GradeType.midYear) - .toList()); - final prevStudentAvg = AverageHelper.averageEvals(gradeProvider.grades - .where((e) => e.type == GradeType.midYear) - .where((e) => e.date.isBefore(now.subtract(const Duration(days: 30)))) - .toList()); - - List graphGrades = gradeProvider.grades - .where((e) => - e.type == GradeType.midYear && - (avgDropValue == 0 || - e.date.isAfter( - DateTime.now().subtract(Duration(days: avgDropValue))))) - .toList(); - - yearlyGraph = Padding( - padding: const EdgeInsets.only(top: 12.0, bottom: 8.0), - child: Panel( - title: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AverageSelector( - value: avgDropValue, - onChanged: (value) { - setState(() { - avgDropValue = value!; - }); - }, - ), - Row( - children: [ - // if (totalClassAvg >= 1.0) AverageDisplay(average: totalClassAvg, border: true), - // const SizedBox(width: 4.0), - TrendDisplay( - previous: prevStudentAvg, current: currentStudentAvg), - if (gradeProvider.grades - .where((e) => e.type == GradeType.midYear) - .isNotEmpty) - AverageDisplay(average: currentStudentAvg), - ], - ) - ], - ), - child: Container( - padding: const EdgeInsets.only(top: 12.0, right: 12.0), - child: Row( - children: [ - Expanded( - child: GradeGraph(graphGrades, - dayThreshold: 2, classAvg: totalClassAvg)), - Padding( - padding: const EdgeInsets.only(bottom: 24.0), - child: GradesCount(grades: graphGrades), - ), - ], - ), - ), - ), - ); - - generateTiles(); - - return Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 9.0), - child: NestedScrollView( - physics: const BouncingScrollPhysics( - parent: AlwaysScrollableScrollPhysics()), - headerSliverBuilder: (context, _) => [ - SliverAppBar( - centerTitle: false, - pinned: true, - floating: false, - snap: false, - automaticallyImplyLeading: false, - surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, - title: Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Text( - "page_title_grades".i18n, - style: TextStyle( - color: AppColors.of(context).text, - fontSize: 32.0, - fontWeight: FontWeight.bold), - ), - ), - shadowColor: Theme.of(context).shadowColor, - ), - ], - body: RefreshIndicator( - onRefresh: () => gradeProvider.fetch(), - color: Theme.of(context).colorScheme.secondary, - child: ListView.builder( - padding: EdgeInsets.zero, - physics: const BouncingScrollPhysics(), - itemCount: max(subjectTiles.length, 1), - itemBuilder: (context, index) { - if (subjectTiles.isNotEmpty) { - EdgeInsetsGeometry panelPadding = - const EdgeInsets.symmetric(horizontal: 24.0); - - if (subjectTiles[index].runtimeType == GradeSubjectTile) { - return Padding( - padding: panelPadding, - child: PanelBody( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: subjectTiles[index], - )); - } else { - return Padding( - padding: panelPadding, child: subjectTiles[index]); - } - } else { - return Container(); - } - }, - ), - ), - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/grades/grades_page.i18n.dart b/refilc_desktop_ui/lib/pages/grades/grades_page.i18n.dart deleted file mode 100644 index 86b8414..0000000 --- a/refilc_desktop_ui/lib/pages/grades/grades_page.i18n.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension Localization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "Grades": "Grades", - "Ghost Grades": "Grades", - "Subjects": "Subjects", - "Subjects_changes": "Subject Differences", - "empty": "You don't have any subjects.", - "annual_average": "Annual average", - "3_months_average": "3 Monthly Average", - "30_days_average": "Monthly Average", - "14_days_average": "2 Weekly Average", - "7_days_average": "Weekly Average", - "subjectavg": "Subject Average", - "classavg": "Class Average", - "fail_warning": "Failure warning", - "fail_warning_description": "You are failing %d subjects!" - .one("You are failing a subject!"), - }, - "hu_hu": { - "Grades": "Jegyek", - "Ghost Grades": "Szellem jegyek", - "Subjects": "Tantárgyak", - "Subjects_changes": "Tantárgyi változások", - "empty": "Még nincs egy tárgyad sem.", - "annual_average": "Éves átlag", - "3_months_average": "Háromhavi átlag", - "30_days_average": "Havi átlag", - "14_days_average": "Kétheti átlag", - "7_days_average": "Heti átlag", - "subjectavg": "Tantárgyi átlag", - "classavg": "Osztályátlag", - "fail_warning": "Bukás figyelmeztető", - "fail_warning_description": "Bukásra állsz %d tantárgyból", - }, - "de_de": { - "Grades": "Noten", - "Ghost Grades": "Geist Noten", - "Subjects": "Fächer", - "Subjects_changes": "Betreff Änderungen", - "empty": "Sie haben keine Fächer.", - "annual_average": "Jahresdurchschnitt", - "3_months_average": "Drei-Monats-Durchschnitt", - "30_days_average": "Monatsdurchschnitt", - "14_days_average": "Vierzehntägiger Durchschnitt", - "7_days_average": "Wöchentlicher Durchschnitt", - "subjectavg": "Fächer Durchschnitt", - "classavg": "Klassendurchschnitt", - "fail_warning": "Ausfallwarnung", - "fail_warning_description": "Sie werden in %d des Fachs durchfallen", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/pages/home/home_page.dart b/refilc_desktop_ui/lib/pages/home/home_page.dart deleted file mode 100644 index bd9ee2c..0000000 --- a/refilc_desktop_ui/lib/pages/home/home_page.dart +++ /dev/null @@ -1,180 +0,0 @@ -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/ui/date_widget.dart'; -import 'package:refilc_mobile_ui/common/filter_bar.dart'; -import 'package:flutter/material.dart'; -import 'package:animated_list_plus/animated_list_plus.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc/ui/filter/widgets.dart'; -import 'package:refilc/ui/filter/sort.dart'; -import 'home_page.i18n.dart'; - -class HomePage extends StatefulWidget { - const HomePage({super.key}); - - @override - State createState() => _HomePageState(); -} - -class _HomePageState extends State - with SingleTickerProviderStateMixin { - late UserProvider user; - late SettingsProvider settings; - - late TabController _tabController; - late PageController _pageController; - - late String greeting; - late String firstName; - - late List listOrder; - static const pageCount = 4; - - @override - void initState() { - super.initState(); - - _tabController = TabController(length: pageCount, vsync: this); - _pageController = PageController(); - - listOrder = List.generate(pageCount, (index) => "$index"); - - user = Provider.of(context, listen: false); - - DateTime now = DateTime.now(); - if (now.isBefore(DateTime(now.year, DateTime.august, 31)) && - now.isAfter(DateTime(now.year, DateTime.june, 14))) { - greeting = "goodrest"; - } else if (now.month == user.student?.birth.month && - now.day == user.student?.birth.day) { - greeting = "happybirthday"; - } else if (now.month == DateTime.december && - now.day >= 24 && - now.day <= 26) { - greeting = "merryxmas"; - } else if (now.month == DateTime.january && now.day == 1) { - greeting = "happynewyear"; - } else if (now.hour >= 18) { - greeting = "goodevening"; - } else if (now.hour >= 12) { - greeting = "goodafternoon"; - } else if (now.hour >= 4) { - greeting = "goodmorning"; - } else { - greeting = "goodevening"; - } - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - settings = Provider.of(context); - - List nameParts = user.name?.split(" ") ?? ["?"]; - if (!settings.presentationMode) { - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - } else { - firstName = "Béla"; - } - - return SafeArea( - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Greeting - Padding( - padding: const EdgeInsets.only( - left: 32.0, top: 24.0, bottom: 12.0), - child: Text( - greeting.i18n.fill([firstName]), - overflow: TextOverflow.fade, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24.0, - color: Theme.of(context).textTheme.bodyMedium?.color, - ), - ), - ), - - Padding( - padding: const EdgeInsets.only(bottom: 12.0), - child: FilterBar( - items: [ - Tab(text: "All".i18n), - Tab(text: "Grades".i18n), - Tab(text: "Messages".i18n), - Tab(text: "Absences".i18n), - ], - controller: _tabController, - onTap: (i) async { - int selectedPage = _pageController.page!.round(); - - if (i == selectedPage) return; - if (_pageController.page?.roundToDouble() != - _pageController.page) { - _pageController.animateToPage(i, - curve: Curves.easeIn, duration: kTabScrollDuration); - return; - } - - // swap current page with target page - setState(() { - _pageController.jumpToPage(i); - String currentList = listOrder[selectedPage]; - listOrder[selectedPage] = listOrder[i]; - listOrder[i] = currentList; - }); - }, - disableFading: true, - ), - ), - - // Data filters - Expanded( - child: PageView.custom( - controller: _pageController, - childrenDelegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return FutureBuilder>( - key: ValueKey(listOrder[index]), - future: getFilterWidgets(homeFilters[index], - context: context), - builder: (context, dateWidgets) => dateWidgets.data != - null - ? ImplicitlyAnimatedList( - items: sortDateWidgets(context, - dateWidgets: dateWidgets.data!), - itemBuilder: filterItemBuilder, - spawnIsolate: false, - areItemsTheSame: (a, b) => a.key == b.key, - physics: const BouncingScrollPhysics( - parent: AlwaysScrollableScrollPhysics()), - padding: const EdgeInsets.symmetric( - horizontal: 24.0), - ) - : Container(), - ); - }, - childCount: 4, - findChildIndexCallback: (Key key) { - final ValueKey valueKey = - key as ValueKey; - final String data = valueKey.value; - return listOrder.indexOf(data); - }, - ), - physics: const PageScrollPhysics() - .applyTo(const BouncingScrollPhysics()), - ), - ), - ], - ), - ), - ], - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/home/home_page.i18n.dart b/refilc_desktop_ui/lib/pages/home/home_page.i18n.dart deleted file mode 100644 index 2362b96..0000000 --- a/refilc_desktop_ui/lib/pages/home/home_page.i18n.dart +++ /dev/null @@ -1,63 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension Localization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "goodmorning": "Good morning, %s!", - "goodafternoon": "Good afternoon, %s!", - "goodevening": "Good evening, %s!", - "goodrest": "⛱️ Have a nice holiday, %s!", - "happybirthday": "🎂 Happy birthday, %s!", - "merryxmas": "🎄 Merry Christmas, %s!", - "happynewyear": "🎉 Happy New Year, %s!", - "empty": "Nothing to see here.", - "All": "All", - "Grades": "Grades", - "Messages": "Messages", - "Absences": "Absences", - "update_available": "Update Available", - "missed_exams": "You missed %s exams this week.".one("You missed an exam this week."), - "missed_exam_contact": "Contact %s, to resolve it!", - }, - "hu_hu": { - "goodmorning": "Jó reggelt, %s!", - "goodafternoon": "Szép napot, %s!", - "goodevening": "Szép estét, %s!", - "goodrest": "⛱️ Jó szünetet, %s!", - "happybirthday": "🎂 Boldog születésnapot, %s!", - "merryxmas": "🎄 Boldog Karácsonyt, %s!", - "happynewyear": "🎉 Boldog új évet, %s!", - "empty": "Nincs itt semmi látnivaló.", - "All": "Összes", - "Grades": "Jegyek", - "Messages": "Üzenetek", - "Absences": "Hiányok", - "update_available": "Frissítés elérhető", - "missed_exams": "Ezen a héten hiányoztál %s dolgozatról.".one("Ezen a héten hiányoztál egy dolgozatról."), - "missed_exam_contact": "Keresd %s-t, ha pótolni szeretnéd!", - }, - "de_de": { - "goodmorning": "Guten morgen, %s!", - "goodafternoon": "Guten Tag, %s!", - "goodevening": "Guten Abend, %s!", - "goodrest": "⛱️ Schöne Ferien, %s!", - "happybirthday": "🎂 Alles Gute zum Geburtstag, %s!", - "merryxmas": "🎄 Frohe Weihnachten, %s!", - "happynewyear": "🎉 Frohes neues Jahr, %s!", - "empty": "Hier gibt es nichts zu sehen.", - "All": "Alles", - "Grades": "Noten", - "Messages": "Nachrichten", - "Absences": "Fehlen", - "update_available": "Update verfügbar", - "missed_exams": "Diese Woche haben Sie %s Prüfungen verpasst.".one("Diese Woche haben Sie eine Prüfung verpasst."), - "missed_exam_contact": "Wenden Sie sich an %s, um sie zu erneuern!", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/pages/messages/messages_page.dart b/refilc_desktop_ui/lib/pages/messages/messages_page.dart deleted file mode 100644 index 9d0d997..0000000 --- a/refilc_desktop_ui/lib/pages/messages/messages_page.dart +++ /dev/null @@ -1,173 +0,0 @@ -import 'dart:math'; - -import 'package:refilc/api/providers/update_provider.dart'; -import 'package:refilc/ui/date_widget.dart'; -import 'package:refilc_kreta_api/providers/message_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc_kreta_api/models/message.dart'; -import 'package:refilc_mobile_ui/common/empty.dart'; -import 'package:refilc_mobile_ui/common/filter_bar.dart'; -import 'package:refilc/ui/filter/sort.dart'; -import 'package:refilc_mobile_ui/common/widgets/message/message_viewable.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'messages_page.i18n.dart'; - -class MessagesPage extends StatefulWidget { - const MessagesPage({super.key}); - - @override - MessagesPageState createState() => MessagesPageState(); -} - -class MessagesPageState extends State - with TickerProviderStateMixin { - late UserProvider user; - late MessageProvider messageProvider; - late UpdateProvider updateProvider; - late String firstName; - late TabController tabController; - - @override - void initState() { - super.initState(); - - tabController = TabController(length: 4, vsync: this); - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - messageProvider = Provider.of(context); - updateProvider = Provider.of(context); - - List nameParts = user.displayName?.split(" ") ?? ["?"]; - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - - return Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 12.0), - child: NestedScrollView( - physics: const BouncingScrollPhysics( - parent: AlwaysScrollableScrollPhysics()), - headerSliverBuilder: (context, _) => [ - SliverAppBar( - pinned: true, - floating: false, - snap: false, - centerTitle: false, - automaticallyImplyLeading: false, - shadowColor: Theme.of(context).shadowColor, - surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, - title: Padding( - padding: const EdgeInsets.only(left: 8.0), - child: Text( - "Messages".i18n, - style: TextStyle( - color: AppColors.of(context).text, - fontSize: 32.0, - fontWeight: FontWeight.bold), - ), - ), - bottom: FilterBar( - items: [ - Tab(text: "Inbox".i18n), - Tab(text: "Sent".i18n), - Tab(text: "Trash".i18n), - Tab(text: "Draft".i18n), - ], - controller: tabController, - disableFading: true, - ), - ), - ], - body: TabBarView( - physics: const BouncingScrollPhysics(), - controller: tabController, - children: List.generate( - 4, (index) => filterViewBuilder(context, index))), - ), - ), - ); - } - - List getFilterWidgets(MessageType activeData) { - List items = []; - switch (activeData) { - case MessageType.inbox: - for (var message in messageProvider.messages) { - if (message.type == MessageType.inbox) { - items.add(DateWidget( - date: message.date, - widget: MessageViewable(message), - )); - } - } - break; - case MessageType.sent: - for (var message in messageProvider.messages) { - if (message.type == MessageType.sent) { - items.add(DateWidget( - date: message.date, - widget: MessageViewable(message), - )); - } - } - break; - case MessageType.trash: - for (var message in messageProvider.messages) { - if (message.type == MessageType.trash) { - items.add(DateWidget( - date: message.date, - widget: MessageViewable(message), - )); - } - } - break; - case MessageType.draft: - for (var message in messageProvider.messages) { - if (message.type == MessageType.draft) { - items.add(DateWidget( - date: message.date, - widget: MessageViewable(message), - )); - } - } - break; - } - return items; - } - - Widget filterViewBuilder(context, int activeData) { - List filterWidgets = sortDateWidgets(context, - dateWidgets: getFilterWidgets(MessageType.values[activeData]), - hasShadow: true); - - return Padding( - padding: const EdgeInsets.only(top: 12.0), - child: RefreshIndicator( - color: Theme.of(context).colorScheme.secondary, - onRefresh: () { - return Future.wait([ - messageProvider.fetch(type: MessageType.inbox), - messageProvider.fetch(type: MessageType.sent), - messageProvider.fetch(type: MessageType.trash), - ]); - }, - child: ListView.builder( - padding: EdgeInsets.zero, - physics: const BouncingScrollPhysics(), - itemBuilder: (context, index) => filterWidgets.isNotEmpty - ? Padding( - padding: const EdgeInsets.symmetric( - horizontal: 24.0, vertical: 6.0), - child: filterWidgets[index], - ) - : Empty(subtitle: "empty".i18n), - itemCount: max(filterWidgets.length, 1), - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/messages/messages_page.i18n.dart b/refilc_desktop_ui/lib/pages/messages/messages_page.i18n.dart deleted file mode 100644 index b1665e1..0000000 --- a/refilc_desktop_ui/lib/pages/messages/messages_page.i18n.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension Localization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "Messages": "Messages", - "Inbox": "Inbox", - "Sent": "Sent", - "Trash": "Trash", - "Draft": "Draft", - "empty": "You have no messages.", - }, - "hu_hu": { - "Messages": "Üzenetek", - "Inbox": "Beérkezett", - "Sent": "Elküldött", - "Trash": "Kuka", - "Draft": "Piszkozat", - "empty": "Nincsenek üzeneteid.", - }, - "de_de": { - "Messages": "Nachrichten", - "Inbox": "Posteingang", - "Sent": "Gesendet", - "Trash": "Müll", - "Draft": "Entwurf", - "empty": "Sie haben keine Nachrichten.", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/pages/timetable/timetable_page.dart b/refilc_desktop_ui/lib/pages/timetable/timetable_page.dart deleted file mode 100644 index 0729a70..0000000 --- a/refilc_desktop_ui/lib/pages/timetable/timetable_page.dart +++ /dev/null @@ -1,378 +0,0 @@ -import 'dart:math'; -import 'package:animations/animations.dart'; -import 'package:refilc/api/providers/update_provider.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc_kreta_api/client/client.dart'; -import 'package:refilc_kreta_api/models/week.dart'; -import 'package:refilc_kreta_api/providers/timetable_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc_kreta_api/models/lesson.dart'; -import 'package:refilc_mobile_ui/common/empty.dart'; -import 'package:refilc_mobile_ui/common/panel/panel.dart'; -import 'package:refilc_kreta_api/controllers/timetable_controller.dart'; -import 'package:refilc_desktop_ui/common/widgets/lesson/lesson_viewable.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc/utils/format.dart'; -import 'package:intl/intl.dart'; -import 'package:i18n_extension/i18n_extension.dart'; -import 'timetable_page.i18n.dart'; - -// todo: "fix" overflow (priority: -1) - -class TimetablePage extends StatefulWidget { - const TimetablePage({super.key, this.initialDay, this.initialWeek}); - - final DateTime? initialDay; - final Week? initialWeek; - - static void jump(BuildContext context, - {Week? week, DateTime? day, Lesson? lesson}) { - // Go to timetable page with arguments - // NavigationScreen.of(context)?.customRoute(navigationPageRoute((context) => TimetablePage( - // initialDay: lesson?.date ?? day, - // initialWeek: lesson?.date != null - // ? Week.fromDate(lesson!.date) - // : day != null - // ? Week.fromDate(day) - // : week, - // ))); - - // NavigationScreen.of(context)?.setPage("timetable"); - - // Show initial Lesson - // if (lesson != null) LessonView.show(lesson, context: context); - } - - @override - TimetablePageState createState() => TimetablePageState(); -} - -class TimetablePageState extends State - with TickerProviderStateMixin { - late UserProvider user; - late TimetableProvider timetableProvider; - late UpdateProvider updateProvider; - late String firstName; - late TimetableController _controller; - late TabController _tabController; - late Widget empty; - - int _getDayIndex(DateTime date) { - int index = 0; - if (_controller.days == null || (_controller.days?.isEmpty ?? true)) { - return index; - } - - // find the first day with upcoming lessons - index = _controller.days!.indexWhere((day) => day.last.end.isAfter(date)); - if (index == -1) index = 0; // fallback - - return index; - } - - // Update timetable on user change - Future _userListener() async { - await Provider.of(context, listen: false).refreshLogin(); - if (mounted) _controller.jump(_controller.currentWeek, context: context); - } - - @override - void initState() { - super.initState(); - - // Initalize controllers - _controller = TimetableController(); - _tabController = TabController(length: 0, vsync: this, initialIndex: 0); - - empty = Empty(subtitle: "empty".i18n); - - bool initial = true; - - // Only update the TabController on week changes - _controller.addListener(() { - if (_controller.days == null) return; - setState(() { - _tabController = TabController( - length: _controller.days!.length, - vsync: this, - initialIndex: - min(_tabController.index, max(_controller.days!.length - 1, 0)), - ); - - if (initial || - _controller.previousWeekId != _controller.currentWeekId) { - _tabController - .animateTo(_getDayIndex(widget.initialDay ?? DateTime.now())); - } - initial = false; - - // Empty is updated once every week change - empty = Empty(subtitle: "empty".i18n); - }); - }); - - if (mounted) { - if (widget.initialWeek != null) { - _controller.jump(widget.initialWeek!, context: context, initial: true); - } else { - _controller.jump(_controller.currentWeek, - context: context, initial: true, skip: true); - } - } - // Listen for user changes - user = Provider.of(context, listen: false); - user.addListener(_userListener); - } - - @override - void dispose() { - _tabController.dispose(); - _controller.dispose(); - user.removeListener(_userListener); - super.dispose(); - } - - String dayTitle(int index) { - // Sometimes when changing weeks really fast, - // controller.days might be null or won't include index - try { - return DateFormat("EEEE", I18n.of(context).locale.languageCode) - .format(_controller.days![index].first.date); - } catch (e) { - return "timetable".i18n; - } - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - timetableProvider = Provider.of(context); - updateProvider = Provider.of(context); - - // First name - List nameParts = user.name?.split(" ") ?? ["?"]; - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - - return Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 18.0), - child: Column( - children: [ - Expanded( - child: PageTransitionSwitcher( - transitionBuilder: ( - Widget child, - Animation primaryAnimation, - Animation secondaryAnimation, - ) { - return FadeThroughTransition( - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - fillColor: Theme.of(context).scaffoldBackgroundColor, - child: child, - ); - }, - child: _controller.days != null - ? - // Week view - _tabController.length > 0 - ? CupertinoScrollbar( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: _controller.days!.length, - itemBuilder: (context, tab) => SizedBox( - width: 400, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Day Title - Padding( - padding: const EdgeInsets.only( - left: 24.0, - right: 28.0, - top: 18.0, - bottom: 8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - dayTitle(tab).capital(), - style: const TextStyle( - fontSize: 32.0, - fontWeight: FontWeight.w600, - ), - ), - Text( - "${"${_controller.days![tab].first.date.day}" - .padLeft(2, '0')}.", - style: TextStyle( - color: AppColors.of(context) - .text - .withOpacity(.5), - fontWeight: FontWeight.w500, - ), - ), - ], - ), - ), - - // Lessons - Expanded( - child: ListView.builder( - padding: EdgeInsets.zero, - physics: const BouncingScrollPhysics(), - itemCount: - _controller.days![tab].length + 2, - itemBuilder: (context, index) { - if (_controller.days == null) { - return Container(); - } - - // Header - if (index == 0) { - return const Padding( - padding: EdgeInsets.only( - top: 8.0, - left: 24.0, - right: 24.0), - child: PanelHeader( - padding: EdgeInsets.only( - top: 12.0)), - ); - } - - // Footer - if (index == - _controller.days![tab].length + - 1) { - return const Padding( - padding: EdgeInsets.only( - bottom: 8.0, - left: 24.0, - right: 24.0), - child: PanelFooter( - padding: EdgeInsets.only( - top: 12.0)), - ); - } - - // Body - final Lesson lesson = - _controller.days![tab][index - 1]; - final bool swapDescDay = _controller - .days![tab] - .map( - (l) => l.swapDesc ? 1 : 0) - .reduce((a, b) => a + b) >= - _controller.days![tab].length * - .5; - - return Padding( - padding: const EdgeInsets.symmetric( - horizontal: 24.0), - child: PanelBody( - padding: - const EdgeInsets.symmetric( - horizontal: 10.0), - child: LessonViewable( - lesson, - swapDesc: swapDescDay, - ), - ), - ); - }, - ), - ), - ], - ), - ), - ), - ) - - // Empty week - : Expanded( - child: Center(child: empty), - ) - : Center( - child: CircularProgressIndicator( - color: Theme.of(context).colorScheme.secondary, - ), - ), - ), - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // Previous week - IconButton( - onPressed: _controller.currentWeekId == 0 - ? null - : () => setState(() { - _controller.previous(context); - }), - splashRadius: 24.0, - icon: const Icon(FeatherIcons.chevronLeft), - color: Theme.of(context).colorScheme.secondary), - - // Week selector - InkWell( - borderRadius: BorderRadius.circular(6.0), - onTap: () => setState(() { - _controller.current(); - if (mounted) { - _controller.jump(_controller.currentWeek, - context: context, - loader: _controller.currentWeekId != - _controller.previousWeekId); - } - }), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "${_controller.currentWeekId + 1}. ${"week".i18n} (${DateFormat( - "${_controller.currentWeek.start.year != - DateTime.now().year - ? "yy. " - : ""}MMM d.", - I18n.of(context).locale.languageCode) - .format(_controller.currentWeek.start)} - ${DateFormat( - "${_controller.currentWeek.start.year != - DateTime.now().year - ? "yy. " - : ""}MMM d.", - I18n.of(context).locale.languageCode) - .format(_controller.currentWeek.end)})", - style: const TextStyle( - fontWeight: FontWeight.w500, - fontSize: 14.0, - ), - ), - ), - ), - - // Next week - IconButton( - onPressed: _controller.currentWeekId == 51 - ? null - : () => setState(() { - _controller.next(context); - }), - splashRadius: 24.0, - icon: const Icon(FeatherIcons.chevronRight), - color: Theme.of(context).colorScheme.secondary), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/pages/timetable/timetable_page.i18n.dart b/refilc_desktop_ui/lib/pages/timetable/timetable_page.i18n.dart deleted file mode 100644 index 75d3bd0..0000000 --- a/refilc_desktop_ui/lib/pages/timetable/timetable_page.i18n.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension Localization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "timetable": "Timetable", - "empty": "No school this week!", - "week": "Week", - "error": "Failed to fetch timetable!", - }, - "hu_hu": { - "timetable": "Órarend", - "empty": "Ezen a héten nincs iskola.", - "week": "Hét", - "error": "Nem sikerült lekérni az órarendet!", - }, - "de_de": { - "timetable": "Zeitplan", - "empty": "Keine Schule diese Woche.", - "week": "Woche", - "error": "Der Fahrplan konnte nicht abgerufen werden!", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/screens/login/login_route.dart b/refilc_desktop_ui/lib/screens/login/login_route.dart deleted file mode 100644 index f6f5452..0000000 --- a/refilc_desktop_ui/lib/screens/login/login_route.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:animations/animations.dart'; -import 'package:flutter/material.dart'; - -Route loginRoute(Widget widget) { - return PageRouteBuilder( - pageBuilder: (context, animation, secondaryAnimation) => widget, - transitionDuration: const Duration(milliseconds: 650), - transitionsBuilder: (context, animation, secondaryAnimation, child) { - return FadeThroughTransition( - fillColor: Colors.transparent, - animation: animation, - secondaryAnimation: secondaryAnimation, - child: child, - ); - }, - ); -} diff --git a/refilc_desktop_ui/lib/screens/login/login_screen.dart b/refilc_desktop_ui/lib/screens/login/login_screen.dart deleted file mode 100644 index 892db46..0000000 --- a/refilc_desktop_ui/lib/screens/login/login_screen.dart +++ /dev/null @@ -1,358 +0,0 @@ -import 'dart:io'; -import 'dart:ui'; - -import 'package:elegant_notification/elegant_notification.dart'; -import 'package:elegant_notification/resources/arrays.dart'; -import 'package:refilc/api/client.dart'; -import 'package:refilc/api/login.dart'; -import 'package:refilc_mobile_ui/screens/login/login_button.dart'; -import 'package:refilc_mobile_ui/screens/login/login_input.dart'; -import 'package:refilc_desktop_ui/screens/login/school_input/school_input.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_acrylic/flutter_acrylic.dart'; -import 'login_screen.i18n.dart'; - -const LinearGradient _backgroundGradient = LinearGradient( - colors: [ - Color.fromARGB(255, 61, 122, 244), - Color.fromARGB(255, 23, 77, 185), - Color.fromARGB(255, 7, 42, 112), - ], - begin: Alignment(-0.8, -2.0), - end: Alignment(0.8, 1.0), - stops: [-1.0, 0.0, 1.0], -); - -class LoginScreen extends StatefulWidget { - const LoginScreen({super.key, this.back = false}); - - final bool back; - - @override - LoginScreenState createState() => LoginScreenState(); -} - -class LoginScreenState extends State { - final usernameController = TextEditingController(); - final passwordController = TextEditingController(); - final schoolController = SchoolInputController(); - final _scrollController = ScrollController(); - - LoginState _loginState = LoginState.normal; - bool showBack = false; - double topInset = 12.0; - - @override - void initState() { - super.initState(); - showBack = widget.back; - - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( - statusBarColor: Colors.transparent, - statusBarIconBrightness: Brightness.light, - systemNavigationBarColor: Colors.white, - systemNavigationBarIconBrightness: Brightness.dark, - )); - - FilcAPI.getSchools().then((schools) { - if (schools != null) { - schoolController.update(() { - schoolController.schools = schools; - }); - } else { - ElegantNotification.error( - background: Colors.white, - description: Text( - "schools_error".i18n, - overflow: TextOverflow.ellipsis, - style: const TextStyle(color: Colors.red), - ), - // onActionPressed: () {}, - onCloseButtonPressed: () {}, - onDismiss: () {}, - onProgressFinished: () {}, - displayCloseButton: false, - showProgressIndicator: false, - autoDismiss: true, - animation: AnimationType.fromTop, - ).show(context); - } - }); - - if (Platform.isMacOS) { - Window.getTitlebarHeight() - .then((value) => setState(() => topInset = value)); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - decoration: const BoxDecoration( - gradient: _backgroundGradient, - ), - child: SafeArea( - child: Stack( - children: [ - Row( - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // App logo - Padding( - padding: const EdgeInsets.only(bottom: 24.0), - child: ClipRect( - child: Padding( - padding: const EdgeInsets.only( - left: 12.0, right: 12.0, bottom: 32.0), - child: SizedBox( - width: 100.0, - height: 100.0, - // Png shadow *hack* - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.only(top: 8.0), - child: Opacity( - opacity: 0.3, - child: Image.asset( - "assets/icons/ic_splash.png", - color: Colors.black)), - ), - BackdropFilter( - filter: ImageFilter.blur( - sigmaX: 6.0, sigmaY: 6.0), - child: Image.asset( - "assets/icons/ic_splash.png"), - ) - ], - ), - ), - ), - ), - ), - - // Inputs - SizedBox( - width: 400.0, - child: AutofillGroup( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Username - Padding( - padding: const EdgeInsets.only(bottom: 6.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - "username".i18n, - maxLines: 1, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14.0, - ), - ), - ), - Expanded( - child: Text( - "usernameHint".i18n, - maxLines: 1, - textAlign: TextAlign.right, - style: const TextStyle( - color: Colors.white54, - fontWeight: FontWeight.w500, - fontSize: 12.0, - ), - ), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 12.0), - child: LoginInput( - style: LoginInputStyle.username, - controller: usernameController, - ), - ), - - // Password - Padding( - padding: const EdgeInsets.only(bottom: 6.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - "password".i18n, - maxLines: 1, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14.0, - ), - ), - ), - Expanded( - child: Text( - "passwordHint".i18n, - maxLines: 1, - textAlign: TextAlign.right, - style: const TextStyle( - color: Colors.white54, - fontWeight: FontWeight.w500, - fontSize: 12.0, - ), - ), - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(bottom: 12.0), - child: LoginInput( - style: LoginInputStyle.password, - controller: passwordController, - ), - ), - - // School - Padding( - padding: const EdgeInsets.only(bottom: 6.0), - child: Text( - "school".i18n, - maxLines: 1, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 14.0, - ), - ), - ), - SchoolInput( - scroll: _scrollController, - controller: schoolController, - ), - ], - ), - ), - ), - - // Log in button - SizedBox( - width: 400.0, - child: Padding( - padding: const EdgeInsets.only(top: 42.0), - child: Visibility( - visible: _loginState != LoginState.inProgress, - replacement: const Padding( - padding: EdgeInsets.symmetric(vertical: 6.0), - child: Center( - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation( - Colors.white), - ), - ), - ), - child: LoginButton( - child: Text("login".i18n, - maxLines: 1, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 15.0, - )), - onPressed: () => _loginAPI(context: context), - ), - ), - ), - ), - if (_loginState == LoginState.missingFields || - _loginState == LoginState.invalidGrant || - _loginState == LoginState.failed) - Padding( - padding: const EdgeInsets.only(top: 8.0), - child: Text( - [ - "missing_fields", - "invalid_grant", - "error" - ][_loginState.index] - .i18n, - style: const TextStyle( - color: Colors.red, - fontWeight: FontWeight.w500), - ), - ), - ], - ), - ), - ], - ), - if (showBack) - Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.only(left: 16.0, top: topInset), - child: const ClipOval( - child: Material( - type: MaterialType.transparency, - child: BackButton(color: Colors.white), - ), - ), - ), - ], - ), - ), - ), - ); - } - - void _loginAPI({required BuildContext context}) { - String username = usernameController.text; - String password = passwordController.text; - - if (username == "" || - password == "" || - schoolController.selectedSchool == null) { - return setState(() => _loginState = LoginState.missingFields); - } - - setState(() => _loginState = LoginState.inProgress); - - loginAPI( - username: username, - password: password, - instituteCode: schoolController.selectedSchool!.instituteCode, - context: context, - onLogin: (user) { - ElegantNotification.success( - background: Colors.white, - description: Text( - "welcome".i18n.fill([user.name]), - overflow: TextOverflow.ellipsis, - style: const TextStyle(color: Colors.black), - ), - // onActionPressed: () {}, - onCloseButtonPressed: () {}, - onDismiss: () {}, - onProgressFinished: () {}, - displayCloseButton: false, - showProgressIndicator: false, - autoDismiss: true, - animation: AnimationType.fromTop, - ).show(context); - }, - onSuccess: () { - Navigator.of(context) - .pushNamedAndRemoveUntil("login_to_navigation", (_) => false); - }).then((res) => setState(() => _loginState = res)); - } -} diff --git a/refilc_desktop_ui/lib/screens/login/login_screen.i18n.dart b/refilc_desktop_ui/lib/screens/login/login_screen.i18n.dart deleted file mode 100644 index f463081..0000000 --- a/refilc_desktop_ui/lib/screens/login/login_screen.i18n.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension Localization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "username": "Username", - "usernameHint": "Student ID number", - "password": "Password", - "passwordHint": "Date of birth", - "school": "School", - "login": "Log in", - "welcome": "Welcome, %s!", - "missing_fields": "Missing Fields!", - "invalid_grant": "Invalid Username/Password!", - "error": "Failed to log in.", - "schools_error": "Failed to get schools." - }, - "hu_hu": { - "username": "Felhasználónév", - "usernameHint": "Oktatási azonosító", - "password": "Jelszó", - "passwordHint": "Születési dátum", - "school": "Iskola", - "login": "Belépés", - "welcome": "Üdv, %s!", - "missing_fields": "Hiányzó adatok!", - "invalid_grant": "Helytelen Felhasználónév/Jelszó!", - "error": "Sikertelen bejelentkezés.", - "schools_error": "Nem sikerült lekérni az iskolákat." - }, - "de_de": { - "username": "Benutzername", - "usernameHint": "Ausbildung ID", - "password": "Passwort", - "passwordHint": "Geburtsdatum", - "school": "Schule", - "login": "Einloggen", - "welcome": "Wilkommen, %s!", - "missing_fields": "Fehlende Felder!", - "invalid_grant": "Ungültiger Benutzername/Passwort!", - "error": "Anmeldung fehlgeschlagen.", - "schools_error": "Keine Schulen gefunden." - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/screens/login/school_input/school_input.dart b/refilc_desktop_ui/lib/screens/login/school_input/school_input.dart deleted file mode 100644 index 7422b0a..0000000 --- a/refilc_desktop_ui/lib/screens/login/school_input/school_input.dart +++ /dev/null @@ -1,121 +0,0 @@ -import 'package:refilc_mobile_ui/screens/login/login_input.dart'; -import 'package:refilc_mobile_ui/screens/login/school_input/school_input_overlay.dart'; -import 'package:refilc_desktop_ui/screens/login/school_input/school_input_tile.dart'; -import 'package:refilc_mobile_ui/screens/login/school_input/school_search.dart'; -import 'package:flutter/material.dart'; -import 'package:refilc_kreta_api/models/school.dart'; - -class SchoolInput extends StatefulWidget { - const SchoolInput({super.key, required this.controller, required this.scroll}); - - final SchoolInputController controller; - final ScrollController scroll; - - @override - SchoolInputState createState() => SchoolInputState(); -} - -class SchoolInputState extends State { - final _focusNode = FocusNode(); - final _layerLink = LayerLink(); - late SchoolInputOverlay overlay; - - @override - void initState() { - super.initState(); - - widget.controller.update = (fn) { - if (mounted) setState(fn); - }; - - overlay = SchoolInputOverlay(layerLink: _layerLink); - - // Show school list when focused - _focusNode.addListener(() { - if (_focusNode.hasFocus) { - WidgetsBinding.instance - .addPostFrameCallback((_) => overlay.createOverlayEntry(context)); - Future.delayed(const Duration(milliseconds: 100)).then((value) { - if (mounted && widget.scroll.hasClients) { - widget.scroll.animateTo(widget.scroll.offset + 500, - duration: const Duration(milliseconds: 500), - curve: Curves.ease); - } - }); - } else { - overlay.entry?.remove(); - } - }); - - // LoginInput TextField listener - widget.controller.textController.addListener(() { - String text = widget.controller.textController.text; - if (text.isEmpty) { - overlay.children = null; - return; - } - - List results = - searchSchools(widget.controller.schools ?? [], text); - setState(() { - overlay.children = results - .map((School e) => SchoolInputTile( - school: e, - onTap: () => _selectSchool(e), - )) - .toList(); - }); - Overlay.of(context).setState(() {}); - }); - } - - void _selectSchool(School school) { - FocusScope.of(context).requestFocus(FocusNode()); - - setState(() { - widget.controller.selectedSchool = school; - widget.controller.textController.text = school.name; - }); - } - - @override - Widget build(BuildContext context) { - return CompositedTransformTarget( - link: _layerLink, - child: widget.controller.schools == null - ? Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 10.0), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.15), - borderRadius: BorderRadius.circular(12.0), - ), - child: const Center( - child: SizedBox( - height: 28.0, - width: 28.0, - child: CircularProgressIndicator( - color: Colors.white, - ), - ), - ), - ) - : LoginInput( - style: LoginInputStyle.school, - focusNode: _focusNode, - onClear: () { - widget.controller.selectedSchool = null; - FocusScope.of(context).requestFocus(_focusNode); - }, - controller: widget.controller.textController, - ), - ); - } -} - -class SchoolInputController { - final textController = TextEditingController(); - School? selectedSchool; - List? schools; - late void Function(void Function()) update; -} diff --git a/refilc_desktop_ui/lib/screens/login/school_input/school_input_tile.dart b/refilc_desktop_ui/lib/screens/login/school_input/school_input_tile.dart deleted file mode 100644 index 6b0c05c..0000000 --- a/refilc_desktop_ui/lib/screens/login/school_input/school_input_tile.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:refilc_kreta_api/models/school.dart'; -import 'package:flutter/material.dart'; - -class SchoolInputTile extends StatelessWidget { - const SchoolInputTile({super.key, required this.school, this.onTap}); - - final School school; - final Function()? onTap; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(4.0), - child: GestureDetector( - onPanDown: (e) { - onTap!(); - }, - child: InkWell( - onTapDown: (e) {}, - borderRadius: BorderRadius.circular(6.0), - child: Padding( - padding: const EdgeInsets.all(6.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // School name - Padding( - padding: const EdgeInsets.only(bottom: 4.0), - child: Text( - school.name, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontWeight: FontWeight.w600), - ), - ), - Row( - children: [ - // School id - Expanded( - child: Text( - school.instituteCode, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - // School city - Expanded( - child: Text( - school.city, - textAlign: TextAlign.right, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/screens/navigation/navigation_route.dart b/refilc_desktop_ui/lib/screens/navigation/navigation_route.dart deleted file mode 100644 index 79778aa..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/navigation_route.dart +++ /dev/null @@ -1,25 +0,0 @@ -class NavigationRoute { - late String _name; - late int _index; - - final List _internalPageMap = [ - "home", - "grades", - "timetable", - "messages", - "absences", - ]; - - String get name => _name; - int get index => _index; - - set name(String n) { - _name = n; - _index = _internalPageMap.indexOf(n); - } - - set index(int i) { - _index = i; - _name = _internalPageMap.elementAt(i); - } -} diff --git a/refilc_desktop_ui/lib/screens/navigation/navigation_route_handler.dart b/refilc_desktop_ui/lib/screens/navigation/navigation_route_handler.dart deleted file mode 100644 index f7766d7..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/navigation_route_handler.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:animations/animations.dart'; -import 'package:refilc_desktop_ui/pages/absences/absences_page.dart'; -import 'package:refilc_desktop_ui/pages/grades/grades_page.dart'; -import 'package:refilc_desktop_ui/pages/home/home_page.dart'; -import 'package:refilc_desktop_ui/pages/messages/messages_page.dart'; -import 'package:refilc_desktop_ui/pages/timetable/timetable_page.dart'; -import 'package:flutter/material.dart'; - -Route navigationRouteHandler(RouteSettings settings) { - switch (settings.name) { - case "grades": - return navigationPageRoute((context) => const GradesPage()); - case "timetable": - return navigationPageRoute((context) => const TimetablePage()); - case "messages": - return navigationPageRoute((context) => const MessagesPage()); - case "absences": - return navigationPageRoute((context) => const AbsencesPage()); - case "home": - default: - return navigationPageRoute((context) => const HomePage()); - } -} - -Route navigationPageRoute(Widget Function(BuildContext) builder) { - return PageRouteBuilder( - pageBuilder: (context, _, __) => builder(context), - transitionsBuilder: (context, animation, secondaryAnimation, child) { - return FadeThroughTransition( - fillColor: Theme.of(context).scaffoldBackgroundColor, - animation: animation, - secondaryAnimation: secondaryAnimation, - child: child, - ); - }, - ); -} diff --git a/refilc_desktop_ui/lib/screens/navigation/navigation_screen.dart b/refilc_desktop_ui/lib/screens/navigation/navigation_screen.dart deleted file mode 100644 index 2ce4eca..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/navigation_screen.dart +++ /dev/null @@ -1,168 +0,0 @@ -import 'dart:io'; - -import 'package:refilc/api/providers/news_provider.dart'; -import 'package:refilc/api/providers/sync.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc/theme/observer.dart'; -import 'package:refilc_desktop_ui/screens/navigation/navigation_route.dart'; -import 'package:refilc_desktop_ui/screens/navigation/navigation_route_handler.dart'; -import 'package:refilc_desktop_ui/screens/navigation/sidebar.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_acrylic/flutter_acrylic.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc_kreta_api/client/client.dart'; -import 'package:refilc_plus/providers/goal_provider.dart'; - -class NavigationScreen extends StatefulWidget { - const NavigationScreen({super.key}); - - static NavigationScreenState? of(BuildContext context) => - context.findAncestorStateOfType(); - - @override - State createState() => NavigationScreenState(); -} - -class NavigationScreenState extends State - with WidgetsBindingObserver { - final _navigatorState = GlobalKey(); - late NavigationRoute selected; - late SettingsProvider settings; - late NewsProvider newsProvider; - late GoalProvider goalProvider; - double topInset = 0.0; - - @override - void initState() { - super.initState(); - settings = Provider.of(context, listen: false); - selected = NavigationRoute(); - selected.index = 0; - - // add brightness observer - WidgetsBinding.instance.addObserver(this); - - // set client User-Agent - Provider.of(context, listen: false).userAgent = - settings.config.userAgent; - - // get news - newsProvider = Provider.of(context, listen: false); - newsProvider.restore().then((value) => newsProvider.fetch()); - - // get goals - // goalProvider = Provider.of(context, listen: false); - // goalProvider.fetchDone(); - - // Initial sync - syncAll(context); - - // platform specific shit - () async { - try { - await Window.initialize(); - } catch (_) {} - // Transparent sidebar - if (Platform.isLinux) return; - - await Window.setEffect( - effect: Platform.isLinux - ? WindowEffect.transparent - : WindowEffect.acrylic, - color: Platform.isMacOS - ? Colors.transparent - : const Color.fromARGB(27, 27, 27, 27)); - - // todo: do for windows - if (Platform.isMacOS) { - topInset = await Window.getTitlebarHeight(); - await Window.enableFullSizeContentView(); - await Window.hideTitle(); - await Window.makeTitlebarTransparent(); - } - }(); - } - - @override - void dispose() { - WidgetsBinding.instance.removeObserver(this); - super.dispose(); - } - - @override - void didChangePlatformBrightness() { - if (settings.theme == ThemeMode.system) { - // ignore: deprecated_member_use - Brightness? brightness = - // ignore: deprecated_member_use - WidgetsBinding.instance.window.platformBrightness; - Provider.of(context, listen: false).changeTheme( - brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark); - } - super.didChangePlatformBrightness(); - } - - void setPage(String page) => setState(() => selected.name = page); - - @override - Widget build(BuildContext context) { - settings = Provider.of(context); - newsProvider = Provider.of(context); - goalProvider = Provider.of(context); - - // show news / complete goals - WidgetsBinding.instance.addPostFrameCallback((_) { - if (newsProvider.show) { - newsProvider.lock(); - // NewsView.show(newsProvider.news[newsProvider.state], context: context).then((value) => newsProvider.release()); - } - if (goalProvider.hasDoneGoals) { - // to-do - } - }); - - return Scaffold( - backgroundColor: Colors.transparent, - body: Row( - children: [ - if (_navigatorState.currentState != null) - Container( - decoration: BoxDecoration( - color: - Theme.of(context).scaffoldBackgroundColor.withOpacity(.5), - border: Border( - right: BorderSide( - color: AppColors.of(context).shadow.withOpacity(.7), - width: 1.0)), - ), - child: Padding( - padding: EdgeInsets.only(top: topInset), - child: Sidebar( - navigator: _navigatorState.currentState!, - selected: selected.name, - onRouteChange: (name) => setPage(name), - ), - ), - ), - Expanded( - child: Container( - color: Theme.of(context).scaffoldBackgroundColor, - child: MediaQuery( - data: MediaQuery.of(context).copyWith( - padding: EdgeInsets.only(top: topInset), - ), - child: Navigator( - key: _navigatorState, - initialRoute: selected.name, - onGenerateRoute: (settings) => - navigationRouteHandler(settings), - ), - ), - ), - ), - ], - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/screens/navigation/sidebar.dart b/refilc_desktop_ui/lib/screens/navigation/sidebar.dart deleted file mode 100644 index 7aebab2..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/sidebar.dart +++ /dev/null @@ -1,356 +0,0 @@ -// ignore_for_file: no_leading_underscores_for_local_identifiers - -import 'package:animations/animations.dart'; -import 'package:refilc/api/providers/database_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/icons/filc_icons.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/utils/color.dart'; -import 'package:refilc_desktop_ui/common/panel_button.dart'; -import 'package:refilc_desktop_ui/common/profile_image.dart'; -import 'package:refilc_desktop_ui/screens/navigation/sidebar.i18n.dart'; -import 'package:refilc_desktop_ui/screens/navigation/sidebar_action.dart'; -import 'package:refilc_desktop_ui/screens/settings/settings_screen.dart'; -import 'package:refilc_mobile_ui/screens/settings/accounts/account_tile.dart'; -import 'package:refilc_kreta_api/client/client.dart'; -import 'package:refilc_kreta_api/providers/absence_provider.dart'; -import 'package:refilc_kreta_api/providers/event_provider.dart'; -import 'package:refilc_kreta_api/providers/exam_provider.dart'; -import 'package:refilc_kreta_api/providers/grade_provider.dart'; -import 'package:refilc_kreta_api/providers/homework_provider.dart'; -import 'package:refilc_kreta_api/providers/message_provider.dart'; -import 'package:refilc_kreta_api/providers/note_provider.dart'; -import 'package:refilc_kreta_api/providers/timetable_provider.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc/theme/colors/colors.dart'; - -class Sidebar extends StatefulWidget { - const Sidebar( - {super.key, - required this.navigator, - required this.onRouteChange, - this.selected = "home"}); - - final NavigatorState navigator; - final String selected; - final Function(String) onRouteChange; - - @override - State createState() => _SidebarState(); -} - -class _SidebarState extends State { - late UserProvider user; - late SettingsProvider settings; - late String firstName; - - String topNav = ""; - bool expandAccount = false; - List accountTiles = []; - - @override - void initState() { - super.initState(); - user = Provider.of(context, listen: false); - } - - Future restore() => Future.wait([ - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restoreUser(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false) - .restoreRecipients(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).refreshLogin(), - ]); - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - settings = Provider.of(context); - - List nameParts = user.name?.split(" ") ?? ["?"]; - if (!settings.presentationMode) { - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - } else { - firstName = "János"; - } - - List pageWidgets = [ - SidebarAction( - title: Text("Home".i18n), - icon: const Icon(FilcIcons.home), - selected: widget.selected == "home", - onTap: () { - if (widget.selected != "home") { - widget.navigator.pushReplacementNamed("home"); - widget.onRouteChange("home"); - } - }, - ), - SidebarAction( - title: Text("Grades".i18n), - icon: const Icon(FeatherIcons.bookmark), - selected: widget.selected == "grades", - onTap: () { - if (widget.selected != "grades") { - widget.navigator.pushReplacementNamed("grades"); - widget.onRouteChange("grades"); - } - }, - ), - SidebarAction( - title: Text("Timetable".i18n), - icon: const Icon(FeatherIcons.calendar), - selected: widget.selected == "timetable", - onTap: () { - if (widget.selected != "timetable") { - widget.navigator.pushReplacementNamed("timetable"); - widget.onRouteChange("timetable"); - } - }, - ), - SidebarAction( - title: Text("Messages".i18n), - icon: const Icon(FeatherIcons.messageSquare), - selected: widget.selected == "messages", - onTap: () { - if (widget.selected != "messages") { - widget.navigator.pushReplacementNamed("messages"); - widget.onRouteChange("messages"); - } - }, - ), - SidebarAction( - title: Text("Absences".i18n), - icon: const Icon(FeatherIcons.clock), - selected: widget.selected == "absences", - onTap: () { - if (widget.selected != "absences") { - widget.navigator.pushReplacementNamed("absences"); - widget.onRouteChange("absences"); - } - }, - ), - ]; - - List bottomActions = [ - SidebarAction( - title: Text("Settings".i18n), - selected: true, - icon: const Icon(FeatherIcons.settings), - onTap: () { - if (topNav != "settings") { - widget.navigator - .push(CupertinoPageRoute( - builder: (context) => const SettingsScreen())) - .then((value) => topNav = ""); - topNav = "settings"; - } - }, - ), - ]; - - buildAccountTiles(); - - List accountWidgets = [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: Column(children: accountTiles), - ), - - // Account settings - PanelButton( - onPressed: () { - Navigator.of(context).pushNamed("login_back"); - }, - title: Text("adduser".i18n), - leading: const Icon(FeatherIcons.userPlus), - ), - PanelButton( - onPressed: () async { - String? userId = user.id; - if (userId == null) return; - - // revoke refresh token - await Provider.of(context, listen: false).logout(); - - // delete user from app - user.removeUser(userId); - // ignore: use_build_context_synchronously - await Provider.of(context, listen: false) - .store - .removeUser(userId); - - // if no other users left, go back to login screen - if (user.getUsers().isNotEmpty) { - user.setUser(user.getUsers().first.id); - restore().then((_) => user.setUser(user.getUsers().first.id)); - } else { - // ignore: use_build_context_synchronously - Navigator.of(context) - .pushNamedAndRemoveUntil("login", (_) => false); - } - }, - title: Text("logout".i18n), - leading: Icon(FeatherIcons.logOut, color: AppColors.of(context).red), - ), - ]; - - return SizedBox( - height: double.infinity, - width: 250.0, - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only( - left: 12.0, - top: 18.0, - bottom: 24.0, - right: 12.0, - ), - child: InkWell( - customBorder: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10)), - onTap: () { - setState(() { - expandAccount = !expandAccount; - }); - }, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.only( - right: 12.0, - left: 5.0, - top: 5.0, - bottom: 5.0, - ), - child: ProfileImage( - name: firstName, - radius: 18.0, - backgroundColor: Theme.of(context) - .colorScheme - .primary, //!settings.presentationMode - // ? ColorUtils.stringToColor(user.name ?? "?") - // : Theme.of(context).colorScheme.secondary, - ), - ), - Expanded( - child: Text( - firstName, - style: const TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.w600, - ), - ), - ), - PageTransitionSwitcher( - transitionBuilder: - (child, primaryAnimation, secondaryAnimation) { - return FadeThroughTransition( - fillColor: Colors.transparent, - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - child: child, - ); - }, - child: IconButton( - key: Key(expandAccount ? "accounts" : "pages"), - icon: Icon(expandAccount - ? FeatherIcons.chevronDown - : FeatherIcons.chevronRight), - padding: EdgeInsets.zero, - onPressed: () { - setState(() { - expandAccount = !expandAccount; - }); - }, - splashColor: const Color(0x00000000), - focusColor: const Color(0x00000000), - hoverColor: const Color(0x00000000), - highlightColor: const Color(0x00000000), - ), - ), - ], - ), - ), - ), - - // Pages - Expanded( - child: PageTransitionSwitcher( - duration: const Duration(milliseconds: 500), - transitionBuilder: (child, primaryAnimation, secondaryAnimation) { - return SharedAxisTransition( - fillColor: Colors.transparent, - animation: primaryAnimation, - secondaryAnimation: secondaryAnimation, - transitionType: SharedAxisTransitionType.scaled, - child: child, - ); - }, - child: !expandAccount - ? Column( - key: const Key("pages"), - children: pageWidgets, - ) - : Column( - key: const Key("accounts"), - children: accountWidgets, - ), - ), - ), - - // Settings - ...bottomActions, - - // Bottom padding - const SizedBox(height: 12.0), - ], - ), - ); - } - - void buildAccountTiles() { - accountTiles = []; - user.getUsers().forEach((account) { - if (account.id == user.id) return; - - String _firstName; - - List _nameParts = user.name?.split(" ") ?? ["?"]; - if (!settings.presentationMode) { - _firstName = _nameParts.length > 1 ? _nameParts[1] : _nameParts[0]; - } else { - _firstName = "János"; - } - - accountTiles.add(AccountTile( - name: Text(!settings.presentationMode ? account.name : "János", - style: const TextStyle(fontWeight: FontWeight.w500)), - username: - Text(!settings.presentationMode ? account.username : "72469696969"), - profileImage: ProfileImage( - name: _firstName, - backgroundColor: !settings.presentationMode - ? ColorUtils.stringToColor(account.name) - : Theme.of(context).colorScheme.secondary, - role: account.role, - ), - onTap: () { - user.setUser(account.id); - restore().then((_) => user.setUser(account.id)); - }, - // onTapMenu: () => _showBottomSheet(account), - )); - }); - } -} diff --git a/refilc_desktop_ui/lib/screens/navigation/sidebar.i18n.dart b/refilc_desktop_ui/lib/screens/navigation/sidebar.i18n.dart deleted file mode 100644 index 43cfb8a..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/sidebar.i18n.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension SettingsLocalization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "Home": "Home", - "Grades": "Grades", - "Timetable": "Timetable", - "Messages": "Messages", - "Absences": "Absences", - "Settings": "Settings", - "adduser": "Add User", - "logout": "Log Out", - }, - "hu_hu": { - "Home": "Kezdőlap", - "Grades": "Jegyek", - "Timetable": "Órarend", - "Messages": "Üzenetek", - "Absences": "Hiányzások", - "Settings": "Beállítások", - "adduser": "Fiók hozzáadása", - "logout": "Kilépés", - }, - "de_de": { - "Home": "Zuhause", - "Grades": "Noten", - "Timetable": "Zeitplan", - "Messages": "Mitteilungen", - "Absences": "Fehlen", - "Settings": "Einstellungen", - "adduser": "Benutzer hinzufügen", - "logout": "Abmelden", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/lib/screens/navigation/sidebar_action.dart b/refilc_desktop_ui/lib/screens/navigation/sidebar_action.dart deleted file mode 100644 index c718607..0000000 --- a/refilc_desktop_ui/lib/screens/navigation/sidebar_action.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:refilc/theme/colors/colors.dart'; - -class SidebarAction extends StatelessWidget { - const SidebarAction( - {super.key, this.title, this.icon, this.onTap, this.selected = false}); - - final bool selected; - final Widget? icon; - final Widget? title; - final Function()? onTap; - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 12.0), - child: InkWell( - onTap: onTap, - borderRadius: BorderRadius.circular(12.0), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - if (icon != null) - IconTheme( - data: IconThemeData( - color: AppColors.of(context) - .text - .withOpacity(selected ? 1.0 : .3), - ), - child: icon!, - ), - if (title != null) - Padding( - padding: const EdgeInsets.only(left: 24.0), - child: AnimatedDefaultTextStyle( - duration: const Duration(milliseconds: 500), - style: TextStyle( - color: AppColors.of(context) - .text - .withOpacity(selected ? 1.0 : .8), - fontWeight: FontWeight.w500, - fontFamily: "Montserrat", - ), - child: title!, - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/refilc_desktop_ui/lib/screens/news/news_view.dart b/refilc_desktop_ui/lib/screens/news/news_view.dart deleted file mode 100644 index e276692..0000000 --- a/refilc_desktop_ui/lib/screens/news/news_view.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/material.dart'; - -class NewsView extends StatelessWidget { - const NewsView({super.key}); - - @override - Widget build(BuildContext context) { - return Container(); - } -} diff --git a/refilc_desktop_ui/lib/screens/settings/settings_screen.dart b/refilc_desktop_ui/lib/screens/settings/settings_screen.dart deleted file mode 100644 index e8ca7a8..0000000 --- a/refilc_desktop_ui/lib/screens/settings/settings_screen.dart +++ /dev/null @@ -1,965 +0,0 @@ -// ignore_for_file: no_leading_underscores_for_local_identifiers - -import 'package:refilc/api/providers/update_provider.dart'; -import 'package:refilc_kreta_api/providers/absence_provider.dart'; -import 'package:refilc_kreta_api/providers/event_provider.dart'; -import 'package:refilc_kreta_api/providers/exam_provider.dart'; -import 'package:refilc_kreta_api/providers/grade_provider.dart'; -import 'package:refilc_kreta_api/providers/homework_provider.dart'; -import 'package:refilc_kreta_api/providers/message_provider.dart'; -import 'package:refilc_kreta_api/providers/note_provider.dart'; -import 'package:refilc_kreta_api/providers/timetable_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/utils/format.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/models/user.dart'; -import 'package:refilc/theme/colors/colors.dart'; -import 'package:refilc_kreta_api/client/client.dart'; -import 'package:refilc_mobile_ui/common/action_button.dart'; -import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart'; -import 'package:refilc_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart'; -import 'package:refilc_mobile_ui/common/panel/panel.dart'; -import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; -import 'package:refilc_mobile_ui/common/profile_image/profile_image.dart'; -import 'package:refilc_mobile_ui/common/widgets/update/updates_view.dart'; -import 'package:refilc_mobile_ui/plus/premium_button.dart'; -import 'package:refilc_mobile_ui/screens/news/news_screen.dart'; -import 'package:refilc_mobile_ui/screens/settings/accounts/account_tile.dart'; -import 'package:refilc_mobile_ui/screens/settings/accounts/account_view.dart'; -import 'package:refilc_mobile_ui/screens/settings/debug/subject_icon_gallery.dart'; -import 'package:refilc_mobile_ui/screens/settings/privacy_view.dart'; -import 'package:refilc_mobile_ui/screens/settings/settings_helper.dart'; -import 'package:refilc_plus/providers/plus_provider.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as tabs; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; -import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'settings_screen.i18n.dart'; -import 'package:flutter/services.dart'; -import 'package:refilc_mobile_ui/screens/settings/user/nickname.dart'; - -class SettingsScreen extends StatefulWidget { - const SettingsScreen({super.key}); - - @override - SettingsScreenState createState() => SettingsScreenState(); -} - -class SettingsScreenState extends State - with SingleTickerProviderStateMixin { - int devmodeCountdown = 3; - final bool __ss = false; // secret settings - - late UserProvider user; - late UpdateProvider updateProvider; - late SettingsProvider settings; - late KretaClient kretaClient; - late String firstName; - List accountTiles = []; - - late AnimationController _hideContainersController; - - Future restore() => Future.wait([ - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restoreUser(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false) - .restoreRecipients(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).restore(), - Provider.of(context, listen: false).refreshLogin(), - ]); - - void buildAccountTiles() { - accountTiles = []; - user.getUsers().forEach((account) { - if (account.id == user.id) return; - - String _firstName; - - List _nameParts = user.displayName?.split(" ") ?? ["?"]; - if (!settings.presentationMode) { - _firstName = _nameParts.length > 1 ? _nameParts[1] : _nameParts[0]; - } else { - _firstName = "János"; - } - - accountTiles.add(AccountTile( - name: Text(!settings.presentationMode ? account.name : "János", - style: const TextStyle(fontWeight: FontWeight.w500)), - username: - Text(!settings.presentationMode ? account.username : "72469696969"), - profileImage: ProfileImage( - name: _firstName, - backgroundColor: Theme.of(context) - .colorScheme - .secondary, //!settings.presentationMode - //? ColorUtils.stringToColor(account.name) - //: Theme.of(context).colorScheme.secondary, - role: account.role, - ), - onTap: () { - user.setUser(account.id); - restore().then((_) => user.setUser(account.id)); - Navigator.of(context).pop(); - }, - onTapMenu: () => _showBottomSheet(account), - )); - }); - } - - void _showBottomSheet(User u) { - showBottomSheetMenu(context, items: [ - BottomSheetMenuItem( - onPressed: () => AccountView.show(u, context: context), - icon: const Icon(FeatherIcons.user), - title: Text("personal_details".i18n), - ), - BottomSheetMenuItem( - onPressed: () => _openDKT(u), - icon: Icon(FeatherIcons.grid, color: AppColors.of(context).teal), - title: Text("open_dkt".i18n), - ), - UserMenuNickname(u), - // BottomSheetMenuItem( - // onPressed: () {}, - // icon: Icon(FeatherIcons.camera), - // title: Text("edit_profile_picture".i18n), - // ), - // BottomSheetMenuItem( - // onPressed: () {}, - // icon: Icon(FeatherIcons.trash2, color: AppColors.of(context).red), - // title: Text("remove_profile_picture".i18n), - // ), - ]); - } - - void _openDKT(User u) => tabs.launchUrl( - Uri.parse( - "https://dkttanulo.e-kreta.hu/sso?id_token=${kretaClient.idToken}"), - customTabsOptions: tabs.CustomTabsOptions( - showTitle: true, - colorSchemes: tabs.CustomTabsColorSchemes( - defaultPrams: tabs.CustomTabsColorSchemeParams( - toolbarColor: Theme.of(context).scaffoldBackgroundColor, - ), - ), - ), - ); - - @override - void initState() { - super.initState(); - _hideContainersController = AnimationController( - vsync: this, duration: const Duration(milliseconds: 200)); - } - - @override - Widget build(BuildContext context) { - user = Provider.of(context); - settings = Provider.of(context); - updateProvider = Provider.of(context); - kretaClient = Provider.of(context); - - List nameParts = user.displayName?.split(" ") ?? ["?"]; - if (!settings.presentationMode) { - firstName = nameParts.length > 1 ? nameParts[1] : nameParts[0]; - } else { - firstName = "János"; - } - - String startPageTitle = - SettingsHelper.localizedPageTitles()[settings.startPage] ?? "?"; - String themeModeText = { - ThemeMode.light: "light".i18n, - ThemeMode.dark: "dark".i18n, - ThemeMode.system: "system".i18n - }[settings.theme] ?? - "?"; - String languageText = SettingsHelper.langMap[settings.language] ?? "?"; - String vibrateTitle = { - VibrationStrength.off: "voff".i18n, - VibrationStrength.light: "vlight".i18n, - VibrationStrength.medium: "vmedium".i18n, - VibrationStrength.strong: "vstrong".i18n, - }[settings.vibrate] ?? - "?"; - - buildAccountTiles(); - - if (settings.developerMode) devmodeCountdown = -1; - - return Scaffold( - body: Padding( - padding: const EdgeInsets.only(top: 11.5), - child: CustomScrollView( - slivers: [ - SliverAppBar( - pinned: true, - floating: true, - snap: false, - centerTitle: false, - title: const Text("Settings"), - surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, - ), - SliverToBoxAdapter( - child: AnimatedBuilder( - animation: _hideContainersController, - builder: (context, child) => Opacity( - opacity: 1 - _hideContainersController.value, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - StaggeredGrid.extent( - // direction: Axis.horizontal, - // crossAxisCount: 3, - maxCrossAxisExtent: 600, - children: [ - const SizedBox(height: 32.0), - - // Updates - if (updateProvider.available) - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - child: PanelButton( - onPressed: () => _openUpdates(context), - title: Text("update_available".i18n), - leading: const Icon(FeatherIcons.download), - trailing: Text( - updateProvider.releases.first.tag, - style: TextStyle( - fontWeight: FontWeight.w500, - color: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ), - ), - ), - ), - - // const Padding( - // padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0), - // child: PremiumBannerButton(), - // ), - if (!Provider.of(context).hasPremium) - const ClipRect( - child: Padding( - padding: EdgeInsets.symmetric(vertical: 12.0), - child: PremiumButton(), - ), - ), - - // General Settings - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("general".i18n), - child: Column( - children: [ - PanelButton( - onPressed: () { - SettingsHelper.language(context); - setState(() {}); - }, - title: Text("language".i18n), - leading: const Icon(FeatherIcons.globe), - trailing: Text(languageText), - ), - PanelButton( - onPressed: () { - SettingsHelper.startPage(context); - setState(() {}); - }, - title: Text("startpage".i18n), - leading: const Icon(FeatherIcons.play), - trailing: Text(startPageTitle.capital()), - ), - PanelButton( - onPressed: () { - SettingsHelper.rounding(context); - setState(() {}); - }, - title: Text("rounding".i18n), - leading: - const Icon(FeatherIcons.gitCommit), - trailing: Text((settings.rounding / 10) - .toStringAsFixed(1)), - ), - PanelButton( - onPressed: () { - SettingsHelper.vibrate(context); - setState(() {}); - }, - title: Text("vibrate".i18n), - leading: const Icon(FeatherIcons.radio), - trailing: Text(vibrateTitle), - ), - PanelButton( - padding: - const EdgeInsets.only(left: 14.0), - onPressed: () { - SettingsHelper.bellDelay(context); - setState(() {}); - }, - title: Text( - "bell_delay".i18n, - style: TextStyle( - color: AppColors.of(context) - .text - .withOpacity( - settings.bellDelayEnabled - ? 1.0 - : .5)), - ), - leading: settings.bellDelayEnabled - ? const Icon(FeatherIcons.bell) - : Icon(FeatherIcons.bellOff, - color: AppColors.of(context) - .text - .withOpacity(.25)), - trailingDivider: true, - trailing: Switch( - onChanged: (v) => settings.update( - bellDelayEnabled: v), - value: settings.bellDelayEnabled, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ], - ), - ), - ), - ), - - if (kDebugMode) - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: const Text("Debug"), - child: Column( - children: [ - PanelButton( - title: - const Text("Subject Icon Gallery"), - leading: const Icon(CupertinoIcons - .rectangle_3_offgrid_fill), - trailing: - const Icon(Icons.arrow_forward), - onPressed: () { - Navigator.of(context, - rootNavigator: true) - .push( - CupertinoPageRoute( - builder: (context) => - const SubjectIconGallery()), - ); - }, - ) - ], - ), - ), - ), - ), - - // Secret Settings - if (__ss) - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("secret".i18n), - child: Column( - children: [ - // Good student mode - Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: Text("goodstudent".i18n, - style: const TextStyle( - fontWeight: FontWeight.w500)), - onChanged: (v) { - if (v) { - showDialog( - context: context, - builder: (context) => PopScope( - onPopInvoked: (didPop) => - false, - child: AlertDialog( - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 12.0)), - title: - Text("attention".i18n), - content: Text( - "goodstudent_disclaimer" - .i18n), - actions: [ - ActionButton( - label: - "understand".i18n, - onTap: () { - Navigator.of( - context) - .pop(); - settings.update( - goodStudent: v); - Provider.of( - context, - listen: - false) - .fetch(); - }) - ], - ), - ), - ); - } else { - settings.update(goodStudent: v); - Provider.of( - context, - listen: false) - .fetch(); - } - }, - value: settings.goodStudent, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - - // Presentation mode - Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: const Text("Presentation Mode", - style: TextStyle( - fontWeight: FontWeight.w500)), - onChanged: (v) => settings.update( - presentationMode: v), - value: settings.presentationMode, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ], - ), - ), - ), - ), - - // Theme Settings - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("appearance".i18n), - child: Column( - children: [ - PanelButton( - onPressed: () { - SettingsHelper.theme(context); - setState(() {}); - }, - title: Text("theme".i18n), - leading: const Icon(FeatherIcons.sun), - trailing: Text(themeModeText), - ), - PanelButton( - onPressed: () async { - await _hideContainersController - .forward(); - // ignore: use_build_context_synchronously - SettingsHelper.accentColor(context); - setState(() {}); - _hideContainersController.reset(); - }, - title: Text("color".i18n), - leading: const Icon(FeatherIcons.droplet), - trailing: Container( - width: 12.0, - height: 12.0, - decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .secondary, - shape: BoxShape.circle, - ), - ), - ), - PanelButton( - onPressed: () { - SettingsHelper.gradeColors(context); - setState(() {}); - }, - title: Text("grade_colors".i18n), - leading: const Icon(FeatherIcons.star), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: List.generate( - 5, - (i) => Container( - margin: const EdgeInsets.only( - left: 2.0), - width: 12.0, - height: 12.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: settings.gradeColors[i], - ), - ), - ), - ), - ), - Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: Row( - children: [ - Icon( - FeatherIcons.barChart, - color: settings.graphClassAvg - ? Theme.of(context) - .colorScheme - .secondary - : AppColors.of(context) - .text - .withOpacity(.25), - ), - const SizedBox(width: 24.0), - Expanded( - child: Text( - "graph_class_avg".i18n, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16.0, - color: AppColors.of(context) - .text - .withOpacity( - settings.graphClassAvg - ? 1.0 - : .5), - ), - ), - ), - ], - ), - onChanged: (v) => - settings.update(graphClassAvg: v), - value: settings.graphClassAvg, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - // we need icon pack selector here - // const PremiumIconPackSelector(), - ], - ), - ), - ), - ), - - // Notifications - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("notifications".i18n), - child: Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: Row( - children: [ - Icon( - Icons.newspaper_outlined, - color: settings.newsEnabled - ? Theme.of(context) - .colorScheme - .secondary - : AppColors.of(context) - .text - .withOpacity(.25), - ), - const SizedBox(width: 24.0), - Expanded( - child: Text( - "news".i18n, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16.0, - color: AppColors.of(context) - .text - .withOpacity( - settings.newsEnabled - ? 1.0 - : .5), - ), - ), - ), - ], - ), - onChanged: (v) => - settings.update(newsEnabled: v), - value: settings.newsEnabled, - activeColor: - Theme.of(context).colorScheme.secondary, - ), - ), - ), - ), - ), - - // Extras - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("extras".i18n), - child: Column(children: [ - Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: Row( - children: [ - Icon( - FeatherIcons.gift, - color: settings.gradeOpeningFun - ? Theme.of(context) - .colorScheme - .secondary - : AppColors.of(context) - .text - .withOpacity(.25), - ), - const SizedBox(width: 24.0), - Expanded( - child: Text( - "surprise_grades".i18n, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16.0, - color: AppColors.of(context) - .text - .withOpacity( - settings.gradeOpeningFun - ? 1.0 - : .5), - ), - ), - ), - ], - ), - onChanged: (v) => - settings.update(gradeOpeningFun: v), - value: settings.gradeOpeningFun, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ]), - ), - ), - ), - - // About - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: Text("about".i18n), - child: Column(children: [ - PanelButton( - leading: const Icon(FeatherIcons.atSign), - title: const Text("Discord"), - onPressed: () => launchUrl( - Uri.parse("https://refilc.hu/discord"), - mode: LaunchMode.externalApplication), - ), - PanelButton( - leading: const Icon(FeatherIcons.globe), - title: const Text("www.refilc.hu"), - onPressed: () => launchUrl( - Uri.parse("https://refilc.hu"), - mode: LaunchMode.externalApplication), - ), - PanelButton( - leading: const Icon(FeatherIcons.github), - title: const Text("Github"), - onPressed: () => launchUrl( - Uri.parse("https://github.com/filc"), - mode: LaunchMode.externalApplication), - ), - PanelButton( - leading: const Icon(FeatherIcons.mail), - title: Text("news".i18n), - onPressed: () => _openNews(context), - ), - PanelButton( - leading: const Icon(FeatherIcons.lock), - title: Text("privacy".i18n), - onPressed: () => _openPrivacy(context), - ), - PanelButton( - leading: const Icon(FeatherIcons.award), - title: Text("licenses".i18n), - onPressed: () => - showLicensePage(context: context), - ), - Tooltip( - message: "data_collected".i18n, - padding: const EdgeInsets.all(4.0), - textStyle: TextStyle( - fontWeight: FontWeight.w500, - color: AppColors.of(context).text), - decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .surface), - child: Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - secondary: Icon( - FeatherIcons.barChart2, - color: settings.xFilcId != "none" - ? Theme.of(context) - .colorScheme - .secondary - : AppColors.of(context) - .text - .withOpacity(.25), - ), - title: Text( - "Analytics".i18n, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16.0, - color: AppColors.of(context) - .text - .withOpacity( - settings.xFilcId != "none" - ? 1.0 - : .5), - ), - ), - subtitle: Text( - "Anonymous Usage Analytics".i18n, - style: TextStyle( - color: AppColors.of(context) - .text - .withOpacity( - settings.xFilcId != "none" - ? .5 - : .2), - ), - ), - onChanged: (v) { - String newId; - if (v == false) { - newId = "none"; - } else if (settings.xFilcId == - "none") { - newId = SettingsProvider - .defaultSettings() - .xFilcId; - } else { - newId = settings.xFilcId; - } - settings.update(xFilcId: newId); - }, - value: settings.xFilcId != "none", - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - ), - ]), - ), - ), - ), - if (settings.developerMode) - Container( - constraints: const BoxConstraints(maxWidth: 500), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12.0, horizontal: 24.0), - child: Panel( - title: const Text("Developer Settings"), - child: Column( - children: [ - Material( - type: MaterialType.transparency, - child: SwitchListTile( - contentPadding: - const EdgeInsets.only(left: 12.0), - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(12.0)), - title: const Text("Developer Mode", - style: TextStyle( - fontWeight: FontWeight.w500)), - onChanged: (v) => settings.update( - developerMode: false), - value: settings.developerMode, - activeColor: Theme.of(context) - .colorScheme - .secondary, - ), - ), - PanelButton( - leading: const Icon(FeatherIcons.copy), - title: const Text("Copy JWT"), - onPressed: () => Clipboard.setData( - ClipboardData( - text: Provider.of( - context, - listen: false) - .accessToken!)), - ), - // if (Provider.of(context, - // listen: false) - // .hasPremium) - // PanelButton( - // leading: const Icon(FeatherIcons.key), - // title: const Text("Remove Premium"), - // onPressed: () { - // Provider.of( - // context, - // listen: false) - // .activate(removePremium: true); - // settings.update( - // accentColor: AccentColor.filc, - // store: true); - // Provider.of( - // context, - // listen: false) - // .changeTheme(settings.theme); - // }, - // ), - ], - ), - ), - ), - ), - ], - ), - const SizedBox( - height: 40, - ), - SafeArea( - top: false, - child: Center( - child: GestureDetector( - child: const Panel( - title: Text( - "v${const String.fromEnvironment("APPVER", defaultValue: "?")}")), - onTap: () { - if (devmodeCountdown > 0) { - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - duration: const Duration(milliseconds: 200), - content: Text( - "You are $devmodeCountdown taps away from Developer Mode."), - )); - - setState(() => devmodeCountdown--); - } else if (devmodeCountdown == 0) { - ScaffoldMessenger.of(context) - .showSnackBar(const SnackBar( - content: Text( - "Developer Mode successfully activated."), - )); - - settings.update(developerMode: true); - - setState(() => devmodeCountdown--); - } - }, - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } - - void _openNews(BuildContext context) => - Navigator.of(context, rootNavigator: true) - .push(CupertinoPageRoute(builder: (context) => const NewsScreen())); - void _openUpdates(BuildContext context) => - UpdateView.show(updateProvider.releases.first, context: context); - void _openPrivacy(BuildContext context) => PrivacyView.show(context); -} diff --git a/refilc_desktop_ui/lib/screens/settings/settings_screen.i18n.dart b/refilc_desktop_ui/lib/screens/settings/settings_screen.i18n.dart deleted file mode 100644 index 65dc67e..0000000 --- a/refilc_desktop_ui/lib/screens/settings/settings_screen.i18n.dart +++ /dev/null @@ -1,191 +0,0 @@ -import 'package:i18n_extension/i18n_extension.dart'; - -extension SettingsLocalization on String { - static final _t = Translations.byLocale("hu_hu") + - { - "en_en": { - "personal_details": "Personal Details", - "open_dkt": "Open DCS", - "edit_nickname": "Edit Nickname", - "edit_profile_picture": "Edit Profile Picture", - "remove_profile_picture": "Remove Profile Picture", - "light": "Light", - "dark": "Dark", - "system": "System", - "add_user": "Add User", - "log_out": "Log Out", - "update_available": "Update Available", - "general": "General", - "language": "Language", - "startpage": "Startpage", - "rounding": "Rounding", - "appearance": "Appearance", - "theme": "Theme", - "color": "Color", - "grade_colors": "Grade Colors", - "notifications": "Notifications", - "news": "News", - "extras": "Extras", - "about": "About", - "supporters": "Supporters", - "privacy": "Privacy Policy", - "licenses": "Licenses", - "vibrate": "Vibration", - "voff": "Off", - "vlight": "Light", - "vmedium": "Medium", - "vstrong": "Strong", - "cancel": "Cancel", - "done": "Done", - "reset": "Reset", - "open": "Open", - "data_collected": - "Data collected: Platform (eg. Android), App version (eg. 3.0.0), Unique Install Identifier", - "Analytics": "Analytics", - "Anonymous Usage Analytics": "Anonymous Usage Analytics", - "graph_class_avg": "Class average on graph", - "goodstudent": "Good student mode", - "attention": "Attention!", - "goodstudent_disclaimer": - "reFilc can not be held liable for the usage of this feature.\n\n(if your mother beats you up because you showed her fake grades, you can only blame yourself for it)", - "understand": "I understand", - "secret": "Secret Settings", - "bell_delay": "Bell Delay", - "delay": "Delay", - "hurry": "Hurry", - "sync": "Synchronize", - "sync_help": "Press the Synchronize button when the bell rings.", - "surprise_grades": "Surprise Grades", - "icon_pack": "Icon Pack", - "change_username": "Set a nickname", - "Accent Color": "Accent Color", - "Background Color": "Background Color", - "Highlight Color": "Highlight Color", - "Adaptive Theme": "Adaptive Theme", - }, - "hu_hu": { - "personal_details": "Személyes információk", - "open_dkt": "DKT megnyitása", - "edit_nickname": "Becenév szerkesztése", - "edit_profile_picture": "Profil-kép szerkesztése", - "remove_profile_picture": "Profil-kép törlése", - "light": "Világos", - "dark": "Sötét", - "system": "Rendszer", - "add_user": "Felhasználó hozzáadása", - "log_out": "Kijelentkezés", - "update_available": "Frissítés elérhető", - "general": "Általános", - "language": "Nyelv", - "startpage": "Kezdőlap", - "rounding": "Kerekítés", - "appearance": "Kinézet", - "theme": "Téma", - "color": "Színek", - "grade_colors": "Jegyek színei", - "notifications": "Értesítések", - "news": "Hírek", - "extras": "Extrák", - "about": "Névjegy", - "supporters": "Támogatók", - "privacy": "Adatvédelmi irányelvek", - "licenses": "Licenszek", - "vibrate": "Rezgés", - "voff": "Kikapcsolás", - "vlight": "Alacsony", - "vmedium": "Közepes", - "vstrong": "Erős", - "cancel": "Mégsem", - "done": "Kész", - "reset": "Visszaállítás", - "open": "Megnyitás", - "data_collected": - "Gyűjtött adat: Platform (pl. Android), App verzió (pl. 3.0.0), Egyedi telepítési azonosító", - "Analytics": "Analitika", - "Anonymous Usage Analytics": "Névtelen használati analitika", - "graph_class_avg": "Osztályátlag a grafikonon", - "goodstudent": "Jó tanuló mód", - "attention": "Figyelem!", - "goodstudent_disclaimer": - "A reFilc minden felelősséget elhárít a funkció használatával kapcsolatban.\n\n(Értsd: ha az anyád megver, mert megtévesztő ábrákat mutattál neki, azért csakis magadadat hibáztathatod.)", - "understand": "Értem", - "secret": "Titkos Beállítások", - "bell_delay": "Csengő eltolódása", - "delay": "Késleltetés", - "hurry": "Siettetés", - "sync": "Szinkronizálás", - "sync_help": "Csengetéskor nyomd meg a Szinkronizálás gombot.", - "surprise_grades": "Meglepetés jegyek", - "icon_pack": "Ikon séma", - "change_username": "Becenév beállítása", - "Accent Color": "Egyedi szín", - "Background Color": "Háttér színe", - "Highlight Color": "Panelek színe", - "Adaptive Theme": "Adaptív téma", - }, - "de_de": { - "personal_details": "Persönliche Angaben", - "open_dkt": "Öffnen RDZ", - "edit_nickname": "Spitznamen bearbeiten", - "edit_profile_picture": "Profilbild bearbeiten", - "remove_profile_picture": "Profilbild entfernen", - "light": "Licht", - "dark": "Dunkel", - "system": "System", - "add_user": "Benutzer hinzufügen", - "log_out": "Abmelden", - "update_available": "Update verfügbar", - "general": "Allgemein", - "language": "Sprache", - "startpage": "Startseite", - "rounding": "Rundung", - "appearance": "Erscheinungsbild", - "theme": "Thema", - "color": "Farbe", - "grade_colors": "Grad Farben", - "notifications": "Benachrichtigungen", - "news": "Nachrichten", - "extras": "Extras", - "about": "Informationen", - "supporters": "Unterstützer", - "privacy": "Datenschutzbestimmungen", - "licenses": "Lizenzen", - "vibrate": "Vibration", - "voff": "Aus", - "vlight": "Leicht", - "vmedium": "Mittel", - "vstrong": "Stark", - "cancel": "Abbrechen", - "done": "Fertig", - "reset": "Zurücksetzen", - "open": "Öffnen", - "data_collected": - "Erhobene Daten: Plattform (z.B. Android), App version (z.B. 3.0.0), Eindeutige Installationskennung", - "Analytics": "Analytik", - "Anonymous Usage Analytics": "Anonyme Nutzungsanalyse", - "graph_class_avg": "Klassendurchschnitt in der Grafik", - "goodstudent": "Guter Student Modus", - "attention": "Achtung!", - "goodstudent_disclaimer": "Same in English.", - "understand": "Ich verstehe", - "secret": "Geheime Einstellungen", - "bell_delay": "Klingelverzögerung", - "delay": "Verzögern", - "hurry": "Eile", - "sync": "Synchronisieren", - "sync_help": "Drücken Sie die Sync-Taste, wenn die Glocke läutet.", - "surprise_grades": "Überraschungsnoten", - "icon_pack": "Icon-Pack", - "change_username": "Einen Spitznamen festlegen", - "Accent Color": "Accent Color", - "Background Color": "Background Color", - "Highlight Color": "Highlight Color", - "Adaptive Theme": "Adaptive Theme", - }, - }; - - String get i18n => localize(this, _t); - String fill(List params) => localizeFill(this, params); - String plural(int value) => localizePlural(value, this, _t); - String version(Object modifier) => localizeVersion(modifier, this, _t); -} diff --git a/refilc_desktop_ui/pubspec.yaml b/refilc_desktop_ui/pubspec.yaml deleted file mode 100644 index aaa822c..0000000 --- a/refilc_desktop_ui/pubspec.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: refilc_desktop_ui -publish_to: "none" - -environment: - sdk: ">=3.3.2 <=3.6.0" - -dependencies: - flutter: - sdk: flutter - - # reFilc Main - refilc: - path: ../refilc/ - # e-KRETA API (kreten) client - refilc_kreta_api: - path: ../refilc_kreta_api/ - # reFilc Plus - refilc_plus: - path: ../refilc_plus/ - # reFilc Mobile - refilc_mobile_ui: - path: ../refilc_mobile_ui/ - - cupertino_icons: ^1.0.2 - flutter_feather_icons: ^2.0.0+1 - provider: ^6.1.1 - url_launcher: ^6.2.5 - flutter_linkify: ^6.0.0 - flutter_markdown: ^0.7.2+1 - animations: ^2.0.11 - confetti: ^0.7.0 - auto_size_text: ^3.0.0 - flutter_acrylic: ^1.1.3 - elegant_notification: ^2.2.0 - flutter_staggered_grid_view: ^0.7.0 - i18n_extension: ^12.0.1 - flutter_expandable_fab: ^2.0.0 - collection: ^1.18.0 - animated_list_plus: ^0.5.2 - intl: ^0.19.0 - flutter_custom_tabs: ^2.0.0+1 - -dev_dependencies: - flutter_lints: ^4.0.0 - -flutter: - uses-material-design: true diff --git a/refilc_kreta_api/devtools_options.yaml b/refilc_kreta_api/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/refilc_kreta_api/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/refilc_kreta_api/lib/controllers/timetable_controller.dart b/refilc_kreta_api/lib/controllers/timetable_controller.dart index 575c916..72ad77d 100644 --- a/refilc_kreta_api/lib/controllers/timetable_controller.dart +++ b/refilc_kreta_api/lib/controllers/timetable_controller.dart @@ -108,7 +108,9 @@ class TimetableController extends ChangeNotifier { // Jump to next week on weekends if (skip && (days?.length ?? 0) > 0 && - days!.last.last.end.isBefore(DateTime.now())) return next(context); + days!.last.last.end.isBefore(DateTime.now())) { + return next(context); + } notifyListeners(); } @@ -149,7 +151,9 @@ class TimetableController extends ChangeNotifier { lessons.sort((a, b) => a.date.compareTo(b.date)); for (var lesson in lessons) { if (days.last.isNotEmpty && - _differentDate(lesson.date, days.last.last.date)) days.add([]); + _differentDate(lesson.date, days.last.last.date)) { + days.add([]); + } days.last.add(lesson); } diff --git a/refilc_kreta_api/lib/providers/grade_provider.dart b/refilc_kreta_api/lib/providers/grade_provider.dart index 804b1e9..5a50792 100644 --- a/refilc_kreta_api/lib/providers/grade_provider.dart +++ b/refilc_kreta_api/lib/providers/grade_provider.dart @@ -148,12 +148,12 @@ class GradeProvider with ChangeNotifier { // streak magic int gradeStreak = 0; List grs = _grades; - grs.sort((a, b) => -a.date.compareTo(b.date)); + grs.sort((a, b) => -a.writeDate.compareTo(b.writeDate)); for (Grade grade in grs) { if (grade.value.value == 5) { gradeStreak++; - } else if (grade.value.value !=0) { + } else if (grade.value.value != 0) { break; } } diff --git a/refilc_kreta_api/pubspec.yaml b/refilc_kreta_api/pubspec.yaml index 40bd093..330a1eb 100644 --- a/refilc_kreta_api/pubspec.yaml +++ b/refilc_kreta_api/pubspec.yaml @@ -2,7 +2,7 @@ name: refilc_kreta_api publish_to: "none" environment: - sdk: ">=3.3.2 <=3.6.0" + sdk: ^3.6.0 dependencies: flutter: @@ -17,4 +17,4 @@ dependencies: uuid: ^4.3.3 dev_dependencies: - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 diff --git a/refilc_mobile_ui/lib/common/action_button.dart b/refilc_mobile_ui/lib/common/action_button.dart index e176766..0abc95e 100644 --- a/refilc_mobile_ui/lib/common/action_button.dart +++ b/refilc_mobile_ui/lib/common/action_button.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; class ActionButton extends StatelessWidget { - const ActionButton({super.key, required this.label, this.activeColor, this.onTap}); + const ActionButton( + {super.key, required this.label, this.activeColor, this.onTap}); final Color? activeColor; final void Function()? onTap; @@ -19,7 +20,8 @@ class ActionButton extends StatelessWidget { curve: Curves.easeInOut, height: 32.0, decoration: BoxDecoration( - color: (activeColor ?? Theme.of(context).colorScheme.secondary).withOpacity(0.25), + color: (activeColor ?? Theme.of(context).colorScheme.secondary) + .withValues(alpha: 0.25), borderRadius: BorderRadius.circular(6.0), ), padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0), @@ -28,7 +30,11 @@ class ActionButton extends StatelessWidget { maxLines: 1, softWrap: false, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, color: activeColor ?? Theme.of(context).colorScheme.secondary))), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.w600, + color: activeColor ?? + Theme.of(context).colorScheme.secondary))), ), ), ); diff --git a/refilc_mobile_ui/lib/common/average_display.dart b/refilc_mobile_ui/lib/common/average_display.dart index ebadd35..c22b6ae 100644 --- a/refilc_mobile_ui/lib/common/average_display.dart +++ b/refilc_mobile_ui/lib/common/average_display.dart @@ -21,7 +21,7 @@ class AverageDisplay extends StatelessWidget { @override Widget build(BuildContext context) { Color color = average == 0.0 - ? AppColors.of(context).text.withOpacity(.8) + ? AppColors.of(context).text.withValues(alpha: .8) : gradeColor(context: context, value: average); String averageText = average.toStringAsFixed(2); @@ -49,16 +49,18 @@ class AverageDisplay extends StatelessWidget { borderRadius: (border && dashed) ? null : BorderRadius.circular(45.0 * scale), border: border && !dashed - ? Border.fromBorderSide( - BorderSide(color: color.withOpacity(.5), width: 1.0 * scale)) + ? Border.fromBorderSide(BorderSide( + color: color.withValues(alpha: .5), width: 1.0 * scale)) + : null, + color: !border + ? color.withValues(alpha: average == 0.0 ? .15 : .25) : null, - color: !border ? color.withOpacity(average == 0.0 ? .15 : .25) : null, ), child: (border && dashed) ? DottedBorder( strokeWidth: 1.0 * scale, padding: EdgeInsets.all(4.0 * scale), - color: color.withOpacity(.5), + color: color.withValues(alpha: .5), dashPattern: const [6, 6], radius: Radius.circular(45.0 * scale), borderType: BorderType.RRect, diff --git a/refilc_mobile_ui/lib/common/bottom_card.dart b/refilc_mobile_ui/lib/common/bottom_card.dart index 689b209..476cc4a 100644 --- a/refilc_mobile_ui/lib/common/bottom_card.dart +++ b/refilc_mobile_ui/lib/common/bottom_card.dart @@ -25,7 +25,7 @@ class BottomCard extends StatelessWidget { margin: const EdgeInsets.only(top: 12.0, bottom: 4.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(45.0), - color: AppColors.of(context).text.withOpacity(0.10), + color: AppColors.of(context).text.withValues(alpha: 0.10), ), ), if (child != null) child!, diff --git a/refilc_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart b/refilc_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart index 8c60603..ac07c95 100644 --- a/refilc_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart +++ b/refilc_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart @@ -38,7 +38,7 @@ class RoundedBottomSheet extends StatelessWidget { margin: const EdgeInsets.only(top: 12.0, bottom: 4.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(45.0), - color: AppColors.of(context).text.withOpacity(0.10), + color: AppColors.of(context).text.withValues(alpha: 0.10), ), ), if (child != null) child!, diff --git a/refilc_mobile_ui/lib/common/chips/beta_chip.dart b/refilc_mobile_ui/lib/common/chips/beta_chip.dart index 2967a47..f8335ba 100644 --- a/refilc_mobile_ui/lib/common/chips/beta_chip.dart +++ b/refilc_mobile_ui/lib/common/chips/beta_chip.dart @@ -16,7 +16,7 @@ class BetaChip extends StatelessWidget { decoration: BoxDecoration( color: !disabled ? Theme.of(context).colorScheme.secondary - : AppColors.of(context).text.withOpacity(.25), + : AppColors.of(context).text.withValues(alpha: .25), borderRadius: BorderRadius.circular(40), ), child: Padding( @@ -28,7 +28,7 @@ class BetaChip extends StatelessWidget { style: TextStyle( fontSize: 10, color: disabled - ? AppColors.of(context).text.withOpacity(.5) + ? AppColors.of(context).text.withValues(alpha: .5) : Colors.white, fontWeight: FontWeight.w600, overflow: TextOverflow.ellipsis, diff --git a/refilc_mobile_ui/lib/common/chips/new_chip.dart b/refilc_mobile_ui/lib/common/chips/new_chip.dart index a482962..ea32b1a 100644 --- a/refilc_mobile_ui/lib/common/chips/new_chip.dart +++ b/refilc_mobile_ui/lib/common/chips/new_chip.dart @@ -11,8 +11,9 @@ class NewChip extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - color: - disabled ? AppColors.of(context).text.withOpacity(.25) : Colors.red, + color: disabled + ? AppColors.of(context).text.withValues(alpha: .25) + : Colors.red, borderRadius: BorderRadius.circular(12.0), ), padding: @@ -23,7 +24,7 @@ class NewChip extends StatelessWidget { Icon( Icons.hotel_class_rounded, color: disabled - ? AppColors.of(context).text.withOpacity(.5) + ? AppColors.of(context).text.withValues(alpha: .5) : Colors.white, size: 14.0, ), @@ -32,7 +33,7 @@ class NewChip extends StatelessWidget { 'new'.i18n, style: TextStyle( color: disabled - ? AppColors.of(context).text.withOpacity(.5) + ? AppColors.of(context).text.withValues(alpha: .5) : Colors.white, fontSize: 12.0, fontWeight: FontWeight.bold, diff --git a/refilc_mobile_ui/lib/common/custom_snack_bar.dart b/refilc_mobile_ui/lib/common/custom_snack_bar.dart index 789c7db..6b2ccc5 100644 --- a/refilc_mobile_ui/lib/common/custom_snack_bar.dart +++ b/refilc_mobile_ui/lib/common/custom_snack_bar.dart @@ -24,7 +24,7 @@ SnackBar CustomSnackBar({ color: _backgroundColor, borderRadius: BorderRadius.circular(6.0), boxShadow: [ - BoxShadow(color: Colors.black.withOpacity(.15), blurRadius: 4.0) + BoxShadow(color: Colors.black.withValues(alpha: .15), blurRadius: 4.0) ], ), padding: const EdgeInsets.all(12.0), diff --git a/refilc_mobile_ui/lib/common/detail.dart b/refilc_mobile_ui/lib/common/detail.dart index 1882e15..47f9bd9 100644 --- a/refilc_mobile_ui/lib/common/detail.dart +++ b/refilc_mobile_ui/lib/common/detail.dart @@ -26,7 +26,7 @@ class Detail extends StatelessWidget { text: description, style: TextStyle( fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.85)), + color: AppColors.of(context).text.withValues(alpha: 0.85)), ), ], ), diff --git a/refilc_mobile_ui/lib/common/empty.dart b/refilc_mobile_ui/lib/common/empty.dart index fd484c5..04ec3a5 100644 --- a/refilc_mobile_ui/lib/common/empty.dart +++ b/refilc_mobile_ui/lib/common/empty.dart @@ -34,7 +34,7 @@ class Empty extends StatelessWidget { style: TextStyle( fontSize: 32.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(.75)), + color: AppColors.of(context).text.withValues(alpha: .75)), children: subtitle != null ? [ TextSpan( @@ -42,7 +42,9 @@ class Empty extends StatelessWidget { style: TextStyle( fontSize: 18.0, height: 2.0, - color: AppColors.of(context).text.withOpacity(.5))) + color: AppColors.of(context) + .text + .withValues(alpha: .5))) ] : [], ), diff --git a/refilc_mobile_ui/lib/common/filter_bar.dart b/refilc_mobile_ui/lib/common/filter_bar.dart index e4e1f04..4d7a32d 100644 --- a/refilc_mobile_ui/lib/common/filter_bar.dart +++ b/refilc_mobile_ui/lib/common/filter_bar.dart @@ -56,12 +56,12 @@ class _FilterBarState extends State { ), labelPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3), labelColor: Theme.of(context).colorScheme.secondary, - unselectedLabelColor: AppColors.of(context).text.withOpacity(0.65), + unselectedLabelColor: AppColors.of(context).text.withValues(alpha: 0.65), // indicator indicatorSize: TabBarIndicatorSize.tab, indicatorPadding: const EdgeInsets.symmetric(vertical: 8.0), indicator: BoxDecoration( - color: Theme.of(context).colorScheme.tertiary.withOpacity(.2), + color: Theme.of(context).colorScheme.tertiary.withValues(alpha: .2), borderRadius: BorderRadius.circular(45.0), ), overlayColor: WidgetStateProperty.all(const Color(0x00000000)), @@ -77,7 +77,7 @@ class _FilterBarState extends State { width: e, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ), diff --git a/refilc_mobile_ui/lib/common/hero_scrollview.dart b/refilc_mobile_ui/lib/common/hero_scrollview.dart index c6f6a35..3945f97 100644 --- a/refilc_mobile_ui/lib/common/hero_scrollview.dart +++ b/refilc_mobile_ui/lib/common/hero_scrollview.dart @@ -79,7 +79,7 @@ class HeroScrollViewState extends State { child: Row( children: [ Icon(widget.icon, - color: AppColors.of(context).text.withOpacity(.8)), + color: AppColors.of(context).text.withValues(alpha: .8)), const SizedBox(width: 8.0), Expanded( child: Text( @@ -123,7 +123,7 @@ class HeroScrollViewState extends State { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.4), + .withValues(alpha: 0.4), width: MediaQuery.of(context).size.width, fit: BoxFit.cover, ), @@ -135,10 +135,10 @@ class HeroScrollViewState extends State { Theme.of(context).scaffoldBackgroundColor, Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context).scaffoldBackgroundColor, ], stops: const [0.1, 0.5, 0.7, 0.98], @@ -164,7 +164,7 @@ class HeroScrollViewState extends State { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.9), + .withValues(alpha: 0.9), width: 1.5, padding: 12.0, icon: Icon( @@ -175,7 +175,7 @@ class HeroScrollViewState extends State { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.8), + .withValues(alpha: 0.8), ), ), ), @@ -192,7 +192,7 @@ class HeroScrollViewState extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 26.0, - color: AppColors.of(context).text.withOpacity(.8), + color: AppColors.of(context).text.withValues(alpha: .8), fontStyle: widget.italic ? FontStyle.italic : null, fontWeight: FontWeight.bold, ), diff --git a/refilc_mobile_ui/lib/common/material_action_button.dart b/refilc_mobile_ui/lib/common/material_action_button.dart index 46217f7..50c14e8 100644 --- a/refilc_mobile_ui/lib/common/material_action_button.dart +++ b/refilc_mobile_ui/lib/common/material_action_button.dart @@ -19,7 +19,8 @@ class MaterialActionButton extends StatelessWidget { return RawMaterialButton( padding: const EdgeInsets.symmetric(horizontal: 16.0), shape: const StadiumBorder(), - fillColor: backgroundColor ?? AppColors.of(context).text.withOpacity(.15), + fillColor: + backgroundColor ?? AppColors.of(context).text.withValues(alpha: .15), elevation: 0, highlightElevation: 0, onPressed: onPressed, diff --git a/refilc_mobile_ui/lib/common/outlined_round_button.dart b/refilc_mobile_ui/lib/common/outlined_round_button.dart index ae3fd5c..8306fbf 100644 --- a/refilc_mobile_ui/lib/common/outlined_round_button.dart +++ b/refilc_mobile_ui/lib/common/outlined_round_button.dart @@ -24,7 +24,8 @@ class OutlinedRoundButton extends StatelessWidget { decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, border: Border.all( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.1), + color: + Theme.of(context).colorScheme.secondary.withValues(alpha: 0.1), width: 1.1, ), borderRadius: BorderRadius.circular(8.0), diff --git a/refilc_mobile_ui/lib/common/panel/panel.dart b/refilc_mobile_ui/lib/common/panel/panel.dart index 3c61396..60ee500 100644 --- a/refilc_mobile_ui/lib/common/panel/panel.dart +++ b/refilc_mobile_ui/lib/common/panel/panel.dart @@ -67,7 +67,7 @@ class PanelTitle extends StatelessWidget { child: DefaultTextStyle( style: Theme.of(context).textTheme.titleMedium!.copyWith( fontWeight: FontWeight.w600, - color: AppColors.of(context).text.withOpacity(0.65)), + color: AppColors.of(context).text.withValues(alpha: 0.65)), child: title, ), ); diff --git a/refilc_mobile_ui/lib/common/panel/panel_action_button.dart b/refilc_mobile_ui/lib/common/panel/panel_action_button.dart index 0b78409..ecbdf8f 100644 --- a/refilc_mobile_ui/lib/common/panel/panel_action_button.dart +++ b/refilc_mobile_ui/lib/common/panel/panel_action_button.dart @@ -23,18 +23,28 @@ class PanelActionButton extends StatelessWidget { padding: padding, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), - side: BorderSide(color: Theme.of(context).colorScheme.secondary.withOpacity(.6), width: 2), + side: BorderSide( + color: + Theme.of(context).colorScheme.secondary.withValues(alpha: .6), + width: 2), ), child: ListTile( leading: leading != null ? Theme( - data: Theme.of(context).copyWith(iconTheme: IconThemeData(color: Theme.of(context).colorScheme.secondary)), + data: Theme.of(context).copyWith( + iconTheme: IconThemeData( + color: Theme.of(context).colorScheme.secondary)), child: leading!, ) : null, trailing: trailing, title: title != null - ? DefaultTextStyle(style: Theme.of(context).textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w500, fontSize: 15.0), child: title!) + ? DefaultTextStyle( + style: Theme.of(context) + .textTheme + .titleMedium! + .copyWith(fontWeight: FontWeight.w500, fontSize: 15.0), + child: title!) : null, contentPadding: EdgeInsets.zero, visualDensity: VisualDensity.compact, diff --git a/refilc_mobile_ui/lib/common/panel/panel_button.dart b/refilc_mobile_ui/lib/common/panel/panel_button.dart index 1c7ebc6..955681d 100644 --- a/refilc_mobile_ui/lib/common/panel/panel_button.dart +++ b/refilc_mobile_ui/lib/common/panel/panel_button.dart @@ -36,8 +36,9 @@ class PanelButton extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: borderRadius ?? BorderRadius.circular(12.0)), fillColor: background - ? Colors.white.withOpacity( - Theme.of(context).brightness == Brightness.light ? .35 : .2) + ? Colors.white.withValues( + alpha: + Theme.of(context).brightness == Brightness.light ? .35 : .2) : null, child: ListTile( leading: leading != null @@ -57,7 +58,7 @@ class PanelButton extends StatelessWidget { width: 2.0, height: 32.0, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.15), + color: AppColors.of(context).text.withValues(alpha: .15), borderRadius: BorderRadius.circular(45.0), ), ), diff --git a/refilc_mobile_ui/lib/common/personality_card/empty_card.dart b/refilc_mobile_ui/lib/common/personality_card/empty_card.dart index 356d897..f7fe5ef 100644 --- a/refilc_mobile_ui/lib/common/personality_card/empty_card.dart +++ b/refilc_mobile_ui/lib/common/personality_card/empty_card.dart @@ -44,7 +44,7 @@ class _EmptyCardState extends State { if (Provider.of(context, listen: false) .shadowEffect) BoxShadow( - color: Colors.black.withOpacity(0.08), + color: Colors.black.withValues(alpha: 0.08), offset: const Offset(0, 5), blurRadius: 20, spreadRadius: 10, @@ -52,7 +52,7 @@ class _EmptyCardState extends State { ], ), child: DottedBorder( - color: Colors.black.withOpacity(0.9), + color: Colors.black.withValues(alpha: 0.9), dashPattern: const [12, 12], padding: const EdgeInsets.only(top: 20, bottom: 20, left: 20, right: 20), @@ -60,7 +60,7 @@ class _EmptyCardState extends State { child: Text( widget.text, style: TextStyle( - color: Colors.white.withOpacity(0.9), + color: Colors.white.withValues(alpha: 0.9), ), ), ), diff --git a/refilc_mobile_ui/lib/common/personality_card/personality_card.dart b/refilc_mobile_ui/lib/common/personality_card/personality_card.dart index 848748c..7f65fa8 100644 --- a/refilc_mobile_ui/lib/common/personality_card/personality_card.dart +++ b/refilc_mobile_ui/lib/common/personality_card/personality_card.dart @@ -301,7 +301,7 @@ class _PersonalityCardState extends State { style: TextStyle( fontSize: 16, height: 1.2, - color: Colors.white.withOpacity(0.8), + color: Colors.white.withValues(alpha: 0.8), ), ), const SizedBox(height: 25), @@ -354,7 +354,7 @@ class _PersonalityCardState extends State { borderRadius: const BorderRadius.all(Radius.circular(5)), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.08), + color: Colors.black.withValues(alpha: 0.08), offset: const Offset(0, 5), blurRadius: 20, spreadRadius: 10, @@ -362,7 +362,7 @@ class _PersonalityCardState extends State { ], ), child: DottedBorder( - color: Colors.black.withOpacity(0.9), + color: Colors.black.withValues(alpha: 0.9), dashPattern: const [12, 12], padding: const EdgeInsets.only(top: 20, bottom: 20, left: 20, right: 20), diff --git a/refilc_mobile_ui/lib/common/profile_image/profile_image.dart b/refilc_mobile_ui/lib/common/profile_image/profile_image.dart index 69abe4b..ab559ff 100644 --- a/refilc_mobile_ui/lib/common/profile_image/profile_image.dart +++ b/refilc_mobile_ui/lib/common/profile_image/profile_image.dart @@ -91,10 +91,10 @@ class _ProfileImageState extends State { clipBehavior: Clip.hardEdge, shape: const CircleBorder(), color: widget.name != null && widget.name! == 'Rendszerüzenet' - ? widget.backgroundColor?.withOpacity(0.8) ?? - AppColors.of(context).text.withOpacity(0.5) + ? widget.backgroundColor?.withValues(alpha: 0.8) ?? + AppColors.of(context).text.withValues(alpha: 0.5) : widget.backgroundColor ?? - AppColors.of(context).text.withOpacity(.15), + AppColors.of(context).text.withValues(alpha: .15), child: InkWell( onTap: widget.onTap, onDoubleTap: widget.onDoubleTap, @@ -114,7 +114,7 @@ class _ProfileImageState extends State { width: 15, height: 15, decoration: BoxDecoration( - color: color.withOpacity(.5), + color: color.withValues(alpha: .5), borderRadius: BorderRadius.circular(8.0), ), ) @@ -206,7 +206,7 @@ class _ProfileImageState extends State { color: profilePicture != null ? Colors.transparent : widget.backgroundColor ?? - AppColors.of(context).text.withOpacity(.15), + AppColors.of(context).text.withValues(alpha: .15), child: AnimatedContainer( duration: const Duration(milliseconds: 200), height: widget.radius * 2, diff --git a/refilc_mobile_ui/lib/common/progress_bar.dart b/refilc_mobile_ui/lib/common/progress_bar.dart index ed65a05..4ecd127 100644 --- a/refilc_mobile_ui/lib/common/progress_bar.dart +++ b/refilc_mobile_ui/lib/common/progress_bar.dart @@ -2,7 +2,10 @@ import 'package:flutter/material.dart'; class ProgressBar extends StatelessWidget { const ProgressBar( - {super.key, required this.value, this.backgroundColor, this.height = 8.0}); + {super.key, + required this.value, + this.backgroundColor, + this.height = 8.0}); final double value; final Color? backgroundColor; @@ -16,8 +19,8 @@ class ProgressBar extends StatelessWidget { Container( decoration: BoxDecoration( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(0.1) - : Colors.white.withOpacity(0.1), + ? Colors.black.withValues(alpha: 0.1) + : Colors.white.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(45.0), ), width: double.infinity, diff --git a/refilc_mobile_ui/lib/common/round_border_icon.dart b/refilc_mobile_ui/lib/common/round_border_icon.dart index 9a6e594..e801aa0 100644 --- a/refilc_mobile_ui/lib/common/round_border_icon.dart +++ b/refilc_mobile_ui/lib/common/round_border_icon.dart @@ -19,7 +19,7 @@ class RoundBorderIcon extends StatelessWidget { decoration: BoxDecoration( border: Border.all( color: color ?? - Theme.of(context).colorScheme.secondary.withOpacity(0.25), + Theme.of(context).colorScheme.secondary.withValues(alpha: 0.25), width: width), borderRadius: BorderRadius.circular(50.0), ), diff --git a/refilc_mobile_ui/lib/common/splitted_panel/splitted_panel.dart b/refilc_mobile_ui/lib/common/splitted_panel/splitted_panel.dart index 402e16f..4761ade 100644 --- a/refilc_mobile_ui/lib/common/splitted_panel/splitted_panel.dart +++ b/refilc_mobile_ui/lib/common/splitted_panel/splitted_panel.dart @@ -56,7 +56,7 @@ class SplittedPanel extends StatelessWidget { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.25), + .withValues(alpha: .25), width: 1.0) : null, ), @@ -121,7 +121,7 @@ class SplittedPanelTitle extends StatelessWidget { child: DefaultTextStyle( style: Theme.of(context).textTheme.titleMedium!.copyWith( fontWeight: FontWeight.w600, - color: AppColors.of(context).text.withOpacity(0.65)), + color: AppColors.of(context).text.withValues(alpha: 0.65)), child: title, ), ); diff --git a/refilc_mobile_ui/lib/common/widgets/absence/absence_display.dart b/refilc_mobile_ui/lib/common/widgets/absence/absence_display.dart index 8e09aeb..9c45778 100644 --- a/refilc_mobile_ui/lib/common/widgets/absence/absence_display.dart +++ b/refilc_mobile_ui/lib/common/widgets/absence/absence_display.dart @@ -15,7 +15,7 @@ class AbsenceDisplay extends StatelessWidget { padding: const EdgeInsets.only(top: 5.0), // padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 6.0), // decoration: BoxDecoration( - // color: Theme.of(context).scaffoldBackgroundColor.withOpacity(.2), + // color: Theme.of(context).scaffoldBackgroundColor.withValues(alpha: .2), // borderRadius: BorderRadius.circular(12.0), // ), child: Row(children: [ diff --git a/refilc_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart b/refilc_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart index fbe4f63..2363093 100644 --- a/refilc_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart @@ -81,7 +81,7 @@ class AbsenceSubjectTile extends StatelessWidget { // fontFamily: "monospace", color: getColorByPercentage(percentage, context: context) - .withOpacity(0.8), + .withValues(alpha: 0.8), fontSize: 16.0, fontWeight: FontWeight.w500, ), @@ -109,5 +109,5 @@ Color getColorByPercentage(double percentage, {required BuildContext context}) { color = AppColors.of(context).yellow; } - return color.withOpacity(.8); + return color.withValues(alpha: .8); } diff --git a/refilc_mobile_ui/lib/common/widgets/absence/absence_tile.dart b/refilc_mobile_ui/lib/common/widgets/absence/absence_tile.dart index 8658052..de0b6f4 100644 --- a/refilc_mobile_ui/lib/common/widgets/absence/absence_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/absence/absence_tile.dart @@ -57,7 +57,7 @@ class AbsenceTile extends StatelessWidget { width: 39, decoration: BoxDecoration( shape: BoxShape.circle, - color: !group ? color.withOpacity(.25) : null, + color: !group ? color.withValues(alpha: .25) : null, ), child: Center( child: Icon(justificationIcon(absence.state), color: color)), diff --git a/refilc_mobile_ui/lib/common/widgets/absence/absence_view.dart b/refilc_mobile_ui/lib/common/widgets/absence/absence_view.dart index 979d492..1fcb511 100644 --- a/refilc_mobile_ui/lib/common/widgets/absence/absence_view.dart +++ b/refilc_mobile_ui/lib/common/widgets/absence/absence_view.dart @@ -51,7 +51,7 @@ class AbsenceView extends StatelessWidget { height: 44.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: color.withOpacity(.25), + color: color.withValues(alpha: .25), ), child: Center( child: Icon( diff --git a/refilc_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart b/refilc_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart index 49dc65b..1685df3 100644 --- a/refilc_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart @@ -41,14 +41,13 @@ class AbsenceGroupTile extends StatelessWidget { const EdgeInsets.symmetric(horizontal: 12.0, vertical: 0), tileColor: Colors.transparent, duration: const Duration(milliseconds: 250), - trailingDuration: 0.5, trailing: const Icon(FeatherIcons.chevronDown), leading: Container( width: 39.0, height: 39.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: color.withOpacity(.25), + color: color.withValues(alpha: .25), ), child: Center( child: Icon(AbsenceTile.justificationIcon(state), @@ -76,7 +75,9 @@ class AbsenceGroupTile extends StatelessWidget { .format(context, weekday: true), style: TextStyle( fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.8)), + color: AppColors.of(context) + .text + .withValues(alpha: 0.8)), ) : null, children: absences, diff --git a/refilc_mobile_ui/lib/common/widgets/ad/ad_tile.dart b/refilc_mobile_ui/lib/common/widgets/ad/ad_tile.dart index 2ae7e44..9d8dbb8 100644 --- a/refilc_mobile_ui/lib/common/widgets/ad/ad_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/ad/ad_tile.dart @@ -32,7 +32,7 @@ class AdTile extends StatelessWidget { style: TextStyle( fontSize: 14.5, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.7), + color: AppColors.of(context).text.withValues(alpha: 0.7), ), ), ], diff --git a/refilc_mobile_ui/lib/common/widgets/card_handle.dart b/refilc_mobile_ui/lib/common/widgets/card_handle.dart index 9b6b754..35e2610 100644 --- a/refilc_mobile_ui/lib/common/widgets/card_handle.dart +++ b/refilc_mobile_ui/lib/common/widgets/card_handle.dart @@ -17,7 +17,7 @@ class CardHandle extends StatelessWidget { margin: const EdgeInsets.only(top: 12.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(45.0), - color: AppColors.of(context).text.withOpacity(0.10), + color: AppColors.of(context).text.withValues(alpha: 0.10), ), ), if (child != null) child!, diff --git a/refilc_mobile_ui/lib/common/widgets/cretification/certification_card.dart b/refilc_mobile_ui/lib/common/widgets/cretification/certification_card.dart index 6ce9ac3..75ac6f2 100644 --- a/refilc_mobile_ui/lib/common/widgets/cretification/certification_card.dart +++ b/refilc_mobile_ui/lib/common/widgets/cretification/certification_card.dart @@ -39,7 +39,7 @@ class CertificationCard extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.0), gradient: LinearGradient( - colors: [color, color.withOpacity(.75)], + colors: [color, color.withValues(alpha: .75)], ), ), child: Material( @@ -65,7 +65,7 @@ class CertificationCard extends StatelessWidget { TextSpan( text: " • ${grades.length}", style: TextStyle( - color: textColor.withOpacity(.75), + color: textColor.withValues(alpha: .75), fontWeight: FontWeight.w600, fontSize: 16.0, ), diff --git a/refilc_mobile_ui/lib/common/widgets/cretification/certification_tile.dart b/refilc_mobile_ui/lib/common/widgets/cretification/certification_tile.dart index 5702fbc..1aacd91 100644 --- a/refilc_mobile_ui/lib/common/widgets/cretification/certification_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/cretification/certification_tile.dart @@ -66,7 +66,7 @@ class CertificationTile extends StatelessWidget { child: ListTile( tileColor: gradeColor( context: context, value: grade.value.value, nocolor: false) - .withOpacity(.1), + .withValues(alpha: .1), visualDensity: VisualDensity.compact, contentPadding: isSubjectView ? const EdgeInsets.only(left: 20.0, right: 12.0, bottom: 6.0) @@ -85,7 +85,7 @@ class CertificationTile extends StatelessWidget { SubjectIcon.resolveVariant( subject: grade.subject, context: context), size: 28.0, - color: AppColors.of(context).text.withOpacity(.75)), + color: AppColors.of(context).text.withValues(alpha: .75)), ), minLeadingWidth: isSubjectView ? 32.0 : 42.0, trailing: isSubjectView diff --git a/refilc_mobile_ui/lib/common/widgets/custom_segmented_control.dart b/refilc_mobile_ui/lib/common/widgets/custom_segmented_control.dart index 86d44f0..93f0887 100644 --- a/refilc_mobile_ui/lib/common/widgets/custom_segmented_control.dart +++ b/refilc_mobile_ui/lib/common/widgets/custom_segmented_control.dart @@ -34,7 +34,7 @@ class CustomSegmentedControl extends StatelessWidget { initialValue: value, children: finalChildren, decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(.069), + color: Theme.of(context).colorScheme.secondary.withValues(alpha: .069), borderRadius: BorderRadius.circular(12.0), ), thumbDecoration: BoxDecoration( @@ -42,7 +42,7 @@ class CustomSegmentedControl extends StatelessWidget { borderRadius: BorderRadius.circular(10.0), // boxShadow: [ // BoxShadow( - // color: Colors.black.withOpacity(.3), + // color: Colors.black.withValues(alpha: .3), // blurRadius: 4.0, // spreadRadius: 1.0, // offset: const Offset( @@ -66,7 +66,7 @@ class CustomSegmentedControl extends StatelessWidget { // endIndent: 2, // thickness: 2, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(0.2), + color: AppColors.of(context).text.withValues(alpha: 0.2), ), ), height: height, diff --git a/refilc_mobile_ui/lib/common/widgets/custom_switch.dart b/refilc_mobile_ui/lib/common/widgets/custom_switch.dart index 4f3f896..fee9ebb 100644 --- a/refilc_mobile_ui/lib/common/widgets/custom_switch.dart +++ b/refilc_mobile_ui/lib/common/widgets/custom_switch.dart @@ -28,7 +28,9 @@ class CustomSwitch extends StatelessWidget { borderRadius: const BorderRadius.all( Radius.circular(25.0), ), - color: value ? Theme.of(context).colorScheme.secondary : Theme.of(context).highlightColor, + color: value + ? Theme.of(context).colorScheme.secondary + : Theme.of(context).highlightColor, ), ), AnimatedAlign( @@ -44,7 +46,7 @@ class CustomSwitch extends StatelessWidget { color: Colors.white, boxShadow: [ BoxShadow( - color: Colors.black12.withOpacity(0.1), + color: Colors.black12.withValues(alpha: 0.1), spreadRadius: 0.5, blurRadius: 1, ) diff --git a/refilc_mobile_ui/lib/common/widgets/exam/exam_tile.dart b/refilc_mobile_ui/lib/common/widgets/exam/exam_tile.dart index 83d22f3..4d274dd 100644 --- a/refilc_mobile_ui/lib/common/widgets/exam/exam_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/exam/exam_tile.dart @@ -59,7 +59,7 @@ class ExamTile extends StatelessWidget { ? Icon( SubjectIcon.resolveVariant( context: context, subject: exam.subject), - color: AppColors.of(context).text.withOpacity(.5), + color: AppColors.of(context).text.withValues(alpha: .5), ) : null, minLeadingWidth: 0, diff --git a/refilc_mobile_ui/lib/common/widgets/exam/exam_view.dart b/refilc_mobile_ui/lib/common/widgets/exam/exam_view.dart index 1955770..9d56b8d 100644 --- a/refilc_mobile_ui/lib/common/widgets/exam/exam_view.dart +++ b/refilc_mobile_ui/lib/common/widgets/exam/exam_view.dart @@ -31,7 +31,7 @@ class ExamView extends StatelessWidget { SubjectIcon.resolveVariant( subject: exam.subject, context: context), size: 36.0, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), ), title: Text( diff --git a/refilc_mobile_ui/lib/common/widgets/exam/exam_viewable.dart b/refilc_mobile_ui/lib/common/widgets/exam/exam_viewable.dart index 129d8ae..c8c9419 100644 --- a/refilc_mobile_ui/lib/common/widgets/exam/exam_viewable.dart +++ b/refilc_mobile_ui/lib/common/widgets/exam/exam_viewable.dart @@ -122,7 +122,7 @@ class ExamPopup extends StatelessWidget { color: ColorsUtils() .fade(context, Theme.of(context).colorScheme.secondary, darkenAmount: 0.1, lightenAmount: 0.1) - .withOpacity(0.33), + .withValues(alpha: 0.33), width: MediaQuery.of(context).size.width, ), Container( @@ -135,10 +135,10 @@ class ExamPopup extends StatelessWidget { Theme.of(context).scaffoldBackgroundColor, Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context).scaffoldBackgroundColor, ], stops: const [0.1, 0.5, 0.7, 1.0], @@ -166,7 +166,7 @@ class ExamPopup extends StatelessWidget { .fade( context, Theme.of(context).colorScheme.secondary, darkenAmount: 0.1, lightenAmount: 0.1) - .withOpacity(0.33), + .withValues(alpha: 0.33), borderRadius: BorderRadius.circular( 2.0, ), @@ -186,7 +186,7 @@ class ExamPopup extends StatelessWidget { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.9), + .withValues(alpha: 0.9), width: 1.5, padding: 10.0, icon: Icon( @@ -198,7 +198,7 @@ class ExamPopup extends StatelessWidget { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.8), + .withValues(alpha: 0.8), ), ), ), @@ -236,7 +236,7 @@ class ExamPopup extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(0.9), + .withValues(alpha: 0.9), fontSize: 16.0, fontWeight: FontWeight.w600, ), @@ -298,7 +298,7 @@ class ExamPopup extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(0.9), + .withValues(alpha: 0.9), fontSize: 16.0, fontWeight: FontWeight.w600, fontStyle: ((lesson?.subject.isRenamed ?? @@ -315,8 +315,9 @@ class ExamPopup extends StatelessWidget { Text( '${DateFormat('MMM d, H:mm', I18n.locale.countryCode).format(lesson!.start).capital()} - ${DateFormat('H:mm').format(lesson!.end)}', style: TextStyle( - color: - AppColors.of(context).text.withOpacity(0.85), + color: AppColors.of(context) + .text + .withValues(alpha: 0.85), fontSize: 14.0, fontWeight: FontWeight.w500, ), @@ -359,7 +360,7 @@ class ExamPopup extends StatelessWidget { // 'view_subject'.i18n, // style: TextStyle( // color: - // AppColors.of(context).text.withOpacity(0.9), + // AppColors.of(context).text.withValues(alpha: 0.9), // fontSize: 18.0, // fontWeight: FontWeight.w500, // ), diff --git a/refilc_mobile_ui/lib/common/widgets/grade/new_grades.dart b/refilc_mobile_ui/lib/common/widgets/grade/new_grades.dart index 75df5a2..9128a9a 100644 --- a/refilc_mobile_ui/lib/common/widgets/grade/new_grades.dart +++ b/refilc_mobile_ui/lib/common/widgets/grade/new_grades.dart @@ -42,8 +42,10 @@ class NewGradesSurprise extends StatelessWidget { child: Container( decoration: BoxDecoration(boxShadow: [ BoxShadow( - color: - Theme.of(context).colorScheme.secondary.withOpacity(.5), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: .5), blurRadius: 18.0, ) ]), @@ -59,7 +61,8 @@ class NewGradesSurprise extends StatelessWidget { width: 85, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.85), + color: + AppColors.of(context).text.withValues(alpha: .85), borderRadius: BorderRadius.circular(8.0), ), ), @@ -78,7 +81,8 @@ class NewGradesSurprise extends StatelessWidget { width: 125, height: 10, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: + AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ), @@ -97,7 +101,8 @@ class NewGradesSurprise extends StatelessWidget { width: 25, height: 25, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: + AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(25.0), ), ), @@ -110,7 +115,9 @@ class NewGradesSurprise extends StatelessWidget { style: TextStyle( shadows: [ Shadow( - color: AppColors.of(context).text.withOpacity(.2), + color: AppColors.of(context) + .text + .withValues(alpha: .2), offset: const Offset(2, 2), ) ], @@ -119,7 +126,7 @@ class NewGradesSurprise extends StatelessWidget { text: "x", style: TextStyle( fontSize: 20.0, - color: AppColors.of(context).text.withOpacity(.5), + color: AppColors.of(context).text.withValues(alpha: .5), fontWeight: FontWeight.w800, ), ) @@ -127,7 +134,7 @@ class NewGradesSurprise extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w700, fontSize: 28.0, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), ), ), diff --git a/refilc_mobile_ui/lib/common/widgets/grade/surprise_grade.dart b/refilc_mobile_ui/lib/common/widgets/grade/surprise_grade.dart index 3873e23..0f18a9a 100644 --- a/refilc_mobile_ui/lib/common/widgets/grade/surprise_grade.dart +++ b/refilc_mobile_ui/lib/common/widgets/grade/surprise_grade.dart @@ -134,9 +134,12 @@ class _SurpriseGradeState extends State return FadeTransition( opacity: _revealAnimFade, child: Material( - color: Colors.black.withOpacity(.75), + color: Colors.black.withValues(alpha: .75), child: Container( - color: Theme.of(context).colorScheme.secondary.withOpacity(.05), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: .05), child: Container( decoration: const BoxDecoration( gradient: RadialGradient( @@ -223,12 +226,13 @@ class _SurpriseGradeState extends State padding: const EdgeInsets.symmetric( horizontal: 32.0, vertical: 20.0), decoration: BoxDecoration( - color: Colors.white.withOpacity(.3), + color: Colors.white + .withValues(alpha: .3), borderRadius: BorderRadius.circular(24.0), border: Border.all( color: Colors.black - .withOpacity(.3), + .withValues(alpha: .3), width: 1.0), ), child: Row( @@ -264,7 +268,8 @@ class _SurpriseGradeState extends State .capital(), style: TextStyle( color: Colors.white - .withOpacity(.8), + .withValues( + alpha: .8), fontWeight: FontWeight.bold, fontSize: 24.0, @@ -285,7 +290,8 @@ class _SurpriseGradeState extends State "${widget.grade.value.weight}%", style: TextStyle( color: Colors.white - .withOpacity(.7), + .withValues( + alpha: .7), fontWeight: FontWeight.w600, fontSize: 20.0, @@ -326,7 +332,7 @@ class _SurpriseGradeState extends State child: Text( "open_subtitle".i18n, style: TextStyle( - color: Colors.white.withOpacity(.8), + color: Colors.white.withValues(alpha: .8), fontWeight: FontWeight.w600, fontSize: 24.0, ), @@ -383,7 +389,7 @@ class _SurpriseGradeState extends State context: context, value: widget.grade.value.value) - .withOpacity(.5), + .withValues(alpha: .5), blurRadius: 24.0, ), Shadow( @@ -391,7 +397,7 @@ class _SurpriseGradeState extends State context: context, value: widget.grade.value.value) - .withOpacity(.3), + .withValues(alpha: .3), offset: const Offset(-3, -3), ), ], diff --git a/refilc_mobile_ui/lib/common/widgets/homework/homework_tile.dart b/refilc_mobile_ui/lib/common/widgets/homework/homework_tile.dart index 8e8a7c2..0d731d0 100644 --- a/refilc_mobile_ui/lib/common/widgets/homework/homework_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/homework/homework_tile.dart @@ -38,7 +38,7 @@ class HomeworkTile extends StatelessWidget { child: censored ? Container( decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.55), + color: AppColors.of(context).text.withValues(alpha: .55), borderRadius: BorderRadius.circular(60.0), ), ) @@ -48,7 +48,7 @@ class HomeworkTile extends StatelessWidget { SubjectIcon.resolveVariant( subject: homework.subject, context: context), size: 28.0, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), ), ), @@ -59,7 +59,7 @@ class HomeworkTile extends StatelessWidget { width: 160, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.85), + color: AppColors.of(context).text.withValues(alpha: .85), borderRadius: BorderRadius.circular(8.0), ), ), @@ -83,7 +83,7 @@ class HomeworkTile extends StatelessWidget { width: 100, height: 10, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ), @@ -100,13 +100,13 @@ class HomeworkTile extends StatelessWidget { width: 15, height: 15, decoration: BoxDecoration( - color: AppColors.of(context).text.withOpacity(.45), + color: AppColors.of(context).text.withValues(alpha: .45), borderRadius: BorderRadius.circular(8.0), ), ) : Icon( FeatherIcons.home, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), minLeadingWidth: 0, ), diff --git a/refilc_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart b/refilc_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart index 90a3402..a31106e 100644 --- a/refilc_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart +++ b/refilc_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart @@ -320,7 +320,7 @@ class TimetableLessonPopup extends StatelessWidget { color: ColorsUtils() .fade(context, Theme.of(context).colorScheme.secondary, darkenAmount: 0.1, lightenAmount: 0.1) - .withOpacity(0.33), + .withValues(alpha: 0.33), width: MediaQuery.of(context).size.width, ), Container( @@ -333,10 +333,10 @@ class TimetableLessonPopup extends StatelessWidget { Theme.of(context).scaffoldBackgroundColor, Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context) .scaffoldBackgroundColor - .withOpacity(0.1), + .withValues(alpha: 0.1), Theme.of(context).scaffoldBackgroundColor, ], stops: const [0.0, 0.3, 0.6, 0.95], @@ -373,7 +373,7 @@ class TimetableLessonPopup extends StatelessWidget { .fade(context, Theme.of(context).colorScheme.secondary, darkenAmount: 0.1, lightenAmount: 0.1) - .withOpacity(0.33), + .withValues(alpha: 0.33), borderRadius: BorderRadius.circular( 2.0, ), @@ -395,7 +395,7 @@ class TimetableLessonPopup extends StatelessWidget { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.9), + .withValues(alpha: 0.9), width: 1.5, padding: 10.0, icon: Icon( @@ -407,7 +407,7 @@ class TimetableLessonPopup extends StatelessWidget { Theme.of(context).colorScheme.secondary, amount: 0.1, ) - .withOpacity(0.8), + .withValues(alpha: 0.8), ), ), ), @@ -434,7 +434,7 @@ class TimetableLessonPopup extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(0.85), + .withValues(alpha: 0.85), fontSize: 14.0, fontWeight: FontWeight.w500, ), @@ -450,7 +450,7 @@ class TimetableLessonPopup extends StatelessWidget { color: Theme.of(context) .colorScheme .tertiary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), child: Text( @@ -463,7 +463,7 @@ class TimetableLessonPopup extends StatelessWidget { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), @@ -505,7 +505,9 @@ class TimetableLessonPopup extends StatelessWidget { : lesson.substituteTeacher!.name)) ?? '', style: TextStyle( - color: AppColors.of(context).text.withOpacity(0.9), + color: AppColors.of(context) + .text + .withValues(alpha: 0.9), fontSize: 14.0, fontWeight: FontWeight.w500, ), @@ -534,8 +536,9 @@ class TimetableLessonPopup extends StatelessWidget { Text( lesson.description, style: TextStyle( - color: - AppColors.of(context).text.withOpacity(0.9), + color: AppColors.of(context) + .text + .withValues(alpha: 0.9), fontSize: 14.0, fontWeight: FontWeight.w600, ), @@ -564,7 +567,9 @@ class TimetableLessonPopup extends StatelessWidget { Text( '${'year_index'.i18n}: ${lesson.lessonYearIndex ?? '?'}', style: TextStyle( - color: AppColors.of(context).text.withOpacity(0.9), + color: AppColors.of(context) + .text + .withValues(alpha: 0.9), fontSize: 14.0, fontWeight: FontWeight.w600, ), @@ -607,7 +612,7 @@ class TimetableLessonPopup extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(0.9), + .withValues(alpha: 0.9), fontSize: 16.0, fontWeight: FontWeight.w600, ), @@ -622,7 +627,7 @@ class TimetableLessonPopup extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(0.85), + .withValues(alpha: 0.85), fontSize: 14.0, fontWeight: FontWeight.w500, ), @@ -665,7 +670,7 @@ class TimetableLessonPopup extends StatelessWidget { // 'view_subject'.i18n, // style: TextStyle( // color: - // AppColors.of(context).text.withOpacity(0.9), + // AppColors.of(context).text.withValues(alpha: 0.9), // fontSize: 18.0, // fontWeight: FontWeight.w500, // ), diff --git a/refilc_mobile_ui/lib/common/widgets/message/message_view_tile.dart b/refilc_mobile_ui/lib/common/widgets/message/message_view_tile.dart index 8e80e33..2e510e0 100644 --- a/refilc_mobile_ui/lib/common/widgets/message/message_view_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/message/message_view_tile.dart @@ -91,7 +91,10 @@ class MessageViewTile extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.0), border: Border.all( - color: Theme.of(context).colorScheme.secondary.withOpacity(.25), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: .25), width: 1.0, ), ), @@ -122,7 +125,7 @@ class MessageViewTile extends StatelessWidget { .textTheme .bodySmall ?.color - ?.withOpacity(0.6), + ?.withValues(alpha: 0.6), ), overflow: TextOverflow.ellipsis, maxLines: 1, diff --git a/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart b/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart index 0de2530..b40d2ab 100644 --- a/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart @@ -23,7 +23,7 @@ class MissedExamTile extends StatelessWidget { height: 36, child: Icon( FeatherIcons.slash, - color: AppColors.of(context).red.withOpacity(.75), + color: AppColors.of(context).red.withValues(alpha: .75), size: 28.0, )), title: Text("missed_exams" diff --git a/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_view.dart b/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_view.dart index 982a64a..fab515b 100644 --- a/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_view.dart +++ b/refilc_mobile_ui/lib/common/widgets/missed_exam/missed_exam_view.dart @@ -50,7 +50,7 @@ class MissedExamViewTile extends StatelessWidget { leading: Icon( SubjectIcon.resolveVariant( subject: lesson.subject, context: context), - color: AppColors.of(context).text.withOpacity(.8), + color: AppColors.of(context).text.withValues(alpha: .8), size: 32.0, ), title: Text( diff --git a/refilc_mobile_ui/lib/common/widgets/statistics_tile.dart b/refilc_mobile_ui/lib/common/widgets/statistics_tile.dart index 23afdce..2de6dad 100644 --- a/refilc_mobile_ui/lib/common/widgets/statistics_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/statistics_tile.dart @@ -81,13 +81,13 @@ class StatisticsTile extends StatelessWidget { decoration: BoxDecoration( color: fill ? (color ?? gradeColor(context: context, value: value)) - .withOpacity(.2) + .withValues(alpha: .2) : null, border: outline || fill ? Border.all( color: (color ?? gradeColor(context: context, value: value)) - .withOpacity(outline ? 1.0 : 0.0), + .withValues(alpha: outline ? 1.0 : 0.0), width: fill ? 5.0 : 5.0, ) : null, diff --git a/refilc_mobile_ui/lib/common/widgets/tick_tile.dart b/refilc_mobile_ui/lib/common/widgets/tick_tile.dart index 04e7a7f..dd5bcdd 100644 --- a/refilc_mobile_ui/lib/common/widgets/tick_tile.dart +++ b/refilc_mobile_ui/lib/common/widgets/tick_tile.dart @@ -81,7 +81,7 @@ class TickTileState extends State { fontSize: 15.5, decoration: isTicked ? TextDecoration.lineThrough : null, color: isTicked - ? AppColors.of(context).text.withOpacity(0.5) + ? AppColors.of(context).text.withValues(alpha: 0.5) : null, ), ), @@ -97,7 +97,7 @@ class TickTileState extends State { fontWeight: FontWeight.w500, fontSize: 12.0, color: isTicked - ? AppColors.of(context).text.withOpacity(0.5) + ? AppColors.of(context).text.withValues(alpha: 0.5) : null, ), ) diff --git a/refilc_mobile_ui/lib/common/widgets/update/updates_view.dart b/refilc_mobile_ui/lib/common/widgets/update/updates_view.dart index d2ce169..cc70b48 100644 --- a/refilc_mobile_ui/lib/common/widgets/update/updates_view.dart +++ b/refilc_mobile_ui/lib/common/widgets/update/updates_view.dart @@ -54,7 +54,8 @@ class UpdateViewState extends State { style: TextStyle( fontWeight: FontWeight.w600, fontSize: 16.0, - color: AppColors.of(context).text.withOpacity(0.6), + color: + AppColors.of(context).text.withValues(alpha: 0.6), ), ), ], diff --git a/refilc_mobile_ui/lib/pages/absences/absences_page.dart b/refilc_mobile_ui/lib/pages/absences/absences_page.dart index df77029..fc97881 100644 --- a/refilc_mobile_ui/lib/pages/absences/absences_page.dart +++ b/refilc_mobile_ui/lib/pages/absences/absences_page.dart @@ -643,7 +643,7 @@ class AbsencesPageState extends State fontWeight: FontWeight.w500, color: AppColors.of(context) .text - .withOpacity(0.8), + .withValues(alpha: 0.8), ), ), ], diff --git a/refilc_mobile_ui/lib/pages/grades/average_selector.dart b/refilc_mobile_ui/lib/pages/grades/average_selector.dart index 854a548..00d5f96 100644 --- a/refilc_mobile_ui/lib/pages/grades/average_selector.dart +++ b/refilc_mobile_ui/lib/pages/grades/average_selector.dart @@ -98,7 +98,7 @@ class AverageSelectorState extends State { avgDropItems[widget.value]!.i18n, style: Theme.of(context).textTheme.titleSmall!.copyWith( fontWeight: FontWeight.w600, - color: AppColors.of(context).text.withOpacity(0.65)), + color: AppColors.of(context).text.withValues(alpha: 0.65)), ), const SizedBox( width: 4, diff --git a/refilc_mobile_ui/lib/pages/grades/fail_warning.dart b/refilc_mobile_ui/lib/pages/grades/fail_warning.dart index c859c12..cd23e65 100644 --- a/refilc_mobile_ui/lib/pages/grades/fail_warning.dart +++ b/refilc_mobile_ui/lib/pages/grades/fail_warning.dart @@ -27,7 +27,7 @@ class FailWarning extends StatelessWidget { children: [ Icon( FeatherIcons.alertTriangle, - color: Colors.orange.withOpacity(.5), + color: Colors.orange.withValues(alpha: .5), size: 20.0, ), const SizedBox(width: 12.0), diff --git a/refilc_mobile_ui/lib/pages/grades/grade_subject_view.dart b/refilc_mobile_ui/lib/pages/grades/grade_subject_view.dart index 7583707..b9ed425 100644 --- a/refilc_mobile_ui/lib/pages/grades/grade_subject_view.dart +++ b/refilc_mobile_ui/lib/pages/grades/grade_subject_view.dart @@ -493,7 +493,7 @@ class _GradeSubjectViewState extends State color: Theme.of(context) .colorScheme .primary - .withOpacity(.15), + .withValues(alpha: .15), ), child: Icon( FeatherIcons.flag, diff --git a/refilc_mobile_ui/lib/pages/grades/grades_count.dart b/refilc_mobile_ui/lib/pages/grades/grades_count.dart index 07a7878..bcb9ba2 100644 --- a/refilc_mobile_ui/lib/pages/grades/grades_count.dart +++ b/refilc_mobile_ui/lib/pages/grades/grades_count.dart @@ -26,7 +26,6 @@ class GradesCount extends StatelessWidget { contentPadding: EdgeInsets.zero, visualDensity: const VisualDensity(vertical: -4), duration: const Duration(milliseconds: 250), - trailingDuration: 0.5, trailing: const Icon(FeatherIcons.chevronDown), title: Text( 'grades_cnt'.i18n.fill([ diff --git a/refilc_mobile_ui/lib/pages/grades/graph.dart b/refilc_mobile_ui/lib/pages/grades/graph.dart index c8c382b..bd445a1 100644 --- a/refilc_mobile_ui/lib/pages/grades/graph.dart +++ b/refilc_mobile_ui/lib/pages/grades/graph.dart @@ -171,7 +171,7 @@ class GradeGraphState extends State { VerticalLine( x: x, strokeWidth: 3.0, - color: AppColors.of(context).red.withOpacity(.75), + color: AppColors.of(context).red.withValues(alpha: .75), label: VerticalLineLabel( labelResolver: (_) => " ${"mid".i18n} ​", // <- zwsp for padding show: true, @@ -196,7 +196,7 @@ class GradeGraphState extends State { settings.graphClassAvg) { extraLinesH.add(HorizontalLine( y: widget.classAvg!, - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), )); } @@ -244,10 +244,10 @@ class GradeGraphState extends State { begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - averageColor.withOpacity(0.7), - averageColor.withOpacity(0.3), - averageColor.withOpacity(0.2), - averageColor.withOpacity(0.1), + averageColor.withValues(alpha: 0.7), + averageColor.withValues(alpha: 0.3), + averageColor.withValues(alpha: 0.2), + averageColor.withValues(alpha: 0.1), ], stops: const [0.1, 0.6, 0.8, 1], ), @@ -274,16 +274,16 @@ class GradeGraphState extends State { colors: [ AppColors.of(context) .text - .withOpacity(0.7), + .withValues(alpha: 0.7), AppColors.of(context) .text - .withOpacity(0.3), + .withValues(alpha: 0.3), AppColors.of(context) .text - .withOpacity(0.2), + .withValues(alpha: 0.2), AppColors.of(context) .text - .withOpacity(0.1), + .withValues(alpha: 0.1), ], stops: const [0.1, 0.6, 0.8, 1], ), @@ -300,11 +300,11 @@ class GradeGraphState extends State { horizontalInterval: 1, // checkToShowVerticalLine: (_) => false, // getDrawingHorizontalLine: (_) => FlLine( - // color: AppColors.of(context).text.withOpacity(.15), + // color: AppColors.of(context).text.withValues(alpha: .15), // strokeWidth: 2, // ), // getDrawingVerticalLine: (_) => FlLine( - // color: AppColors.of(context).text.withOpacity(.25), + // color: AppColors.of(context).text.withValues(alpha: .25), // strokeWidth: 2, // ), ), @@ -367,7 +367,7 @@ class GradeGraphState extends State { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), fontWeight: FontWeight.bold, fontSize: 14.0, ), @@ -376,7 +376,7 @@ class GradeGraphState extends State { // getTextStyles: (context, value) => TextStyle( // color: AppColors.of(context) // .text - // .withOpacity(.75), + // .withValues(alpha: .75), // fontWeight: FontWeight.bold, // fontSize: 14.0, // ), diff --git a/refilc_mobile_ui/lib/pages/home/live_card/heads_up_countdown.dart b/refilc_mobile_ui/lib/pages/home/live_card/heads_up_countdown.dart index 8346c6c..f88d5b3 100644 --- a/refilc_mobile_ui/lib/pages/home/live_card/heads_up_countdown.dart +++ b/refilc_mobile_ui/lib/pages/home/live_card/heads_up_countdown.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:animated_flip_counter/animated_flip_counter.dart'; import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; class HeadsUpCountdown extends StatefulWidget { const HeadsUpCountdown( @@ -30,6 +31,7 @@ class _HeadsUpCountdownState extends State { void initState() { super.initState(); elapsed = widget.elapsedTime; + WakelockPlus.enable(); _timer = Timer.periodic(const Duration(seconds: 1), (timer) { if (elapsed <= widget.maxTime) elapsed += 1; setState(() {}); @@ -46,6 +48,7 @@ class _HeadsUpCountdownState extends State { void dispose() { _timer.cancel(); super.dispose(); + WakelockPlus.disable(); } @override diff --git a/refilc_mobile_ui/lib/pages/home/live_card/live_card.dart b/refilc_mobile_ui/lib/pages/home/live_card/live_card.dart index 6d8253d..f976049 100644 --- a/refilc_mobile_ui/lib/pages/home/live_card/live_card.dart +++ b/refilc_mobile_ui/lib/pages/home/live_card/live_card.dart @@ -114,7 +114,7 @@ class LiveCardStateA extends State { // context, // useRootNavigator: true, // builder: (context) => SlidingSheetDialog( - // color: Colors.black.withOpacity(0.99), + // color: Colors.black.withValues(alpha: 0.99), // duration: const Duration(milliseconds: 400), // scrollSpec: const ScrollSpec.bouncingScroll(), // snapSpec: const SnapSpec( @@ -162,7 +162,7 @@ class LiveCardStateA extends State { // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(.85), + // .withValues(alpha: .85), // fontStyle: liveCard.nextLesson!.subject.isRenamed && // settingsProvider.renamedSubjectsItalics // ? FontStyle.italic @@ -176,7 +176,7 @@ class LiveCardStateA extends State { // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(.85), + // .withValues(alpha: .85), // ), // ), // TextSpan(text: "first_lesson_3".i18n), @@ -188,7 +188,7 @@ class LiveCardStateA extends State { // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(.85), + // .withValues(alpha: .85), // ), // ), // TextSpan(text: "first_lesson_4".i18n), @@ -281,7 +281,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), child: Text( @@ -294,7 +294,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), @@ -469,7 +469,7 @@ class LiveCardStateA extends State { fontWeight: FontWeight.w500, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), height: 1.1, ), ), @@ -547,7 +547,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .tertiary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), @@ -561,7 +561,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), @@ -730,10 +730,11 @@ class LiveCardStateA extends State { fontSize: 16.5, color: AppColors.of(context) .text - .withOpacity(!liveCard - .nextLesson!.isEmpty - ? 1.0 - : 0.5), + .withValues( + alpha: !liveCard + .nextLesson!.isEmpty + ? 1.0 + : 0.5), fontStyle: liveCard.nextLesson! .subject.isRenamed && settingsProvider @@ -752,7 +753,7 @@ class LiveCardStateA extends State { height: 1.0, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), ), maxLines: !(nextSubject == null && progressCurrent == null && @@ -830,7 +831,7 @@ class LiveCardStateA extends State { fontWeight: FontWeight.w500, color: AppColors.of(context) .text - .withOpacity(.9), + .withValues(alpha: .9), ), ), ], @@ -899,7 +900,7 @@ class LiveCardStateA extends State { fontWeight: FontWeight.w500, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), height: 1.1, ), ), @@ -977,7 +978,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .tertiary - .withOpacity(.15), + .withValues(alpha: .15), borderRadius: BorderRadius.circular(10.0), ), @@ -991,7 +992,7 @@ class LiveCardStateA extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues(alpha: .9), ), ), ), diff --git a/refilc_mobile_ui/lib/pages/home/live_card/live_card_widget.dart b/refilc_mobile_ui/lib/pages/home/live_card/live_card_widget.dart index db17acf..34648b0 100644 --- a/refilc_mobile_ui/lib/pages/home/live_card/live_card_widget.dart +++ b/refilc_mobile_ui/lib/pages/home/live_card/live_card_widget.dart @@ -132,7 +132,7 @@ class _LiveCardWidgetState extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(0.5), + .withValues(alpha: 0.5), borderRadius: const BorderRadius.all( Radius.circular(10), ), @@ -220,8 +220,9 @@ class _LiveCardWidgetState extends State { context) .colorScheme .secondary - .withOpacity( - .3), + .withValues( + alpha: + .3), borderRadius: BorderRadius .circular( @@ -267,7 +268,7 @@ class _LiveCardWidgetState extends State { size: 26.0, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), ), ), ], @@ -283,7 +284,7 @@ class _LiveCardWidgetState extends State { height: 1.0, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), ), maxLines: !(widget.nextSubject == null && @@ -341,7 +342,8 @@ class _LiveCardWidgetState extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.25), + .withValues( + alpha: .25), borderRadius: BorderRadius.circular( 4.0), @@ -356,7 +358,8 @@ class _LiveCardWidgetState extends State { color: Theme.of(context) .colorScheme .secondary - .withOpacity(.9), + .withValues( + alpha: .9), ), ), ), @@ -366,7 +369,7 @@ class _LiveCardWidgetState extends State { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(.8), + .withValues(alpha: .8), fontWeight: FontWeight.w600, ), maxLines: 1, @@ -393,7 +396,7 @@ class _LiveCardWidgetState extends State { fontWeight: FontWeight.w500, color: AppColors.of(context) .text - .withOpacity(.75), + .withValues(alpha: .75), ), ), ), diff --git a/refilc_mobile_ui/lib/pages/home/live_card/segmented_countdown.dart b/refilc_mobile_ui/lib/pages/home/live_card/segmented_countdown.dart index 772e00d..dd80c7f 100644 --- a/refilc_mobile_ui/lib/pages/home/live_card/segmented_countdown.dart +++ b/refilc_mobile_ui/lib/pages/home/live_card/segmented_countdown.dart @@ -24,7 +24,8 @@ class SegmentedCountdownState extends State { children: [ Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.05), + color: + Theme.of(context).colorScheme.secondary.withValues(alpha: 0.05), borderRadius: BorderRadius.circular(8.0), ), padding: const EdgeInsets.symmetric(vertical: 2.0), @@ -46,7 +47,7 @@ class SegmentedCountdownState extends State { style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.6), + color: AppColors.of(context).text.withValues(alpha: 0.6), ), ), const SizedBox( @@ -54,7 +55,8 @@ class SegmentedCountdownState extends State { ), Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.05), + color: + Theme.of(context).colorScheme.secondary.withValues(alpha: 0.05), borderRadius: BorderRadius.circular(8.0), ), padding: const EdgeInsets.symmetric(vertical: 2.0), @@ -71,7 +73,10 @@ class SegmentedCountdownState extends State { if (diffMins.length == 2) Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.05), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.05), borderRadius: BorderRadius.circular(8.0), ), padding: const EdgeInsets.symmetric(vertical: 2.0), @@ -94,7 +99,7 @@ class SegmentedCountdownState extends State { style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.6), + color: AppColors.of(context).text.withValues(alpha: 0.6), ), ), const SizedBox( @@ -102,7 +107,8 @@ class SegmentedCountdownState extends State { ), Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.05), + color: + Theme.of(context).colorScheme.secondary.withValues(alpha: 0.05), borderRadius: BorderRadius.circular(8.0), ), padding: const EdgeInsets.symmetric(vertical: 2.0), @@ -119,7 +125,10 @@ class SegmentedCountdownState extends State { if (diffSecs.length == 2) Container( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.05), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.05), borderRadius: BorderRadius.circular(8.0), ), padding: const EdgeInsets.symmetric(vertical: 2.0), @@ -142,7 +151,7 @@ class SegmentedCountdownState extends State { style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.6), + color: AppColors.of(context).text.withValues(alpha: 0.6), ), ), ], diff --git a/refilc_mobile_ui/lib/pages/home/particle.dart b/refilc_mobile_ui/lib/pages/home/particle.dart index 5c47a5d..729ba93 100644 --- a/refilc_mobile_ui/lib/pages/home/particle.dart +++ b/refilc_mobile_ui/lib/pages/home/particle.dart @@ -36,7 +36,8 @@ class FourRandomSlotParticle extends Particle { final double relativeDistanceToMiddle; - FourRandomSlotParticle({required this.children, this.relativeDistanceToMiddle = 2.0}); + FourRandomSlotParticle( + {required this.children, this.relativeDistanceToMiddle = 2.0}); @override void paint(Canvas canvas, Size size, double progress, int seed) { @@ -53,13 +54,17 @@ class FourRandomSlotParticle extends Particle { Offset sideToOffset(int side, Size size, Random random) { if (side == 0) { - return Offset(-random.nextDouble() * (size.width / 2), -random.nextDouble() * (size.height / 2)); + return Offset(-random.nextDouble() * (size.width / 2), + -random.nextDouble() * (size.height / 2)); } else if (side == 1) { - return Offset(random.nextDouble() * (size.width / 2), -random.nextDouble() * (size.height / 2)); + return Offset(random.nextDouble() * (size.width / 2), + -random.nextDouble() * (size.height / 2)); } else if (side == 2) { - return Offset(random.nextDouble() * (size.width / 2), random.nextDouble() * (size.height / 2)); + return Offset(random.nextDouble() * (size.width / 2), + random.nextDouble() * (size.height / 2)); } else if (side == 3) { - return Offset(-random.nextDouble() * (size.width / 2), random.nextDouble() * (size.height / 2)); + return Offset(-random.nextDouble() * (size.width / 2), + random.nextDouble() * (size.height / 2)); } else { throw Exception(); } @@ -148,9 +153,16 @@ class CircleMirror extends Particle { final int numberOfParticles; - CircleMirror.builder({required this.particleBuilder, required this.initialRotation, required this.numberOfParticles}); + CircleMirror.builder( + {required this.particleBuilder, + required this.initialRotation, + required this.numberOfParticles}); - CircleMirror({required Particle child, required this.initialRotation, required this.numberOfParticles}) : particleBuilder = ((index) => child); + CircleMirror( + {required Particle child, + required this.initialRotation, + required this.numberOfParticles}) + : particleBuilder = ((index) => child); @override void paint(Canvas canvas, Size size, double progress, seed) { @@ -177,9 +189,15 @@ class RectangleMirror extends Particle { final int numberOfParticles; - RectangleMirror.builder({required this.particleBuilder, required this.initialDistance, required this.numberOfParticles}); + RectangleMirror.builder( + {required this.particleBuilder, + required this.initialDistance, + required this.numberOfParticles}); - RectangleMirror({required Particle child, required this.initialDistance, required this.numberOfParticles}) + RectangleMirror( + {required Particle child, + required this.initialDistance, + required this.numberOfParticles}) : particleBuilder = ((index) => child); @override @@ -191,14 +209,17 @@ class RectangleMirror extends Particle { bool onHorizontalAxis = true; int side = 0; - assert((distanceBetweenParticles * numberOfParticles).round() == totalLength.round()); + assert((distanceBetweenParticles * numberOfParticles).round() == + totalLength.round()); canvas.translate(-size.width / 2, -size.height / 2); double currentDistance = initialDistance; for (int i = 0; i < numberOfParticles; i++) { while (true) { - if (onHorizontalAxis ? currentDistance > size.width : currentDistance > size.height) { + if (onHorizontalAxis + ? currentDistance > size.width + : currentDistance > size.height) { currentDistance -= onHorizontalAxis ? size.width : size.height; onHorizontalAxis = !onHorizontalAxis; side = (++side) % 4; @@ -215,7 +236,8 @@ class RectangleMirror extends Particle { }); } else if (side == 2) { assert(onHorizontalAxis); - moveTo(canvas, size, 2, size.width - currentDistance, size.height, () { + moveTo(canvas, size, 2, size.width - currentDistance, size.height, + () { particleBuilder(i).paint(canvas, size, progress, seed); }); } else if (side == 3) { @@ -233,7 +255,8 @@ class RectangleMirror extends Particle { canvas.restore(); } - void moveTo(Canvas canvas, Size size, int side, double x, double y, VoidCallback painter) { + void moveTo(Canvas canvas, Size size, int side, double x, double y, + VoidCallback painter) { canvas.save(); canvas.translate(x, y); canvas.rotate(-atan2(size.width / 2 - x, size.height / 2 - y)); @@ -261,7 +284,9 @@ class PositionedParticle extends Particle { /// Animates a childs position based on a Tween class AnimatedPositionedParticle extends Particle { - AnimatedPositionedParticle({required Offset begin, required Offset end, required this.child}) : offsetTween = Tween(begin: begin, end: end); + AnimatedPositionedParticle( + {required Offset begin, required Offset end, required this.child}) + : offsetTween = Tween(begin: begin, end: end); final Particle child; @@ -270,7 +295,8 @@ class AnimatedPositionedParticle extends Particle { @override void paint(Canvas canvas, Size size, double progress, seed) { canvas.save(); - canvas.translate(offsetTween.lerp(progress).dx, offsetTween.lerp(progress).dy); + canvas.translate( + offsetTween.lerp(progress).dx, offsetTween.lerp(progress).dy); child.paint(canvas, size, progress, seed); canvas.restore(); } @@ -335,7 +361,9 @@ class AnimatedRotationParticle extends Particle { final Tween rotation; - AnimatedRotationParticle({required this.child, required double begin, required double end}) : rotation = Tween(begin: begin, end: end); + AnimatedRotationParticle( + {required this.child, required double begin, required double end}) + : rotation = Tween(begin: begin, end: end); @override void paint(Canvas canvas, Size size, double progress, int seed) { @@ -362,7 +390,8 @@ class FadingRect extends Particle { @override void paint(Canvas canvas, Size size, double progress, seed) { - canvas.drawRect(Rect.fromLTWH(0.0, 0.0, width, height), Paint()..color = color.withOpacity(1 - progress)); + canvas.drawRect(Rect.fromLTWH(0.0, 0.0, width, height), + Paint()..color = color.withValues(alpha: 1 - progress)); } } @@ -375,7 +404,8 @@ class FadingCircle extends Particle { @override void paint(Canvas canvas, Size size, double progress, seed) { - canvas.drawCircle(Offset.zero, radius, Paint()..color = color.withOpacity(1 - progress)); + canvas.drawCircle(Offset.zero, radius, + Paint()..color = color.withValues(alpha: 1 - progress)); } } @@ -394,7 +424,11 @@ class FadingTriangle extends Particle { /// This is the factor of how much bigger then length than the width is final double heightToBaseFactor; - FadingTriangle({required this.variation, required this.color, required this.baseSize, required this.heightToBaseFactor}); + FadingTriangle( + {required this.variation, + required this.color, + required this.baseSize, + required this.heightToBaseFactor}); @override void paint(Canvas canvas, Size size, double progress, int seed) { @@ -403,7 +437,8 @@ class FadingTriangle extends Particle { path.lineTo(baseSize * variation, baseSize * heightToBaseFactor); path.lineTo(baseSize, 0.0); path.close(); - canvas.drawPath(path, Paint()..color = color.withOpacity(1 - progress)); + canvas.drawPath( + path, Paint()..color = color.withValues(alpha: 1 - progress)); } } @@ -418,7 +453,12 @@ class FadingSnake extends Particle { final Color color; - FadingSnake({required this.width, required this.segmentLength, required this.segments, required this.curvyness, required this.color}); + FadingSnake( + {required this.width, + required this.segmentLength, + required this.segments, + required this.curvyness, + required this.color}); @override void paint(Canvas canvas, Size size, double progress, int seed) { @@ -426,10 +466,12 @@ class FadingSnake extends Particle { canvas.rotate(pi / 6); Path path = Path(); for (int i = 0; i < segments; i++) { - path.quadraticBezierTo(curvyness * i, segmentLength * (i + 1), curvyness * (i + 1), segmentLength * (i + 1)); + path.quadraticBezierTo(curvyness * i, segmentLength * (i + 1), + curvyness * (i + 1), segmentLength * (i + 1)); } for (int i = segments - 1; i >= 0; i--) { - path.quadraticBezierTo(curvyness * (i + 1), segmentLength * i - curvyness, curvyness * i, segmentLength * i - curvyness); + path.quadraticBezierTo(curvyness * (i + 1), segmentLength * i - curvyness, + curvyness * i, segmentLength * i - curvyness); } path.close(); canvas.drawPath(path, Paint()..color = color); diff --git a/refilc_mobile_ui/lib/pages/messages/send_message/send_message.dart b/refilc_mobile_ui/lib/pages/messages/send_message/send_message.dart index e3dbe22..b1a2456 100644 --- a/refilc_mobile_ui/lib/pages/messages/send_message/send_message.dart +++ b/refilc_mobile_ui/lib/pages/messages/send_message/send_message.dart @@ -128,7 +128,8 @@ class SendMessageSheetState extends State { .join(), style: Theme.of(context).textTheme.titleSmall!.copyWith( fontWeight: FontWeight.w700, - color: AppColors.of(context).text.withOpacity(0.75)), + color: + AppColors.of(context).text.withValues(alpha: 0.75)), overflow: TextOverflow.ellipsis, maxLines: 2, textAlign: TextAlign.center, diff --git a/refilc_mobile_ui/lib/pages/notes/submenu/add_note_screen.dart b/refilc_mobile_ui/lib/pages/notes/submenu/add_note_screen.dart index f4e3622..03b5640 100644 --- a/refilc_mobile_ui/lib/pages/notes/submenu/add_note_screen.dart +++ b/refilc_mobile_ui/lib/pages/notes/submenu/add_note_screen.dart @@ -57,7 +57,10 @@ class AddNoteScreenState extends State { decoration: BoxDecoration( border: Border( top: BorderSide( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.1), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.1), width: 1.1, ), ), @@ -178,7 +181,10 @@ class AddNoteScreenState extends State { } }, child: Container( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.2), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.2), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( @@ -196,8 +202,8 @@ class AddNoteScreenState extends State { data: IconThemeData( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(.5) - : Colors.white.withOpacity(.3), + ? Colors.black.withValues(alpha: .5) + : Colors.white.withValues(alpha: .3), ), child: const Icon( FeatherIcons.check, diff --git a/refilc_mobile_ui/lib/pages/notes/submenu/create_image_note.dart b/refilc_mobile_ui/lib/pages/notes/submenu/create_image_note.dart index 765338b..d7a3d03 100644 --- a/refilc_mobile_ui/lib/pages/notes/submenu/create_image_note.dart +++ b/refilc_mobile_ui/lib/pages/notes/submenu/create_image_note.dart @@ -7,7 +7,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:image_crop/image_crop.dart'; +import 'package:image_crop_plus/image_crop_plus.dart'; import 'package:image_picker/image_picker.dart'; import 'package:provider/provider.dart'; import 'package:refilc/api/providers/database_provider.dart'; diff --git a/refilc_mobile_ui/lib/pages/notes/submenu/note_view_screen.dart b/refilc_mobile_ui/lib/pages/notes/submenu/note_view_screen.dart index 6c53209..4db3733 100644 --- a/refilc_mobile_ui/lib/pages/notes/submenu/note_view_screen.dart +++ b/refilc_mobile_ui/lib/pages/notes/submenu/note_view_screen.dart @@ -55,8 +55,10 @@ class NoteViewScreenState extends State { AddNoteScreen(initialNote: widget.note))); }, child: Container( - color: - Theme.of(context).colorScheme.secondary.withOpacity(0.2), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.2), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( @@ -74,8 +76,8 @@ class NoteViewScreenState extends State { data: IconThemeData( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(.5) - : Colors.white.withOpacity(.3), + ? Colors.black.withValues(alpha: .5) + : Colors.white.withValues(alpha: .3), ), child: const Icon( FeatherIcons.edit, @@ -105,7 +107,10 @@ class NoteViewScreenState extends State { Navigator.of(context).pop(); }, child: Container( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.2), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.2), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( @@ -123,8 +128,8 @@ class NoteViewScreenState extends State { data: IconThemeData( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(.5) - : Colors.white.withOpacity(.3), + ? Colors.black.withValues(alpha: .5) + : Colors.white.withValues(alpha: .3), ), child: const Icon( FeatherIcons.trash2, diff --git a/refilc_mobile_ui/lib/pages/notes/submenu/notes_screen.dart b/refilc_mobile_ui/lib/pages/notes/submenu/notes_screen.dart index df9b01b..222fedf 100644 --- a/refilc_mobile_ui/lib/pages/notes/submenu/notes_screen.dart +++ b/refilc_mobile_ui/lib/pages/notes/submenu/notes_screen.dart @@ -173,7 +173,10 @@ class NotesScreenState extends State { SoonAlert.show(context: context); }, child: Container( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.2), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.2), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( @@ -191,8 +194,8 @@ class NotesScreenState extends State { data: IconThemeData( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(.5) - : Colors.white.withOpacity(.3), + ? Colors.black.withValues(alpha: .5) + : Colors.white.withValues(alpha: .3), ), child: const Icon( FeatherIcons.search, @@ -225,7 +228,10 @@ class NotesScreenState extends State { builder: (context) => const AddNoteScreen())); }, child: Container( - color: Theme.of(context).colorScheme.secondary.withOpacity(0.2), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.2), child: Padding( padding: const EdgeInsets.all(8.0), child: Stack( @@ -243,8 +249,8 @@ class NotesScreenState extends State { data: IconThemeData( color: Theme.of(context).brightness == Brightness.light - ? Colors.black.withOpacity(.5) - : Colors.white.withOpacity(.3), + ? Colors.black.withValues(alpha: .5) + : Colors.white.withValues(alpha: .3), ), child: const Icon( FeatherIcons.plus, diff --git a/refilc_mobile_ui/lib/pages/timetable/day_title.dart b/refilc_mobile_ui/lib/pages/timetable/day_title.dart index f6dedb5..805ece1 100644 --- a/refilc_mobile_ui/lib/pages/timetable/day_title.dart +++ b/refilc_mobile_ui/lib/pages/timetable/day_title.dart @@ -63,14 +63,14 @@ class _DayTitleState extends State { textStyle: TextStyle( color: AppColors.of(context) .text - .withOpacity(opacity), + .withValues(alpha: opacity), fontSize: 32.0, fontWeight: FontWeight.bold), ) : TextStyle( color: AppColors.of(context) .text - .withOpacity(opacity), + .withValues(alpha: opacity), fontSize: 32.0, fontWeight: FontWeight.bold), ), diff --git a/refilc_mobile_ui/lib/pages/timetable/fs_timetable.dart b/refilc_mobile_ui/lib/pages/timetable/fs_timetable.dart index ad2f61a..9081ead 100644 --- a/refilc_mobile_ui/lib/pages/timetable/fs_timetable.dart +++ b/refilc_mobile_ui/lib/pages/timetable/fs_timetable.dart @@ -120,7 +120,7 @@ class _FSTimetableState extends State { if (lessons.isEmpty) continue; if (index == 0 && dayIndex >= 0) { - // if (index == 0 || dayIndex >=0) { + // if (index == 0 || dayIndex >=0) { columns.add( SizedBox( width: colw, @@ -157,13 +157,14 @@ class _FSTimetableState extends State { Icon( FeatherIcons.slash, size: 18.0, - color: AppColors.of(context).text.withOpacity(.3), + color: AppColors.of(context).text.withValues(alpha: .3), ), const SizedBox(width: 8.0), Text( "Lyukas óra", style: TextStyle( - color: AppColors.of(context).text.withOpacity(.3), + color: + AppColors.of(context).text.withValues(alpha: .3), ), ), ], @@ -205,7 +206,9 @@ class _FSTimetableState extends State { subject: lsn.subject, ), size: 18.0, - color: AppColors.of(context).text.withOpacity(.7), + color: AppColors.of(context) + .text + .withValues(alpha: .7), ), const SizedBox(width: 8.0), Expanded( @@ -231,7 +234,9 @@ class _FSTimetableState extends State { child: Text( lsn.room, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.5), + color: AppColors.of(context) + .text + .withValues(alpha: .5), overflow: TextOverflow.ellipsis, ), ), @@ -251,4 +256,4 @@ class _FSTimetableState extends State { ), ); } -} \ No newline at end of file +} diff --git a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart index 388a9ac..e2af597 100644 --- a/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart +++ b/refilc_mobile_ui/lib/pages/timetable/timetable_page.dart @@ -585,7 +585,8 @@ class TimetablePageState extends State color: Theme.of(context) .colorScheme .secondary - .withOpacity(0.25), + .withValues( + alpha: 0.25), ), borderRadius: BorderRadius.circular( @@ -615,8 +616,9 @@ class TimetablePageState extends State color: AppColors.of( context) .text - .withOpacity( - 0.90), + .withValues( + alpha: + 0.90), ), child: Text( 'break'.i18n, @@ -661,8 +663,8 @@ class TimetablePageState extends State context) .colorScheme .secondary - .withOpacity( - .5), + .withValues( + alpha: .5), size: 10.0, ) ], @@ -775,11 +777,11 @@ class TimetablePageState extends State // Label labelPadding: EdgeInsets.zero, labelColor: - AppColors.of(context).text.withOpacity(0.9), + AppColors.of(context).text.withValues(alpha: 0.9), unselectedLabelColor: Theme.of(context) .colorScheme .secondary - .withOpacity(0.25) + .withValues(alpha: 0.25) .withAlpha(100), // Indicator indicatorSize: TabBarIndicatorSize.tab, @@ -791,15 +793,15 @@ class TimetablePageState extends State // border: Border.all( // color: AppColors.of(context) // .text - // .withOpacity(0.90)), + // .withValues(alpha: 0.90)), // color: Theme.of(context) // .colorScheme // .secondary - // .withOpacity(0.25), + // .withValues(alpha: 0.25), borderRadius: BorderRadius.circular(16.0), ), - overlayColor: WidgetStateProperty.all( - const Color(0x00000000)), + overlayColor: + WidgetStateProperty.all(const Color(0x00000000)), // Tabs padding: const EdgeInsets.symmetric( vertical: 6.0, horizontal: 24.0), @@ -823,7 +825,7 @@ class TimetablePageState extends State color: Theme.of(context) .colorScheme .secondary - .withOpacity(0.25) + .withValues(alpha: 0.25) .withAlpha(100)), ), Text( @@ -851,7 +853,7 @@ class TimetablePageState extends State color: Theme.of(context) .colorScheme .secondary - .withOpacity(0.25) + .withValues(alpha: 0.25) .withAlpha(100), ), ), diff --git a/refilc_mobile_ui/lib/plus/components/active_sponsor_card.dart b/refilc_mobile_ui/lib/plus/components/active_sponsor_card.dart index 72663df..466bd0e 100644 --- a/refilc_mobile_ui/lib/plus/components/active_sponsor_card.dart +++ b/refilc_mobile_ui/lib/plus/components/active_sponsor_card.dart @@ -78,7 +78,7 @@ class ActiveSponsorCard extends StatelessWidget { borderRadius: BorderRadius.circular(20.0), boxShadow: [ BoxShadow( - color: glow.withOpacity(.4), + color: glow.withValues(alpha: .4), blurRadius: 42.0, ), ], @@ -91,7 +91,7 @@ class ActiveSponsorCard extends StatelessWidget { RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)), child: InkWell( borderRadius: BorderRadius.circular(14.0), - splashColor: glow.withOpacity(.2), + splashColor: glow.withValues(alpha: .2), onTap: () { Navigator.of(context, rootNavigator: true) .push(MaterialPageRoute(builder: (context) { diff --git a/refilc_mobile_ui/lib/plus/components/github_card.dart b/refilc_mobile_ui/lib/plus/components/github_card.dart index a6fce26..4455f9a 100644 --- a/refilc_mobile_ui/lib/plus/components/github_card.dart +++ b/refilc_mobile_ui/lib/plus/components/github_card.dart @@ -19,7 +19,9 @@ class GithubCard extends StatelessWidget { borderRadius: BorderRadius.circular(14.0), onTap: onPressed, child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0).add(const EdgeInsets.only(top: 4.0)), + padding: + const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0) + .add(const EdgeInsets.only(top: 4.0)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -36,7 +38,7 @@ class GithubCard extends StatelessWidget { ), const SizedBox(height: 4.0), Chip( - backgroundColor: Colors.black.withOpacity(.5), + backgroundColor: Colors.black.withValues(alpha: .5), label: const Text( "Már támogatsz? Jelentkezz be!", style: TextStyle(color: Colors.white), diff --git a/refilc_mobile_ui/lib/plus/components/goal_card.dart b/refilc_mobile_ui/lib/plus/components/goal_card.dart index 2e64263..4d11378 100644 --- a/refilc_mobile_ui/lib/plus/components/goal_card.dart +++ b/refilc_mobile_ui/lib/plus/components/goal_card.dart @@ -30,7 +30,7 @@ class PremiumGoalCard extends StatelessWidget { Container( height: 12, decoration: BoxDecoration( - color: Colors.black.withOpacity(.2), + color: Colors.black.withValues(alpha: .2), borderRadius: BorderRadius.circular(45.0), ), ), @@ -59,7 +59,8 @@ class PremiumGoalCard extends StatelessWidget { imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), child: Image.asset("assets/images/heart.png", - color: Colors.black.withOpacity(.3)), + color: + Colors.black.withValues(alpha: .3)), ), Image.asset("assets/images/heart.png"), ], diff --git a/refilc_mobile_ui/lib/plus/components/plan_card.dart b/refilc_mobile_ui/lib/plus/components/plan_card.dart index a672de0..c8ef04d 100644 --- a/refilc_mobile_ui/lib/plus/components/plan_card.dart +++ b/refilc_mobile_ui/lib/plus/components/plan_card.dart @@ -159,7 +159,7 @@ class PlusPlanCard extends StatelessWidget { ), shadowColor: Colors.transparent, surfaceTintColor: Colors.white, - color: Colors.white.withOpacity(0.9), + color: Colors.white.withValues(alpha: 0.9), child: Padding( padding: const EdgeInsets.only( top: 18.0, bottom: 16.0, left: 22.0, right: 18.0), @@ -237,7 +237,7 @@ class PlusPlanCard extends StatelessWidget { Text( description, style: TextStyle( - color: const Color(0xFF011234).withOpacity(0.6), + color: const Color(0xFF011234).withValues(alpha: 0.6), fontSize: 13.69, fontWeight: FontWeight.w500, ), diff --git a/refilc_mobile_ui/lib/plus/components/supporter_group_card.dart b/refilc_mobile_ui/lib/plus/components/supporter_group_card.dart index 70dd691..f0086af 100644 --- a/refilc_mobile_ui/lib/plus/components/supporter_group_card.dart +++ b/refilc_mobile_ui/lib/plus/components/supporter_group_card.dart @@ -27,7 +27,7 @@ class SupporterGroupCard extends StatelessWidget { boxShadow: [ if (glow != null) BoxShadow( - color: glow!.withOpacity(.2), + color: glow!.withValues(alpha: .2), blurRadius: 60.0, ), ], diff --git a/refilc_mobile_ui/lib/plus/plus_screen.dart b/refilc_mobile_ui/lib/plus/plus_screen.dart index e2db8b1..6201d4f 100644 --- a/refilc_mobile_ui/lib/plus/plus_screen.dart +++ b/refilc_mobile_ui/lib/plus/plus_screen.dart @@ -77,11 +77,11 @@ class PlusScreenState extends State { decoration: BoxDecoration( gradient: LinearGradient( colors: [ - const Color(0xffF4F9FF).withOpacity(0.30), - const Color(0xffF4F9FF).withOpacity(0.40), - const Color(0xffF4F9FF).withOpacity(0.50), - const Color(0xffF4F9FF).withOpacity(0.60), - const Color(0xffF4F9FF).withOpacity(0.70), + const Color(0xffF4F9FF).withValues(alpha: 0.30), + const Color(0xffF4F9FF).withValues(alpha: 0.40), + const Color(0xffF4F9FF).withValues(alpha: 0.50), + const Color(0xffF4F9FF).withValues(alpha: 0.60), + const Color(0xffF4F9FF).withValues(alpha: 0.70), ], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -94,10 +94,10 @@ class PlusScreenState extends State { decoration: BoxDecoration( gradient: LinearGradient( colors: [ - const Color(0xffF4F9FF).withOpacity(0.0), - const Color(0xffF4F9FF).withOpacity(0.7), - const Color(0xffF4F9FF).withOpacity(0.8), - const Color(0xffF4F9FF).withOpacity(0.9), + const Color(0xffF4F9FF).withValues(alpha: 0.0), + const Color(0xffF4F9FF).withValues(alpha: 0.7), + const Color(0xffF4F9FF).withValues(alpha: 0.8), + const Color(0xffF4F9FF).withValues(alpha: 0.9), const Color(0xffF4F9FF), ], begin: Alignment.topCenter, @@ -155,7 +155,7 @@ class PlusScreenState extends State { style: TextStyle( fontSize: 14.4, color: const Color(0xFF0A1C41) - .withOpacity(0.5), + .withValues(alpha: 0.5), fontWeight: FontWeight.w600, ), ), @@ -182,7 +182,7 @@ class PlusScreenState extends State { '2', style: TextStyle( color: const Color(0xFF011234) - .withOpacity(0.5), + .withValues(alpha: 0.5), fontSize: 10.0, fontWeight: FontWeight.w500, ), @@ -194,7 +194,8 @@ class PlusScreenState extends State { ), ], style: TextStyle( - color: const Color(0xFF011234).withOpacity(0.6), + color: const Color(0xFF011234) + .withValues(alpha: 0.6), fontWeight: FontWeight.w500, ), ), @@ -300,7 +301,7 @@ class PlusScreenState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.0), border: Border.all( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), ), ), child: SwitchListTile( @@ -329,7 +330,7 @@ class PlusScreenState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.0), border: Border.all( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), ), ), child: ListTile( @@ -427,7 +428,7 @@ class PlusScreenState extends State { // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(16.0), // border: Border.all( - // color: Colors.black.withOpacity(0.2), + // color: Colors.black.withValues(alpha: 0.2), // ), // ), // child: CheckboxListTile( @@ -462,7 +463,7 @@ class PlusScreenState extends State { // 'A szolgáltatási csomag kiválasztásával (megérintés) elfogadod a reFilc előfizetésekkel kapcsolatos Általános Szerződési Feltételeit (elérhető az alábbi link-en: filc.one/pay-terms), valamint Adatkezelési Tájékoztatónkat (elérhető az alábbi link-en: filc.one/pay-privacy).', // textAlign: TextAlign.justify, // style: - // TextStyle(color: Colors.black.withOpacity(0.9)), + // TextStyle(color: Colors.black.withValues(alpha: 0.9)), // ), // ), // faq section @@ -474,7 +475,8 @@ class PlusScreenState extends State { child: Text( 'faq'.i18n, style: TextStyle( - color: const Color(0xFF011234).withOpacity(0.6), + color: + const Color(0xFF011234).withValues(alpha: 0.6), fontWeight: FontWeight.w500, ), ), @@ -518,7 +520,7 @@ class PlusScreenState extends State { TextSpan( style: TextStyle( color: const Color(0xFF011234) - .withOpacity(0.6), + .withValues(alpha: 0.6), fontWeight: FontWeight.w500, ), children: [ @@ -532,7 +534,7 @@ class PlusScreenState extends State { '3', style: TextStyle( color: const Color(0xFF011234) - .withOpacity(0.5), + .withValues(alpha: 0.5), fontSize: 10.0, fontWeight: FontWeight.w500, ), @@ -587,8 +589,8 @@ class PlusScreenState extends State { Text( 'o_1'.i18n, style: TextStyle( - color: - const Color(0xFF011234).withOpacity(0.6), + color: const Color(0xFF011234) + .withValues(alpha: 0.6), fontWeight: FontWeight.w500, ), ), @@ -604,7 +606,8 @@ class PlusScreenState extends State { child: Text( 'desc'.i18n, style: TextStyle( - color: const Color(0xFF011234).withOpacity(0.6), + color: + const Color(0xFF011234).withValues(alpha: 0.6), fontWeight: FontWeight.w500, ), ), diff --git a/refilc_mobile_ui/lib/plus/supporters_screen.dart b/refilc_mobile_ui/lib/plus/supporters_screen.dart index 16b1210..d02613d 100644 --- a/refilc_mobile_ui/lib/plus/supporters_screen.dart +++ b/refilc_mobile_ui/lib/plus/supporters_screen.dart @@ -59,7 +59,9 @@ class SupportersScreen extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 20.0, - color: AppColors.of(context).text.withOpacity(.7)), + color: AppColors.of(context) + .text + .withValues(alpha: .7)), ), ), ), diff --git a/refilc_mobile_ui/lib/screens/error_report_screen.dart b/refilc_mobile_ui/lib/screens/error_report_screen.dart index 6313bd5..c703e1d 100644 --- a/refilc_mobile_ui/lib/screens/error_report_screen.dart +++ b/refilc_mobile_ui/lib/screens/error_report_screen.dart @@ -31,7 +31,7 @@ class ErrorReportScreen extends StatelessWidget { child: Text( "ekretaYou".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(0.7), + color: AppColors.of(context).text.withValues(alpha: 0.7), fontSize: 24.0, fontWeight: FontWeight.w700, ), @@ -88,7 +88,8 @@ class ErrorReportScreen extends StatelessWidget { style: TextStyle( fontFamily: 'GeistMono', fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.9), + color: + AppColors.of(context).text.withValues(alpha: 0.9), ), ), ), @@ -276,4 +277,4 @@ class ErrorDetail extends StatelessWidget { ), ); } -} \ No newline at end of file +} diff --git a/refilc_mobile_ui/lib/screens/login/login_input.dart b/refilc_mobile_ui/lib/screens/login/login_input.dart index b1cfb37..b35ac5b 100644 --- a/refilc_mobile_ui/lib/screens/login/login_input.dart +++ b/refilc_mobile_ui/lib/screens/login/login_input.dart @@ -55,7 +55,7 @@ class _LoginInputState extends State { obscureText: obscure, scrollPhysics: const BouncingScrollPhysics(), decoration: InputDecoration( - // fillColor: Colors.black.withOpacity(0.15), + // fillColor: Colors.black.withValues(alpha: 0.15), filled: false, enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(12.0), @@ -104,13 +104,17 @@ class _LoginInputState extends State { icon: widget.style == LoginInputStyle.password ? Icon( obscure ? FeatherIcons.eye : FeatherIcons.eyeOff, - color: AppColors.of(context).text.withOpacity(0.8), + color: AppColors.of(context) + .text + .withValues(alpha: 0.8), weight: 0.1, size: 18.0, ) : Icon( FeatherIcons.x, - color: AppColors.of(context).text.withOpacity(0.8), + color: AppColors.of(context) + .text + .withValues(alpha: 0.8), weight: 0.1, size: 20.0, ), @@ -122,7 +126,7 @@ class _LoginInputState extends State { style: TextStyle( fontSize: 14.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(0.8), + color: AppColors.of(context).text.withValues(alpha: 0.8), ), ); } diff --git a/refilc_mobile_ui/lib/screens/login/login_screen.dart b/refilc_mobile_ui/lib/screens/login/login_screen.dart index 9d20c7e..2b531ae 100644 --- a/refilc_mobile_ui/lib/screens/login/login_screen.dart +++ b/refilc_mobile_ui/lib/screens/login/login_screen.dart @@ -59,20 +59,20 @@ class LoginScreenState extends State { systemNavigationBarIconBrightness: Brightness.dark, )); - FilcAPI.getSchools().then((schools) { - if (schools != null) { - schoolController.update(() { - schoolController.schools = schools; - }); - } else { - ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar( - content: Text("schools_error".i18n, - style: const TextStyle(color: Colors.white)), - backgroundColor: AppColors.of(context).red, - context: context, - )); - } - }); + // FilcAPI.getSchools().then((schools) { + // if (schools != null) { + // schoolController.update(() { + // schoolController.schools = schools; + // }); + // } else { + // ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar( + // content: Text("schools_error".i18n, + // style: const TextStyle(color: Colors.white)), + // backgroundColor: AppColors.of(context).red, + // context: context, + // )); + // } + // }); } double paddingTop = 0; diff --git a/refilc_mobile_ui/lib/screens/login/school_input/school_input.dart b/refilc_mobile_ui/lib/screens/login/school_input/school_input.dart index bccf68c..1d20a01 100644 --- a/refilc_mobile_ui/lib/screens/login/school_input/school_input.dart +++ b/refilc_mobile_ui/lib/screens/login/school_input/school_input.dart @@ -88,7 +88,7 @@ class SchoolInputState extends State { width: double.infinity, padding: const EdgeInsets.symmetric(vertical: 10.0), decoration: BoxDecoration( - color: Colors.black.withOpacity(0.15), + color: Colors.black.withValues(alpha: 0.15), borderRadius: BorderRadius.circular(12.0), ), child: const Center( diff --git a/refilc_mobile_ui/lib/screens/navigation/navbar_item.dart b/refilc_mobile_ui/lib/screens/navigation/navbar_item.dart index aed418a..71841df 100644 --- a/refilc_mobile_ui/lib/screens/navigation/navbar_item.dart +++ b/refilc_mobile_ui/lib/screens/navigation/navbar_item.dart @@ -34,7 +34,7 @@ class NavbarItem extends StatelessWidget { padding: const EdgeInsets.all(12.0), decoration: BoxDecoration( color: active - ? Theme.of(context).colorScheme.tertiary.withOpacity(.2) + ? Theme.of(context).colorScheme.tertiary.withValues(alpha: .2) : null, borderRadius: BorderRadius.circular(14.0), ), @@ -50,8 +50,8 @@ class NavbarItem extends StatelessWidget { // IconTheme( // data: IconThemeData( // color: Theme.of(context).brightness == Brightness.light - // ? Colors.black.withOpacity(.5) - // : Colors.white.withOpacity(.3), + // ? Colors.black.withValues(alpha: .5) + // : Colors.white.withValues(alpha: .3), // ), // child: icon, // ), diff --git a/refilc_mobile_ui/lib/screens/navigation/status_bar.dart b/refilc_mobile_ui/lib/screens/navigation/status_bar.dart index ea8c6f0..cead16c 100644 --- a/refilc_mobile_ui/lib/screens/navigation/status_bar.dart +++ b/refilc_mobile_ui/lib/screens/navigation/status_bar.dart @@ -59,8 +59,10 @@ class StatusBarState extends State { statusProvider.progress - 36.0, decoration: BoxDecoration( - color: - Theme.of(context).colorScheme.secondary.withOpacity(0.8), + color: Theme.of(context) + .colorScheme + .secondary + .withValues(alpha: 0.8), borderRadius: BorderRadius.circular(45.0), ), ), diff --git a/refilc_mobile_ui/lib/screens/settings/accounts/account_tile.dart b/refilc_mobile_ui/lib/screens/settings/accounts/account_tile.dart index 16e5afa..1c8dbca 100644 --- a/refilc_mobile_ui/lib/screens/settings/accounts/account_tile.dart +++ b/refilc_mobile_ui/lib/screens/settings/accounts/account_tile.dart @@ -37,7 +37,7 @@ class AccountTile extends StatelessWidget { splashRadius: 24.0, onPressed: onTapMenu, icon: Icon(FeatherIcons.moreVertical, - color: AppColors.of(context).text.withOpacity(0.8)), + color: AppColors.of(context).text.withValues(alpha: 0.8)), ), ) : null, diff --git a/refilc_mobile_ui/lib/screens/settings/modify_subject_names.dart b/refilc_mobile_ui/lib/screens/settings/modify_subject_names.dart index 25e4e61..01413f3 100644 --- a/refilc_mobile_ui/lib/screens/settings/modify_subject_names.dart +++ b/refilc_mobile_ui/lib/screens/settings/modify_subject_names.dart @@ -49,12 +49,12 @@ class MenuRenamedSubjects extends StatelessWidget { style: TextStyle( color: AppColors.of(context) .text - .withOpacity(settings.renamedSubjectsEnabled ? 1.0 : .5)), + .withValues(alpha: settings.renamedSubjectsEnabled ? 1.0 : .5)), ), leading: settings.renamedSubjectsEnabled ? const Icon(FeatherIcons.penTool) : Icon(FeatherIcons.penTool, - color: AppColors.of(context).text.withOpacity(.25)), + color: AppColors.of(context).text.withValues(alpha: .25)), trailingDivider: true, trailing: Switch( onChanged: (v) async { @@ -200,7 +200,8 @@ class _ModifySubjectNamesState extends State { .name, style: Theme.of(context).textTheme.titleSmall!.copyWith( fontWeight: FontWeight.w700, - color: AppColors.of(context).text.withOpacity(0.75)), + color: + AppColors.of(context).text.withValues(alpha: 0.75)), overflow: TextOverflow.ellipsis, maxLines: 2, textAlign: TextAlign.center, @@ -330,7 +331,8 @@ class _ModifySubjectNamesState extends State { style: TextStyle( fontWeight: FontWeight.w600, fontSize: 18, - color: AppColors.of(context).text.withOpacity(.85), + color: + AppColors.of(context).text.withValues(alpha: .85), ), ), ), @@ -414,7 +416,7 @@ class RenamedSubjectItem extends StatelessWidget { onTap: () {}, leading: Icon( SubjectIcon.resolveVariant(subject: subject, context: context), - color: AppColors.of(context).text.withOpacity(.75)), + color: AppColors.of(context).text.withValues(alpha: .75)), title: InkWell( onTap: modifyCallback, child: Column( @@ -425,7 +427,7 @@ class RenamedSubjectItem extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 14, - color: AppColors.of(context).text.withOpacity(.75)), + color: AppColors.of(context).text.withValues(alpha: .75)), maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -441,7 +443,7 @@ class RenamedSubjectItem extends StatelessWidget { trailing: InkWell( onTap: removeCallback, child: Icon(FeatherIcons.trash, - color: AppColors.of(context).red.withOpacity(.75)), + color: AppColors.of(context).red.withValues(alpha: .75)), ), ); } diff --git a/refilc_mobile_ui/lib/screens/settings/notifications_screen.dart b/refilc_mobile_ui/lib/screens/settings/notifications_screen.dart index 514515e..dec9ec6 100644 --- a/refilc_mobile_ui/lib/screens/settings/notifications_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/notifications_screen.dart @@ -1,277 +1,277 @@ -import 'package:flutter/foundation.dart'; -import 'package:refilc/api/providers/database_provider.dart'; -import 'package:refilc/api/providers/user_provider.dart'; -import 'package:refilc/helpers/notification_helper.dart'; -import 'package:refilc/models/settings.dart'; -import 'package:refilc/models/user.dart'; -import 'package:refilc/theme/colors/colors.dart'; -// import 'package:refilc_mobile_ui/common/beta_chip.dart'; -import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:provider/provider.dart'; -import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; -import 'notifications_screen.i18n.dart'; +// import 'package:flutter/foundation.dart'; +// import 'package:refilc/api/providers/database_provider.dart'; +// import 'package:refilc/api/providers/user_provider.dart'; +// import 'package:refilc/helpers/notification_helper.dart'; +// import 'package:refilc/models/settings.dart'; +// import 'package:refilc/models/user.dart'; +// import 'package:refilc/theme/colors/colors.dart'; +// // import 'package:refilc_mobile_ui/common/beta_chip.dart'; +// import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_feather_icons/flutter_feather_icons.dart'; +// import 'package:provider/provider.dart'; +// import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; +// import 'notifications_screen.i18n.dart'; -class MenuNotifications extends StatelessWidget { - const MenuNotifications({ - super.key, - this.borderRadius = const BorderRadius.vertical( - top: Radius.circular(4.0), bottom: Radius.circular(4.0)), - }); +// class MenuNotifications extends StatelessWidget { +// const MenuNotifications({ +// super.key, +// this.borderRadius = const BorderRadius.vertical( +// top: Radius.circular(4.0), bottom: Radius.circular(4.0)), +// }); - final BorderRadius borderRadius; +// final BorderRadius borderRadius; - @override - Widget build(BuildContext context) { - return PanelButton( - onPressed: () => Navigator.of(context, rootNavigator: true).push( - CupertinoPageRoute(builder: (context) => const NotificationsScreen()), - ), - title: Row( - children: [ - Text( - "notifications_screen".i18n, - ), - // const SizedBox(width: 5.0), - // const BetaChip( - // disabled: false, - // ), - ], - ), - leading: Icon( - FeatherIcons.messageCircle, - size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), - ), - trailing: Icon( - FeatherIcons.chevronRight, - size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), - ), - borderRadius: borderRadius, - ); - } -} +// @override +// Widget build(BuildContext context) { +// return PanelButton( +// onPressed: () => Navigator.of(context, rootNavigator: true).push( +// CupertinoPageRoute(builder: (context) => const NotificationsScreen()), +// ), +// title: Row( +// children: [ +// Text( +// "notifications_screen".i18n, +// ), +// // const SizedBox(width: 5.0), +// // const BetaChip( +// // disabled: false, +// // ), +// ], +// ), +// leading: Icon( +// FeatherIcons.messageCircle, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: 0.95), +// ), +// trailing: Icon( +// FeatherIcons.chevronRight, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: 0.95), +// ), +// borderRadius: borderRadius, +// ); +// } +// } -class NotificationsScreen extends StatelessWidget { - const NotificationsScreen({super.key}); +// class NotificationsScreen extends StatelessWidget { +// const NotificationsScreen({super.key}); - // Set all notification categories as seen to avoid spamming the user with notifications when they turn on notifications - void setAll(BuildContext context, DateTime date) { - DatabaseProvider database = - Provider.of(context, listen: false); - User? user = Provider.of(context, listen: false).user; - if (user != null) { - for (LastSeenCategory category in LastSeenCategory.values) { - database.userStore - .storeLastSeen(date, userId: user.id, category: category); - } - } - } +// Set all notification categories as seen to avoid spamming the user with notifications when they turn on notifications +// void setAll(BuildContext context, DateTime date) { +// DatabaseProvider database = +// Provider.of(context, listen: false); +// User? user = Provider.of(context, listen: false).user; +// if (user != null) { +// for (LastSeenCategory category in LastSeenCategory.values) { +// database.userStore +// .storeLastSeen(date, userId: user.id, category: category); +// } +// } +// } - @override - Widget build(BuildContext context) { - SettingsProvider settings = Provider.of(context); +// @override +// Widget build(BuildContext context) { +// SettingsProvider settings = Provider.of(context); - return Scaffold( - appBar: AppBar( - surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, - leading: BackButton(color: AppColors.of(context).text), - title: Text( - "notifications_screen".i18n, - style: TextStyle(color: AppColors.of(context).text), - ), - ), - body: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0), - child: Column( - children: [ - SplittedPanel( - padding: const EdgeInsets.only(top: 8.0), - cardPadding: const EdgeInsets.all(4.0), - isSeparated: true, - children: [ - PanelButton( - padding: const EdgeInsets.only(left: 14.0, right: 6.0), - onPressed: () { - settings.update( - notificationsGradesEnabled: - !settings.notificationsGradesEnabled); - setAll(context, DateTime.now()); - }, - title: Text( - "grades".i18n, - style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settings.notificationsGradesEnabled ? .95 : .25), - ), - ), - leading: Icon( - FeatherIcons.bookmark, - size: 22.0, - color: AppColors.of(context).text.withOpacity( - settings.notificationsGradesEnabled ? .95 : .25), - ), - trailing: Switch( - onChanged: (v) => - settings.update(notificationsGradesEnabled: v), - value: settings.notificationsGradesEnabled, - activeColor: Theme.of(context).colorScheme.secondary, - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(12.0), - bottom: Radius.circular(12.0), - ), - ), - ], - ), - SplittedPanel( - padding: const EdgeInsets.only(top: 8.0), - cardPadding: const EdgeInsets.all(4.0), - isSeparated: true, - children: [ - PanelButton( - padding: const EdgeInsets.only(left: 14.0, right: 6.0), - onPressed: () { - settings.update( - notificationsAbsencesEnabled: - !settings.notificationsAbsencesEnabled); - setAll(context, DateTime.now()); - }, - title: Text( - "absences".i18n, - style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settings.notificationsAbsencesEnabled ? .95 : .25), - ), - ), - leading: Icon( - FeatherIcons.clock, - size: 22.0, - color: AppColors.of(context).text.withOpacity( - settings.notificationsAbsencesEnabled ? .95 : .25), - ), - trailing: Switch( - onChanged: (v) => - settings.update(notificationsAbsencesEnabled: v), - value: settings.notificationsAbsencesEnabled, - activeColor: Theme.of(context).colorScheme.secondary, - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(12.0), - bottom: Radius.circular(12.0), - ), - ), - ], - ), - SplittedPanel( - padding: const EdgeInsets.only(top: 8.0), - cardPadding: const EdgeInsets.all(4.0), - isSeparated: true, - children: [ - PanelButton( - padding: const EdgeInsets.only(left: 14.0, right: 6.0), - onPressed: () { - settings.update( - notificationsMessagesEnabled: - !settings.notificationsMessagesEnabled); - setAll(context, DateTime.now()); - }, - title: Text( - "messages".i18n, - style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settings.notificationsMessagesEnabled ? .95 : .25), - ), - ), - leading: Icon( - FeatherIcons.messageSquare, - size: 22.0, - color: AppColors.of(context).text.withOpacity( - settings.notificationsMessagesEnabled ? .95 : .25), - ), - trailing: Switch( - onChanged: (v) => - settings.update(notificationsMessagesEnabled: v), - value: settings.notificationsMessagesEnabled, - activeColor: Theme.of(context).colorScheme.secondary, - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(12.0), - bottom: Radius.circular(12.0), - ), - ), - ], - ), - SplittedPanel( - padding: const EdgeInsets.only(top: 8.0), - cardPadding: const EdgeInsets.all(4.0), - isSeparated: true, - children: [ - PanelButton( - padding: const EdgeInsets.only(left: 14.0, right: 6.0), - onPressed: () { - settings.update( - notificationsLessonsEnabled: - !settings.notificationsLessonsEnabled); - setAll(context, DateTime.now()); - }, - title: Text( - "lessons".i18n, - style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settings.notificationsLessonsEnabled ? .95 : .25), - ), - ), - leading: Icon( - FeatherIcons.bookmark, - size: 22.0, - color: AppColors.of(context).text.withOpacity( - settings.notificationsLessonsEnabled ? .95 : .25), - ), - trailing: Switch( - onChanged: (v) => - settings.update(notificationsLessonsEnabled: v), - value: settings.notificationsLessonsEnabled, - activeColor: Theme.of(context).colorScheme.secondary, - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(12.0), - bottom: Radius.circular(12.0), - ), - ), - ], - ), - // only used for debugging, pressing **will** cause notification spam - kDebugMode - ? SplittedPanel( - padding: const EdgeInsets.only(top: 9.0), - cardPadding: const EdgeInsets.all(4.0), - isSeparated: true, - children: [ - PanelButton( - onPressed: () => setAll( - context, DateTime(1970, 1, 1, 0, 0, 0, 0, 0)), - title: Text("set_all_as_unseen".i18n), - leading: Icon( - FeatherIcons.mail, - size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), - ), - borderRadius: const BorderRadius.vertical( - top: Radius.circular(12.0), - bottom: Radius.circular(12.0)), - ) - ], - ) - : const SizedBox.shrink(), - ], - ), - ), - ), - ); - } -} +// return Scaffold( +// appBar: AppBar( +// surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, +// leading: BackButton(color: AppColors.of(context).text), +// title: Text( +// "notifications_screen".i18n, +// style: TextStyle(color: AppColors.of(context).text), +// ), +// ), +// body: SingleChildScrollView( +// child: Padding( +// padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0), +// child: Column( +// children: [ +// SplittedPanel( +// padding: const EdgeInsets.only(top: 8.0), +// cardPadding: const EdgeInsets.all(4.0), +// isSeparated: true, +// children: [ +// PanelButton( +// padding: const EdgeInsets.only(left: 14.0, right: 6.0), +// onPressed: () { +// settings.update( +// notificationsGradesEnabled: +// !settings.notificationsGradesEnabled); +// setAll(context, DateTime.now()); +// }, +// title: Text( +// "grades".i18n, +// style: TextStyle( +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsGradesEnabled ? .95 : .25), +// ), +// ), +// leading: Icon( +// FeatherIcons.bookmark, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsGradesEnabled ? .95 : .25), +// ), +// trailing: Switch( +// onChanged: (v) => +// settings.update(notificationsGradesEnabled: v), +// value: settings.notificationsGradesEnabled, +// activeColor: Theme.of(context).colorScheme.secondary, +// ), +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(12.0), +// bottom: Radius.circular(12.0), +// ), +// ), +// ], +// ), +// SplittedPanel( +// padding: const EdgeInsets.only(top: 8.0), +// cardPadding: const EdgeInsets.all(4.0), +// isSeparated: true, +// children: [ +// PanelButton( +// padding: const EdgeInsets.only(left: 14.0, right: 6.0), +// onPressed: () { +// settings.update( +// notificationsAbsencesEnabled: +// !settings.notificationsAbsencesEnabled); +// setAll(context, DateTime.now()); +// }, +// title: Text( +// "absences".i18n, +// style: TextStyle( +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsAbsencesEnabled ? .95 : .25), +// ), +// ), +// leading: Icon( +// FeatherIcons.clock, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsAbsencesEnabled ? .95 : .25), +// ), +// trailing: Switch( +// onChanged: (v) => +// settings.update(notificationsAbsencesEnabled: v), +// value: settings.notificationsAbsencesEnabled, +// activeColor: Theme.of(context).colorScheme.secondary, +// ), +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(12.0), +// bottom: Radius.circular(12.0), +// ), +// ), +// ], +// ), +// SplittedPanel( +// padding: const EdgeInsets.only(top: 8.0), +// cardPadding: const EdgeInsets.all(4.0), +// isSeparated: true, +// children: [ +// PanelButton( +// padding: const EdgeInsets.only(left: 14.0, right: 6.0), +// onPressed: () { +// settings.update( +// notificationsMessagesEnabled: +// !settings.notificationsMessagesEnabled); +// setAll(context, DateTime.now()); +// }, +// title: Text( +// "messages".i18n, +// style: TextStyle( +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsMessagesEnabled ? .95 : .25), +// ), +// ), +// leading: Icon( +// FeatherIcons.messageSquare, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsMessagesEnabled ? .95 : .25), +// ), +// trailing: Switch( +// onChanged: (v) => +// settings.update(notificationsMessagesEnabled: v), +// value: settings.notificationsMessagesEnabled, +// activeColor: Theme.of(context).colorScheme.secondary, +// ), +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(12.0), +// bottom: Radius.circular(12.0), +// ), +// ), +// ], +// ), +// SplittedPanel( +// padding: const EdgeInsets.only(top: 8.0), +// cardPadding: const EdgeInsets.all(4.0), +// isSeparated: true, +// children: [ +// PanelButton( +// padding: const EdgeInsets.only(left: 14.0, right: 6.0), +// onPressed: () { +// settings.update( +// notificationsLessonsEnabled: +// !settings.notificationsLessonsEnabled); +// setAll(context, DateTime.now()); +// }, +// title: Text( +// "lessons".i18n, +// style: TextStyle( +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsLessonsEnabled ? .95 : .25), +// ), +// ), +// leading: Icon( +// FeatherIcons.bookmark, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: +// settings.notificationsLessonsEnabled ? .95 : .25), +// ), +// trailing: Switch( +// onChanged: (v) => +// settings.update(notificationsLessonsEnabled: v), +// value: settings.notificationsLessonsEnabled, +// activeColor: Theme.of(context).colorScheme.secondary, +// ), +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(12.0), +// bottom: Radius.circular(12.0), +// ), +// ), +// ], +// ), +// // only used for debugging, pressing **will** cause notification spam +// kDebugMode +// ? SplittedPanel( +// padding: const EdgeInsets.only(top: 9.0), +// cardPadding: const EdgeInsets.all(4.0), +// isSeparated: true, +// children: [ +// PanelButton( +// onPressed: () => setAll( +// context, DateTime(1970, 1, 1, 0, 0, 0, 0, 0)), +// title: Text("set_all_as_unseen".i18n), +// leading: Icon( +// FeatherIcons.mail, +// size: 22.0, +// color: AppColors.of(context).text.withValues(alpha: 0.95), +// ), +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(12.0), +// bottom: Radius.circular(12.0)), +// ) +// ], +// ) +// : const SizedBox.shrink(), +// ], +// ), +// ), +// ), +// ); +// } +// } diff --git a/refilc_mobile_ui/lib/screens/settings/settings_helper.dart b/refilc_mobile_ui/lib/screens/settings/settings_helper.dart index 4cc2e37..78be91b 100644 --- a/refilc_mobile_ui/lib/screens/settings/settings_helper.dart +++ b/refilc_mobile_ui/lib/screens/settings/settings_helper.dart @@ -401,10 +401,8 @@ class SettingsHelper { width: 12.0, height: 12.0, decoration: BoxDecoration( - color: Theme.of(context) - .colorScheme - .secondary - .withOpacity((index + 1) / (vibrationTitle.length + 1)), + color: Theme.of(context).colorScheme.secondary.withValues( + alpha: (index + 1) / (vibrationTitle.length + 1)), shape: BoxShape.circle, ), ), @@ -448,7 +446,7 @@ class SettingsHelper { // width: 175.0, // decoration: BoxDecoration( // borderRadius: BorderRadius.circular(12.0), - // color: AppColors.of(context).text.withOpacity(.25), + // color: AppColors.of(context).text.withValues(alpha: .25), // ), // ), // ); @@ -745,7 +743,7 @@ class _BellDelaySettingState extends State style: TextStyle( fontSize: 12.0, fontWeight: FontWeight.w500, - color: AppColors.of(context).text.withOpacity(.75))), + color: AppColors.of(context).text.withValues(alpha: .75))), Padding( padding: const EdgeInsets.only(bottom: 12.0, top: 6.0), child: Column( @@ -922,6 +920,7 @@ class _LiveActivityColorSettingState extends State { child: Column(children: [ MaterialColorPicker( allowShades: false, + colors: [...fullMaterialColors], selectedColor: settings.liveActivityColor, onMainColorChange: (k) { if (!Provider.of(context, listen: false) diff --git a/refilc_mobile_ui/lib/screens/settings/settings_screen.dart b/refilc_mobile_ui/lib/screens/settings/settings_screen.dart index bb1af36..677e6d2 100644 --- a/refilc_mobile_ui/lib/screens/settings/settings_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/settings_screen.dart @@ -1452,4 +1452,4 @@ class SettingsScreenState extends State void openSubMenu(BuildContext context, StatefulWidget screen) => Navigator.of(context) .push(CupertinoPageRoute(builder: (context) => screen)); -} +} \ No newline at end of file diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/cloud_sync_screen.dart b/refilc_mobile_ui/lib/screens/settings/submenu/cloud_sync_screen.dart index 0d9ad67..49916a6 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/cloud_sync_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/cloud_sync_screen.dart @@ -2,14 +2,12 @@ import 'dart:convert'; import 'package:refilc/api/client.dart'; -import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/models/settings.dart'; import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; import 'package:refilc_mobile_ui/screens/login/qwid_login.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:provider/provider.dart'; @@ -29,15 +27,19 @@ class MenuCloudSyncSettings extends StatelessWidget { @override Widget build(BuildContext context) { return PanelButton( - onPressed: () => Navigator.of(context, rootNavigator: true).push( - CupertinoPageRoute( - builder: (context) => const CloudSyncSettingsScreen()), + // onPressed: () => Navigator.of(context, rootNavigator: true).push( + // CupertinoPageRoute( + // builder: (context) => const CloudSyncSettingsScreen()), + // ), + title: Text( + "cloud_sync".i18n, + style: + TextStyle(color: AppColors.of(context).text.withValues(alpha: 0.3)), ), - title: Text("cloud_sync".i18n), leading: Icon( FeatherIcons.uploadCloud, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.25), ), borderRadius: borderRadius, ); @@ -163,8 +165,9 @@ class CloudSyncSettingsScreenState extends State { title: Text( "qwit_sign_in".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.gradeOpeningFun ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.gradeOpeningFun ? .95 : .25), ), ), borderRadius: const BorderRadius.vertical( @@ -232,8 +235,9 @@ class CloudSyncSettingsScreenState extends State { title: Text( "sync_now".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.gradeOpeningFun ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.gradeOpeningFun ? .95 : .25), ), ), borderRadius: const BorderRadius.vertical( diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/edit_subject.dart b/refilc_mobile_ui/lib/screens/settings/submenu/edit_subject.dart index a05cc77..8e59782 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/edit_subject.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/edit_subject.dart @@ -111,7 +111,7 @@ class EditSubjectScreenState extends State { leading: Icon( FeatherIcons.penTool, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: const BorderRadius.vertical( top: Radius.circular(12.0), @@ -134,7 +134,7 @@ class EditSubjectScreenState extends State { leading: Icon( FeatherIcons.user, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: const BorderRadius.vertical( top: Radius.circular(12.0), @@ -157,13 +157,13 @@ class EditSubjectScreenState extends State { // title: Text( // "rounding".i18n, // style: TextStyle( - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // ), // leading: Icon( // FeatherIcons.gitCommit, // size: 22.0, - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // trailing: Text( // ((widget.subject.customRounding ?? @@ -273,6 +273,9 @@ class EditSubjectScreenState extends State { await databaseProvider.userStore .storeRenamedSubjects(renamedSubjs, userId: user.id!); + print("USER ID BELOW FOR DEBUG:"); + print(user.id); + updateProviders(); Navigator.of(context).pop(); diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/extras_screen.dart b/refilc_mobile_ui/lib/screens/settings/submenu/extras_screen.dart index c347a75..fcbfe74 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/extras_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/extras_screen.dart @@ -38,7 +38,7 @@ class MenuExtrasSettings extends StatelessWidget { leading: Icon( FeatherIcons.edit, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), trailing: Row( mainAxisSize: MainAxisSize.min, @@ -51,7 +51,7 @@ class MenuExtrasSettings extends StatelessWidget { Icon( FeatherIcons.chevronRight, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ) ], ), @@ -126,15 +126,16 @@ class ExtrasSettingsScreenState extends State { title: Text( "surprise_grades".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.gradeOpeningFun ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.gradeOpeningFun ? .95 : .25), ), ), leading: Icon( FeatherIcons.gift, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.gradeOpeningFun ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.gradeOpeningFun ? .95 : .25), ), trailing: Switch( onChanged: (v) async { diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/general_screen.dart b/refilc_mobile_ui/lib/screens/settings/submenu/general_screen.dart index 4d5ff1b..507e7c8 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/general_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/general_screen.dart @@ -30,12 +30,12 @@ class MenuGeneralSettings extends StatelessWidget { leading: Icon( FeatherIcons.settings, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), trailing: Icon( FeatherIcons.chevronRight, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: borderRadius, ); @@ -94,8 +94,9 @@ class GeneralSettingsScreenState extends State { title: Text( "bell_delay".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.bellDelayEnabled ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.bellDelayEnabled ? .95 : .25), ), ), leading: Icon( @@ -103,8 +104,8 @@ class GeneralSettingsScreenState extends State { ? FeatherIcons.bell : FeatherIcons.bellOff, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.bellDelayEnabled ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.bellDelayEnabled ? .95 : .25), ), trailingDivider: true, trailing: Switch( @@ -133,13 +134,14 @@ class GeneralSettingsScreenState extends State { title: Text( "rounding".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.gitCommit, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), trailing: Text( (settingsProvider.rounding / 10).toStringAsFixed(1), @@ -167,15 +169,15 @@ class GeneralSettingsScreenState extends State { title: Text( "graph_class_avg".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.graphClassAvg ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.graphClassAvg ? .95 : .25), ), ), leading: Icon( FeatherIcons.barChart, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.graphClassAvg ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.graphClassAvg ? .95 : .25), ), trailing: Switch( onChanged: (v) => @@ -203,13 +205,14 @@ class GeneralSettingsScreenState extends State { title: Text( "startpage".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.play, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), trailing: Text( startPageTitle.capital(), @@ -235,13 +238,14 @@ class GeneralSettingsScreenState extends State { title: Text( "language".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.globe, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), trailing: Text( languageText, @@ -267,13 +271,13 @@ class GeneralSettingsScreenState extends State { // title: Text( // "vibrate".i18n, // style: TextStyle( - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // ), // leading: Icon( // FeatherIcons.radio, // size: 22.0, - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // trailing: Text( // vibrateTitle, @@ -301,8 +305,8 @@ class GeneralSettingsScreenState extends State { title: Text( "show_breaks".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.showBreaks ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.showBreaks ? .95 : .25), ), ), leading: Icon( @@ -310,9 +314,8 @@ class GeneralSettingsScreenState extends State { ? FeatherIcons.eye : FeatherIcons.eyeOff, size: 22.0, - color: AppColors.of(context) - .text - .withOpacity(settingsProvider.showBreaks ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.showBreaks ? .95 : .25), ), trailing: Switch( onChanged: (v) => settingsProvider.update(showBreaks: v), @@ -341,15 +344,15 @@ class GeneralSettingsScreenState extends State { title: Text( "news".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.newsEnabled ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newsEnabled ? .95 : .25), ), ), leading: Icon( Icons.newspaper_outlined, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.newsEnabled ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newsEnabled ? .95 : .25), ), trailing: Switch( onChanged: (v) => settingsProvider.update(newsEnabled: v), diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/grade_colors.dart b/refilc_mobile_ui/lib/screens/settings/submenu/grade_colors.dart index ec98d95..feb374a 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/grade_colors.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/grade_colors.dart @@ -86,7 +86,7 @@ class GradeColorsSettingsScreenState extends State { color: Theme.of(context) .colorScheme .shadow - .withOpacity(.1), + .withValues(alpha: .1), blurRadius: 10.0, offset: const Offset(0, 5), ), @@ -198,7 +198,7 @@ class GradeColorsSettingsScreenState extends State { : Theme.of(context) .colorScheme .secondary - .withOpacity(.2), + .withValues(alpha: .2), width: 1.0, ), borderRadius: BorderRadius.circular(50.0), @@ -235,7 +235,7 @@ class GradeColorsSettingsScreenState extends State { : Theme.of(context) .colorScheme .secondary - .withOpacity(.2), + .withValues(alpha: .2), width: 1.0, ), borderRadius: BorderRadius.circular(50.0), @@ -272,7 +272,7 @@ class GradeColorsSettingsScreenState extends State { : Theme.of(context) .colorScheme .secondary - .withOpacity(.2), + .withValues(alpha: .2), width: 1.0, ), borderRadius: BorderRadius.circular(50.0), @@ -309,7 +309,7 @@ class GradeColorsSettingsScreenState extends State { : Theme.of(context) .colorScheme .secondary - .withOpacity(.2), + .withValues(alpha: .2), width: 1.0, ), borderRadius: BorderRadius.circular(50.0), @@ -346,7 +346,7 @@ class GradeColorsSettingsScreenState extends State { : Theme.of(context) .colorScheme .secondary - .withOpacity(.2), + .withValues(alpha: .2), width: 1.0, ), borderRadius: BorderRadius.circular(50.0), diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/paint_list.dart b/refilc_mobile_ui/lib/screens/settings/submenu/paint_list.dart index 171b6e6..1df4087 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/paint_list.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/paint_list.dart @@ -42,18 +42,18 @@ class MenuPaintList extends StatelessWidget { title: Text( "own_paints".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.list, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), trailing: Icon( FeatherIcons.chevronRight, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: borderRadius, ); @@ -117,13 +117,13 @@ class PaintListScreenState extends State Text( t.displayName, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), ), Text( t.nickname, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.75), + color: AppColors.of(context).text.withValues(alpha: .75), ), ), ], @@ -219,13 +219,16 @@ class PaintListScreenState extends State title: Text( "enter_id".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.plus, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), borderRadius: const BorderRadius.vertical( top: Radius.circular(12.0), @@ -264,8 +267,9 @@ class PaintListScreenState extends State ? settingsProvider.currentThemeDisplayName : 'no_name'.i18n, style: TextStyle( - color: - AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), Text( @@ -273,8 +277,9 @@ class PaintListScreenState extends State ? settingsProvider.currentThemeCreator : 'Anonymous', style: TextStyle( - color: - AppColors.of(context).text.withOpacity(.65), + color: AppColors.of(context) + .text + .withValues(alpha: .65), fontSize: 15.0, fontWeight: FontWeight.w500, ), @@ -300,7 +305,7 @@ class PaintListScreenState extends State BoxShadow( color: AppColors.of(context) .text - .withOpacity(0.15), + .withValues(alpha: 0.15), offset: const Offset(1, 2), blurRadius: 3, ), @@ -323,7 +328,7 @@ class PaintListScreenState extends State BoxShadow( color: AppColors.of(context) .text - .withOpacity(0.15), + .withValues(alpha: 0.15), offset: const Offset(1, 2), blurRadius: 3, ), @@ -346,7 +351,7 @@ class PaintListScreenState extends State BoxShadow( color: AppColors.of(context) .text - .withOpacity(0.15), + .withValues(alpha: 0.15), offset: const Offset(1, 2), blurRadius: 3, ), diff --git a/refilc_mobile_ui/lib/screens/settings/submenu/personalize_screen.dart b/refilc_mobile_ui/lib/screens/settings/submenu/personalize_screen.dart index d8ea4d9..12493a2 100644 --- a/refilc_mobile_ui/lib/screens/settings/submenu/personalize_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/submenu/personalize_screen.dart @@ -52,12 +52,12 @@ class MenuPersonalizeSettings extends StatelessWidget { leading: Icon( Icons.palette_outlined, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), trailing: Icon( FeatherIcons.chevronRight, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: borderRadius, ); @@ -175,7 +175,7 @@ class PersonalizeSettingsScreenState extends State : s.subject.name.capital()) ?? '', style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), fontStyle: settingsProvider.renamedSubjectsItalics ? FontStyle.italic : FontStyle.normal, @@ -187,7 +187,7 @@ class PersonalizeSettingsScreenState extends State : s.teacher.name.capital()) ?? '', style: TextStyle( - color: AppColors.of(context).text.withOpacity(.85), + color: AppColors.of(context).text.withValues(alpha: .85), fontWeight: FontWeight.w400, fontSize: 15.0, height: 1.2, @@ -198,12 +198,12 @@ class PersonalizeSettingsScreenState extends State leading: Icon( SubjectIcon.resolveVariant(context: context, subject: s.subject), size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context).text.withValues(alpha: .95), ), trailing: Icon( FeatherIcons.chevronRight, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context).text.withValues(alpha: 0.95), ), borderRadius: BorderRadius.vertical( top: Radius.circular(i == 0 ? 12.0 : 4.0), @@ -242,7 +242,7 @@ class PersonalizeSettingsScreenState extends State // f, // style: GoogleFonts.getFont( // f, - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // fontStyle: settingsProvider.renamedSubjectsItalics // ? FontStyle.italic // : FontStyle.normal, @@ -252,7 +252,7 @@ class PersonalizeSettingsScreenState extends State // ? Icon( // FeatherIcons.chevronRight, // size: 22.0, - // color: AppColors.of(context).text.withOpacity(0.95), + // color: AppColors.of(context).text.withValues(alpha: 0.95), // ) // : null, // borderRadius: BorderRadius.circular(12.0), @@ -324,7 +324,9 @@ class PersonalizeSettingsScreenState extends State leading: Icon( FeatherIcons.sun, size: 22.0, - color: AppColors.of(context).text.withOpacity(0.95), + color: AppColors.of(context) + .text + .withValues(alpha: 0.95), ), trailing: Text( themeModeText, @@ -354,13 +356,16 @@ class PersonalizeSettingsScreenState extends State title: Text( "color".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.droplet, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), trailing: Container( width: 12.0, @@ -388,15 +393,15 @@ class PersonalizeSettingsScreenState extends State title: Text( "new_colors".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.newColors ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newColors ? .95 : .25), ), ), leading: Icon( Icons.flare_outlined, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.newColors ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newColors ? .95 : .25), ), trailing: Switch( onChanged: (v) async { @@ -437,15 +442,16 @@ class PersonalizeSettingsScreenState extends State title: Text( "shadow_effect".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.shadowEffect ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.shadowEffect ? .95 : .25), ), ), leading: Icon( FeatherIcons.moon, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.shadowEffect ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.shadowEffect ? .95 : .25), ), trailing: Switch( onChanged: (v) async { @@ -480,15 +486,15 @@ class PersonalizeSettingsScreenState extends State title: Text( "new_popups".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.newPopups ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newPopups ? .95 : .25), ), ), leading: Icon( FeatherIcons.alertOctagon, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.newPopups ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.newPopups ? .95 : .25), ), trailing: Switch( onChanged: (v) async { @@ -519,13 +525,13 @@ class PersonalizeSettingsScreenState extends State // title: Text( // "icon_pack".i18n, // style: TextStyle( - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // ), // leading: Icon( // FeatherIcons.grid, // size: 22.0, - // color: AppColors.of(context).text.withOpacity(.95), + // color: AppColors.of(context).text.withValues(alpha: .95), // ), // trailing: Text( // settingsProvider.iconPack.name.capital(), @@ -558,13 +564,16 @@ class PersonalizeSettingsScreenState extends State title: Text( "grade_colors".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.star, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), trailing: Row( mainAxisSize: MainAxisSize.min, @@ -616,8 +625,8 @@ class PersonalizeSettingsScreenState extends State title: Text( "rename_subjects".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.renamedSubjectsEnabled + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.renamedSubjectsEnabled ? .95 : .25), ), @@ -625,8 +634,8 @@ class PersonalizeSettingsScreenState extends State leading: Icon( Icons.school_outlined, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.renamedSubjectsEnabled + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.renamedSubjectsEnabled ? .95 : .25), ), @@ -675,8 +684,8 @@ class PersonalizeSettingsScreenState extends State title: Text( "rename_teachers".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.renamedTeachersEnabled + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.renamedTeachersEnabled ? .95 : .25), ), @@ -684,8 +693,8 @@ class PersonalizeSettingsScreenState extends State leading: Icon( FeatherIcons.user, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.renamedTeachersEnabled + color: AppColors.of(context).text.withValues( + alpha: settingsProvider.renamedTeachersEnabled ? .95 : .25), ), @@ -729,14 +738,17 @@ class PersonalizeSettingsScreenState extends State title: Text( "live_activity_color".i18n, style: TextStyle( - color: - AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.activity, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), trailing: Container( margin: const EdgeInsets.only(left: 2.0), @@ -855,7 +867,7 @@ class PersonalizeSettingsScreenState extends State style: TextStyle( color: AppColors.of(context) .text - .withOpacity(.95), + .withValues(alpha: .95), ), ), leading: Icon( @@ -863,7 +875,7 @@ class PersonalizeSettingsScreenState extends State size: 22.0, color: AppColors.of(context) .text - .withOpacity(.95), + .withValues(alpha: .95), ), borderRadius: const BorderRadius.vertical( top: Radius.circular(12.0), @@ -1022,13 +1034,16 @@ class PersonalizeSettingsScreenState extends State title: Text( "font_family".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity(.95), + color: AppColors.of(context) + .text + .withValues(alpha: .95), ), ), leading: Icon( FeatherIcons.type, size: 22.0, - color: AppColors.of(context).text.withOpacity(.95), + color: + AppColors.of(context).text.withValues(alpha: .95), ), trailing: Text( settingsProvider.fontFamily != '' @@ -1066,15 +1081,17 @@ class PersonalizeSettingsScreenState extends State title: Text( "only_ch_title_font".i18n, style: TextStyle( - color: AppColors.of(context).text.withOpacity( - settingsProvider.titleOnlyFont ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.titleOnlyFont ? .95 : .25), ), ), leading: Icon( Icons.text_increase_rounded, size: 22.0, - color: AppColors.of(context).text.withOpacity( - settingsProvider.titleOnlyFont ? .95 : .25), + color: AppColors.of(context).text.withValues( + alpha: + settingsProvider.titleOnlyFont ? .95 : .25), ), trailing: Switch( onChanged: (v) async { diff --git a/refilc_mobile_ui/lib/screens/settings/theme_screen.dart b/refilc_mobile_ui/lib/screens/settings/theme_screen.dart index eb7ec85..9cc46e6 100644 --- a/refilc_mobile_ui/lib/screens/settings/theme_screen.dart +++ b/refilc_mobile_ui/lib/screens/settings/theme_screen.dart @@ -271,9 +271,12 @@ class _PremiumCustomAccentColorSettingState stops: const [0.0, 0.75], colors: isBackgroundDifferent ? [ - Theme.of(context).colorScheme.surface.withOpacity(1 - - ((currentTheme == ThemeMode.dark ? 0.65 : 0.25) * - backgroundAnimation.value)), + Theme.of(context).colorScheme.surface.withValues( + alpha: 1 - + ((currentTheme == ThemeMode.dark + ? 0.65 + : 0.25) * + backgroundAnimation.value)), backgroundGradientBottomColor, ] : [ diff --git a/refilc_mobile_ui/lib/screens/settings/user/profile_pic.dart b/refilc_mobile_ui/lib/screens/settings/user/profile_pic.dart index 9df85b0..2fcb724 100644 --- a/refilc_mobile_ui/lib/screens/settings/user/profile_pic.dart +++ b/refilc_mobile_ui/lib/screens/settings/user/profile_pic.dart @@ -16,7 +16,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:refilc_mobile_ui/screens/settings/settings_screen.i18n.dart'; import 'package:provider/provider.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:image_crop/image_crop.dart'; +import 'package:image_crop_plus/image_crop_plus.dart'; // ignore: must_be_immutable class UserMenuProfilePic extends StatelessWidget { diff --git a/refilc_mobile_ui/lib/screens/summary/pages/grades_page.dart b/refilc_mobile_ui/lib/screens/summary/pages/grades_page.dart index 28e16b6..74a5a34 100644 --- a/refilc_mobile_ui/lib/screens/summary/pages/grades_page.dart +++ b/refilc_mobile_ui/lib/screens/summary/pages/grades_page.dart @@ -112,7 +112,7 @@ class GradesBodyState extends State { style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20.0, - color: Colors.white.withOpacity(0.98), + color: Colors.white.withValues(alpha: 0.98), fontStyle: settings.renamedSubjectsItalics && subject.isRenamed ? FontStyle.italic : null, @@ -145,7 +145,7 @@ class GradesBodyState extends State { style: TextStyle( fontSize: 18.0, height: 2.0, - color: Colors.white.withOpacity(0.5)), + color: Colors.white.withValues(alpha: 0.5)), ), ], ), @@ -331,10 +331,10 @@ class GradesBodyState extends State { horizontal: 16.0, vertical: 4.0), decoration: BoxDecoration( color: gradeColor(context: context, value: endYearAvg) - .withOpacity(.2), + .withValues(alpha: .2), border: Border.all( color: (gradeColor(context: context, value: endYearAvg)) - .withOpacity(0.0), + .withValues(alpha: 0.0), width: 2.0, ), borderRadius: BorderRadius.circular(45.0), diff --git a/refilc_mobile_ui/lib/screens/summary/pages/lessons_page.dart b/refilc_mobile_ui/lib/screens/summary/pages/lessons_page.dart index 477fa1e..5381225 100644 --- a/refilc_mobile_ui/lib/screens/summary/pages/lessons_page.dart +++ b/refilc_mobile_ui/lib/screens/summary/pages/lessons_page.dart @@ -310,7 +310,7 @@ class LessonsBodyState extends State { style: TextStyle( fontSize: 18.0, height: 2.0, - color: Colors.white.withOpacity(0.5)), + color: Colors.white.withValues(alpha: 0.5)), ), ], ), diff --git a/refilc_mobile_ui/lib/screens/summary/pages/personality_page.dart b/refilc_mobile_ui/lib/screens/summary/pages/personality_page.dart index 128e918..4f1727b 100644 --- a/refilc_mobile_ui/lib/screens/summary/pages/personality_page.dart +++ b/refilc_mobile_ui/lib/screens/summary/pages/personality_page.dart @@ -10,7 +10,7 @@ import 'package:provider/provider.dart'; import 'package:screenshot/screenshot.dart'; import 'package:share_plus/share_plus.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; +import 'package:image_gallery_saver_plus/image_gallery_saver_plus.dart'; class PersonalityBody extends StatefulWidget { const PersonalityBody({super.key}); @@ -47,7 +47,8 @@ class PersonalityBodyState extends State { savePersonality() async { await screenshotController.capture().then((image) async { if (image != null) { - await ImageGallerySaver.saveImage(image, name: 'refilc_personality'); + await ImageGallerySaverPlus.saveImage(image, + name: 'refilc_personality'); } }).catchError((err) { throw err; @@ -97,7 +98,7 @@ class PersonalityBodyState extends State { ), style: ButtonStyle( backgroundColor: WidgetStateProperty.all( - Colors.white.withOpacity(0.2)), + Colors.white.withValues(alpha: 0.2)), ), ), const SizedBox( @@ -114,7 +115,7 @@ class PersonalityBodyState extends State { ), style: ButtonStyle( backgroundColor: WidgetStateProperty.all( - Colors.white.withOpacity(0.2)), + Colors.white.withValues(alpha: 0.2)), ), ), ], diff --git a/refilc_mobile_ui/lib/screens/summary/pages/start_page.dart b/refilc_mobile_ui/lib/screens/summary/pages/start_page.dart index 38a728f..043451e 100644 --- a/refilc_mobile_ui/lib/screens/summary/pages/start_page.dart +++ b/refilc_mobile_ui/lib/screens/summary/pages/start_page.dart @@ -44,7 +44,7 @@ class StartBodyState extends State { context, useRootNavigator: true, builder: (context) => SlidingSheetDialog( - color: Colors.black.withOpacity(0.99), + color: Colors.black.withValues(alpha: 0.99), duration: const Duration(milliseconds: 400), scrollSpec: const ScrollSpec.bouncingScroll(), snapSpec: const SnapSpec( @@ -84,7 +84,7 @@ class StartBodyState extends State { style: TextStyle( fontWeight: FontWeight.w500, fontSize: 16.0, - color: Colors.white.withOpacity(0.7), + color: Colors.white.withValues(alpha: 0.7), ), ), ], diff --git a/refilc_mobile_ui/lib/screens/summary/summary_screen.dart b/refilc_mobile_ui/lib/screens/summary/summary_screen.dart index e7f198a..451a25d 100644 --- a/refilc_mobile_ui/lib/screens/summary/summary_screen.dart +++ b/refilc_mobile_ui/lib/screens/summary/summary_screen.dart @@ -196,7 +196,7 @@ class SummaryScreenState extends State context, useRootNavigator: true, builder: (context) => SlidingSheetDialog( - color: Colors.black.withOpacity(0.99), + color: Colors.black.withValues(alpha: 0.99), duration: const Duration(milliseconds: 400), scrollSpec: const ScrollSpec.bouncingScroll(), snapSpec: const SnapSpec( diff --git a/refilc_mobile_ui/pubspec.yaml b/refilc_mobile_ui/pubspec.yaml index e180352..94ca9ea 100644 --- a/refilc_mobile_ui/pubspec.yaml +++ b/refilc_mobile_ui/pubspec.yaml @@ -2,7 +2,7 @@ name: refilc_mobile_ui publish_to: "none" environment: - sdk: ">=3.3.2 <=3.6.0" + sdk: ^3.6.0 dependencies: flutter: @@ -30,16 +30,13 @@ dependencies: flutter_markdown: ^0.7.2+1 animations: ^2.0.11 animated_list_plus: ^0.5.0 - confetti: ^0.7.0 + confetti: ^0.8.0 # live_activities: ^1.9.1+1 animated_flip_counter: ^0.3.4 lottie: ^3.1.0 rive: ^0.12.4 animated_background: ^2.0.0 - home_widget: - git: - url: https://github.com/refilc/home_widget.git - ref: flutter-beta + home_widget: ^0.7.0+1 dropdown_button2: ^2.3.9 flutter_svg: ^2.0.10+1 background_fetch: ^1.2.2 @@ -47,11 +44,8 @@ dependencies: package_info_plus: ^8.0.0 dotted_border: ^2.0.0+3 screenshot: ^3.0.0 - image_gallery_saver: ^2.0.2 - rounded_expansion_tile: - git: - url: https://github.com/kimaah/rounded_expansion_tile.git - # go_router: ^14.2.0 + image_gallery_saver_plus: ^3.0.5 + rounded_expansion_tile: ^0.0.13 flutter_expandable_fab: ^2.0.0 intl: ^0.19.0 i18n_extension: ^12.0.1 @@ -61,13 +55,10 @@ dependencies: share_plus: ^10.0.3 image_picker: ^1.0.7 path_provider: ^2.1.2 - image_crop: - git: - url: https://github.com/kimaah/image_crop.git + image_crop_plus: ^1.0.0 uuid: ^4.3.3 - maps_launcher: ^2.2.0 + maps_launcher: ^3.0.0+1 google_fonts: ^6.1.0 - # flutter_any_logo: ^1.1.1 custom_sliding_segmented_control: ^1.8.1 get_it: ^7.6.7 xml: ^6.5.0 @@ -78,9 +69,13 @@ dependencies: file_picker: ^8.0.5 shake_flutter: ^17.0.0 qr_code_scanner_plus: ^2.0.6 + wakelock_plus: ^1.2.10 dev_dependencies: - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 + +dependency_overrides: + webview_flutter_wkwebview: 3.17.0 flutter: uses-material-design: true diff --git a/refilc_plus b/refilc_plus index 800f5ce..478edbe 160000 --- a/refilc_plus +++ b/refilc_plus @@ -1 +1 @@ -Subproject commit 800f5ce92daafb002990cb7838e8ce4b28bc1a7d +Subproject commit 478edbefc025f89270c345bd3b3e8ab3325a30f9 diff --git a/tools.py b/tools.py index 56e8c88..1690810 100644 --- a/tools.py +++ b/tools.py @@ -124,7 +124,6 @@ def pub_fix(): "refilc", "refilc_kreta_api", "refilc_mobile_ui", - "refilc_desktop_ui", "refilc_plus" ] diff --git a/upgrade-pub.sh b/upgrade-pub.sh index 9d4e72c..d2f733d 100755 --- a/upgrade-pub.sh +++ b/upgrade-pub.sh @@ -1,7 +1,7 @@ cd refilc && flutter pub upgrade && cd .. cd refilc_kreta_api && flutter pub upgrade && cd .. cd refilc_mobile_ui && flutter pub upgrade && cd .. -cd refilc_desktop_ui && flutter pub upgrade && cd .. +# cd refilc_desktop_ui && flutter pub upgrade && cd .. cd refilc_plus && flutter pub upgrade && cd .. echo Upgraded pub.