forked from firka/student-legacy
added new feature badge and unseen new feature list to settings
This commit is contained in:
parent
c40026e594
commit
9470c848bf
@ -54,6 +54,7 @@ const settingsDB = DatabaseStruct("settings", {
|
||||
"new_colors": int,
|
||||
"uwu_mode": int,
|
||||
"new_popups": int,
|
||||
"unseen_new_features": String,
|
||||
// quick settings
|
||||
"q_timetable_lesson_num": int, "q_timetable_sub_tiles": int,
|
||||
"q_subjects_sub_tiles": int,
|
||||
|
@ -107,6 +107,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool _newColors;
|
||||
bool _uwuMode;
|
||||
bool _newPopups;
|
||||
List<String> _unseenNewFeatures;
|
||||
// quick settings
|
||||
bool _qTimetableLessonNum;
|
||||
bool _qTimetableSubTiles;
|
||||
@ -180,6 +181,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
required bool newColors,
|
||||
required bool uwuMode,
|
||||
required bool newPopups,
|
||||
required List<String> unseenNewFeatures,
|
||||
required bool qTimetableLessonNum,
|
||||
required bool qTimetableSubTiles,
|
||||
required bool qSubjectsSubTiles,
|
||||
@ -250,6 +252,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
_newColors = newColors,
|
||||
_uwuMode = uwuMode,
|
||||
_newPopups = newPopups,
|
||||
_unseenNewFeatures = unseenNewFeatures,
|
||||
_qTimetableLessonNum = qTimetableLessonNum,
|
||||
_qTimetableSubTiles = qTimetableSubTiles,
|
||||
_qSubjectsSubTiles = qSubjectsSubTiles;
|
||||
@ -339,6 +342,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
newColors: map['new_colors'] == 1,
|
||||
uwuMode: map['uwu_mode'] == 1,
|
||||
newPopups: map['new_popups'] == 1,
|
||||
unseenNewFeatures: jsonDecode(map["unseen_new_features"]).cast<String>(),
|
||||
qTimetableLessonNum: map['q_timetable_lesson_num'] == 1,
|
||||
qTimetableSubTiles: map['q_timetable_sub_tiles'] == 1,
|
||||
qSubjectsSubTiles: map['q_subjects_sub_tiles'] == 1,
|
||||
@ -416,6 +420,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
"new_colors": _newColors ? 1 : 0,
|
||||
"uwu_mode": _uwuMode ? 1 : 0,
|
||||
"new_popups": _newPopups ? 1 : 0,
|
||||
"unseen_new_features": jsonEncode(_unseenNewFeatures),
|
||||
"q_timetable_lesson_num": _qTimetableLessonNum ? 1 : 0,
|
||||
"q_timetable_sub_tiles": _qTimetableSubTiles ? 1 : 0,
|
||||
"q_subjects_sub_tiles": _qSubjectsSubTiles ? 1 : 0,
|
||||
@ -497,6 +502,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
newColors: true,
|
||||
uwuMode: false,
|
||||
newPopups: true,
|
||||
unseenNewFeatures: [],
|
||||
qTimetableLessonNum: true,
|
||||
qTimetableSubTiles: true,
|
||||
qSubjectsSubTiles: true,
|
||||
@ -569,6 +575,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool get newColors => _newColors;
|
||||
bool get uwuMode => _uwuMode;
|
||||
bool get newPopups => _newPopups;
|
||||
List<String> get unseenNewFeatures => _unseenNewFeatures;
|
||||
bool get qTimetableLessonNum => _qTimetableLessonNum;
|
||||
bool get qTimetableSubTiles => _qTimetableSubTiles;
|
||||
bool get qSubjectsSubTiles => _qSubjectsSubTiles;
|
||||
@ -637,6 +644,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool? newColors,
|
||||
bool? uwuMode,
|
||||
bool? newPopups,
|
||||
List<String>? unseenNewFeatures,
|
||||
bool? qTimetableLessonNum,
|
||||
bool? qTimetableSubTiles,
|
||||
bool? qSubjectsSubTiles,
|
||||
@ -828,6 +836,9 @@ class SettingsProvider extends ChangeNotifier {
|
||||
if (newPopups != null && newPopups != _newPopups) {
|
||||
_newPopups = newPopups;
|
||||
}
|
||||
if (unseenNewFeatures != null && unseenNewFeatures != _unseenNewFeatures) {
|
||||
_unseenNewFeatures = unseenNewFeatures;
|
||||
}
|
||||
if (qTimetableLessonNum != null &&
|
||||
qTimetableLessonNum != _qTimetableLessonNum) {
|
||||
_qTimetableLessonNum = qTimetableLessonNum;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'chips.i18n.dart';
|
||||
|
||||
class BetaChip extends StatelessWidget {
|
||||
const BetaChip({super.key, this.disabled = false});
|
||||
@ -22,7 +23,7 @@ class BetaChip extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(left: 8, right: 8),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"BETA",
|
||||
"beta".i18n,
|
||||
softWrap: true,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
24
refilc_mobile_ui/lib/common/chips/chips.i18n.dart
Normal file
24
refilc_mobile_ui/lib/common/chips/chips.i18n.dart
Normal file
@ -0,0 +1,24 @@
|
||||
import 'package:i18n_extension/i18n_extension.dart';
|
||||
|
||||
extension ScreensLocalization on String {
|
||||
static final _t = Translations.byLocale("hu_hu") +
|
||||
{
|
||||
"en_en": {
|
||||
"new": "NEW",
|
||||
"beta": "BETA",
|
||||
},
|
||||
"hu_hu": {
|
||||
"new": "ÚJ",
|
||||
"beta": "BÉTA",
|
||||
},
|
||||
"de_de": {
|
||||
"new": "NEU",
|
||||
"beta": "BETA",
|
||||
},
|
||||
};
|
||||
|
||||
String get i18n => localize(this, _t);
|
||||
String fill(List<Object> params) => localizeFill(this, params);
|
||||
String plural(int value) => localizePlural(value, this, _t);
|
||||
String version(Object modifier) => localizeVersion(modifier, this, _t);
|
||||
}
|
45
refilc_mobile_ui/lib/common/chips/new_chip.dart
Normal file
45
refilc_mobile_ui/lib/common/chips/new_chip.dart
Normal file
@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'chips.i18n.dart';
|
||||
|
||||
class NewChip extends StatelessWidget {
|
||||
const NewChip({super.key, this.disabled = false});
|
||||
|
||||
final bool disabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
disabled ? AppColors.of(context).text.withOpacity(.25) : Colors.red,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 6.0, right: 8.0, top: 4.0, bottom: 4.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.hotel_class_rounded,
|
||||
color: disabled
|
||||
? AppColors.of(context).text.withOpacity(.5)
|
||||
: Colors.white,
|
||||
size: 14.0,
|
||||
),
|
||||
const SizedBox(width: 2.0),
|
||||
Text(
|
||||
'new'.i18n,
|
||||
style: TextStyle(
|
||||
color: disabled
|
||||
? AppColors.of(context).text.withOpacity(.5)
|
||||
: Colors.white,
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -389,6 +389,8 @@ class PlusScreenState extends State<PlusScreen> {
|
||||
),
|
||||
),
|
||||
child: CheckboxListTile(
|
||||
side:
|
||||
const BorderSide(color: Colors.black, width: 2.0),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(left: 15.0, right: 10.0),
|
||||
value: docsAccepted,
|
||||
|
@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:refilc_mobile_ui/screens/settings/settings_screen.i18n.dart';
|
||||
import 'package:refilc_mobile_ui/common/beta_chip.dart';
|
||||
import 'package:refilc_mobile_ui/common/chips/beta_chip.dart';
|
||||
|
||||
class MenuDesktopSettings extends StatelessWidget {
|
||||
const MenuDesktopSettings({super.key, required this.settings});
|
||||
|
Loading…
x
Reference in New Issue
Block a user