Merge branch 'dev' of https://github.com/refilc/naplo into dev

This commit is contained in:
zypherift 2024-05-01 22:58:31 +02:00
commit ab56de53eb
20 changed files with 492 additions and 137 deletions

View File

@ -83,7 +83,8 @@ class AppTheme {
accentColor == AccentColor.ogfilc) || accentColor == AccentColor.ogfilc) ||
!settings.newColors !settings.newColors
? accent ? accent
: ColorsUtils().darken(accent, amount: 0.5); : ColorsUtils().darken(accent,
amount: 0.4); // white mode: same tertiary as secondary
return ThemeData( return ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
@ -186,14 +187,15 @@ class AppTheme {
accentColor == AccentColor.ogfilc) || accentColor == AccentColor.ogfilc) ||
!settings.newColors !settings.newColors
? accent ? accent
: ColorsUtils().lighten(accent, amount: 0.1); : ColorsUtils().lighten(accent, amount: 0.3);
// Color newScaffoldBg = ColorsUtils().lighten(accent, amount: 0.4); // Color newScaffoldBg = ColorsUtils().lighten(accent, amount: 0.4);
Color newTertiary = (accentColor == AccentColor.adaptive || Color newTertiary = (accentColor == AccentColor.adaptive ||
accentColor == AccentColor.custom || accentColor == AccentColor.custom ||
accentColor == AccentColor.ogfilc) || accentColor == AccentColor.ogfilc) ||
!settings.newColors !settings.newColors
? accent ? accent
: ColorsUtils().lighten(accent, amount: 0.4); : ColorsUtils().darken(accent,
amount: 0.1); // dark mode: tertiary is way darker than secondary
return ThemeData( return ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,

View File

@ -17,16 +17,26 @@ import 'package:provider/provider.dart';
import 'lesson_tile.i18n.dart'; import 'lesson_tile.i18n.dart';
class LessonTile extends StatelessWidget { class LessonTile extends StatelessWidget {
const LessonTile(this.lesson, const LessonTile(
{super.key, this.lesson, {
this.onTap, super.key,
this.swapDesc = false, this.onTap,
this.subjectPageView = false}); this.swapDesc = false,
this.subjectPageView = false,
this.swapRoom = false,
this.currentLessonIndicator = true,
this.padding,
this.contentPadding,
});
final Lesson lesson; final Lesson lesson;
final bool swapDesc; final bool swapDesc;
final void Function()? onTap; final void Function()? onTap;
final bool subjectPageView; final bool subjectPageView;
final bool swapRoom;
final bool currentLessonIndicator;
final EdgeInsetsGeometry? padding;
final EdgeInsetsGeometry? contentPadding;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -128,7 +138,7 @@ class LessonTile extends StatelessWidget {
// } // }
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 4.0, top: 7.0), padding: padding ?? const EdgeInsets.only(bottom: 4.0, top: 7.0),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
@ -149,7 +159,8 @@ class LessonTile extends StatelessWidget {
onTap: onTap, onTap: onTap,
// onLongPress: kDebugMode ? () => log(jsonEncode(lesson.json)) : null, // onLongPress: kDebugMode ? () => log(jsonEncode(lesson.json)) : null,
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
contentPadding: const EdgeInsets.symmetric(horizontal: 4.0), contentPadding: contentPadding ??
const EdgeInsets.symmetric(horizontal: 4.0),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)), borderRadius: BorderRadius.circular(12.0)),
title: !subjectPageView title: !subjectPageView
@ -222,7 +233,37 @@ class LessonTile extends StatelessWidget {
// const SizedBox( // const SizedBox(
// height: 10.0, // height: 10.0,
// ), // ),
if (cleanDesc != '') if (swapRoom)
Container(
width: lesson.room.length > 20 ? 111 : null,
padding: const EdgeInsets.symmetric(
horizontal: 5.5, vertical: 3.0),
decoration: BoxDecoration(
color: fill
? accent.withOpacity(.15)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
lesson.room,
overflow: TextOverflow.ellipsis,
style: TextStyle(
height: 1.1,
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: fill
? accent.withOpacity(0.9)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
),
),
if (cleanDesc != '' && !swapRoom)
Text( Text(
cleanDesc, cleanDesc,
maxLines: 1, maxLines: 1,
@ -288,33 +329,35 @@ class LessonTile extends StatelessWidget {
// ), // ),
// Current lesson indicator // Current lesson indicator
Transform.translate( if (currentLessonIndicator)
offset: const Offset(-22.0, -1.0), Transform.translate(
child: Container( offset: const Offset(-22.0, -1.0),
decoration: BoxDecoration( child: Container(
color: fillLeading decoration: BoxDecoration(
? Theme.of(context) color: fillLeading
.colorScheme ? Theme.of(context)
.secondary
.withOpacity(.3)
: const Color(0x00000000),
borderRadius: BorderRadius.circular(12.0),
boxShadow: [
if (fillLeading)
BoxShadow(
color: Theme.of(context)
.colorScheme .colorScheme
.secondary .secondary
.withOpacity(.25), .withOpacity(.3)
blurRadius: 6.0, : const Color(0x00000000),
) borderRadius: BorderRadius.circular(12.0),
], boxShadow: [
if (fillLeading)
BoxShadow(
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.25),
blurRadius: 6.0,
)
],
),
margin:
const EdgeInsets.symmetric(vertical: 4.0),
width: 4.0,
height: double.infinity,
), ),
margin: const EdgeInsets.symmetric(vertical: 4.0), )
width: 4.0,
height: double.infinity,
),
)
], ],
), ),
), ),
@ -342,35 +385,36 @@ class LessonTile extends StatelessWidget {
// ), // ),
// ), // ),
// ), // ),
Container( if (!swapRoom)
width: lesson.room.length > 20 ? 111 : null, Container(
padding: const EdgeInsets.symmetric( width: lesson.room.length > 20 ? 111 : null,
horizontal: 6.0, vertical: 3.5), padding: const EdgeInsets.symmetric(
decoration: BoxDecoration( horizontal: 6.0, vertical: 3.5),
color: fill decoration: BoxDecoration(
? accent.withOpacity(.15)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
lesson.room,
overflow: TextOverflow.ellipsis,
style: TextStyle(
height: 1.1,
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: fill color: fill
? accent.withOpacity(0.9) ? accent.withOpacity(.15)
: Theme.of(context) : Theme.of(context)
.colorScheme .colorScheme
.secondary .secondary
.withOpacity(.9), .withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
lesson.room,
overflow: TextOverflow.ellipsis,
style: TextStyle(
height: 1.1,
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: fill
? accent.withOpacity(0.9)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
), ),
), ),
),
if (!subjectPageView) if (!subjectPageView)
const SizedBox( const SizedBox(
width: 10, width: 10,

View File

@ -61,7 +61,7 @@ class _FilterBarState extends State<FilterBar> {
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
indicatorPadding: const EdgeInsets.symmetric(vertical: 8.0), indicatorPadding: const EdgeInsets.symmetric(vertical: 8.0),
indicator: BoxDecoration( indicator: BoxDecoration(
color: Theme.of(context).colorScheme.secondary.withOpacity(.2), color: Theme.of(context).colorScheme.tertiary.withOpacity(.2),
borderRadius: BorderRadius.circular(45.0), borderRadius: BorderRadius.circular(45.0),
), ),
overlayColor: MaterialStateProperty.all(const Color(0x00000000)), overlayColor: MaterialStateProperty.all(const Color(0x00000000)),

View File

@ -58,7 +58,7 @@ class ProfileButton extends StatelessWidget {
return ProfileImage( return ProfileImage(
backgroundColor: !pMode backgroundColor: !pMode
? child.backgroundColor ? child.backgroundColor
: Theme.of(context).colorScheme.secondary, : Theme.of(context).colorScheme.tertiary,
heroTag: child.heroTag, heroTag: child.heroTag,
key: child.key, key: child.key,
name: !pMode ? child.name : "János", name: !pMode ? child.name : "János",

View File

@ -89,7 +89,7 @@ class _ProfileImageState extends State<ProfileImage> {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: const CircleBorder(), shape: const CircleBorder(),
color: widget.name != null && widget.name! == 'Rendszerüzenet' color: widget.name != null && widget.name! == 'Rendszerüzenet'
? widget.backgroundColor?.withOpacity(0.5) ?? ? widget.backgroundColor?.withOpacity(0.8) ??
AppColors.of(context).text.withOpacity(0.5) AppColors.of(context).text.withOpacity(0.5)
: widget.backgroundColor ?? : widget.backgroundColor ??
AppColors.of(context).text.withOpacity(.15), AppColors.of(context).text.withOpacity(.15),

View File

@ -165,7 +165,7 @@ class AbsencesPageState extends State<AbsencesPage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //ColorUtils.stringToColor(user.displayName ?? "?"), .tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -147,8 +147,8 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
), ),
)); ));
tiles.addAll( if (!gradeCalcMode) {
[ tiles.addAll([
const SizedBox( const SizedBox(
height: 5.0, height: 5.0,
), ),
@ -162,8 +162,8 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
controller: _tabController, controller: _tabController,
disableFading: true, disableFading: true,
), ),
], ]);
); }
if (showGraph(subjectGrades) && _tabController.index == 0) { if (showGraph(subjectGrades) && _tabController.index == 0) {
tiles.add(gradeGraph); tiles.add(gradeGraph);
@ -380,13 +380,31 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
.where((e) => e.type == GradeType.midYear) .where((e) => e.type == GradeType.midYear)
.isNotEmpty, .isNotEmpty,
child: ExpandableFab( child: ExpandableFab(
openButtonBuilder: FloatingActionButtonBuilder(
size: 20.0,
builder: (context, onPressed, progress) =>
FloatingActionButton.small(
onPressed: onPressed,
backgroundColor: Theme.of(context).colorScheme.tertiary,
child: const Icon(Icons.more_horiz_outlined),
),
),
closeButtonBuilder: FloatingActionButtonBuilder(
size: 20.0,
builder: (context, onPressed, progress) =>
FloatingActionButton.small(
onPressed: onPressed,
backgroundColor: Theme.of(context).colorScheme.tertiary,
child: const Icon(Icons.close),
),
),
type: ExpandableFabType.up, type: ExpandableFabType.up,
distance: 50, distance: 50,
childrenOffset: const Offset(-3.8, 0.0), // childrenOffset: const Offset(-8.8, 0.0),
children: [ children: [
FloatingActionButton.small( FloatingActionButton.small(
heroTag: "btn_ghost_grades", heroTag: "btn_ghost_grades",
backgroundColor: Theme.of(context).colorScheme.secondary, backgroundColor: Theme.of(context).colorScheme.tertiary,
onPressed: () { onPressed: () {
gradeCalc(context); gradeCalc(context);
}, },
@ -394,7 +412,7 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
), ),
FloatingActionButton.small( FloatingActionButton.small(
heroTag: "btn_goal_planner", heroTag: "btn_goal_planner",
backgroundColor: Theme.of(context).colorScheme.secondary, backgroundColor: Theme.of(context).colorScheme.tertiary,
onPressed: () { onPressed: () {
// if (!Provider.of<PlusProvider>(context, listen: false) // if (!Provider.of<PlusProvider>(context, listen: false)
// .hasScope(PremiumScopes.goalPlanner)) { // .hasScope(PremiumScopes.goalPlanner)) {
@ -533,6 +551,10 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
elevation: 12.0, elevation: 12.0,
); );
// set tab
int tabIndex = _tabController.index;
_tabController.animateTo(0);
// Hide the fab and grades // Hide the fab and grades
setState(() { setState(() {
gradeCalcMode = true; gradeCalcMode = true;
@ -541,6 +563,9 @@ class _GradeSubjectViewState extends State<GradeSubjectView>
_sheetController!.closed.then((value) { _sheetController!.closed.then((value) {
// Show fab and grades // Show fab and grades
if (mounted) { if (mounted) {
// set tab
_tabController.animateTo(tabIndex);
setState(() { setState(() {
gradeCalcMode = false; gradeCalcMode = false;
}); });

View File

@ -546,7 +546,7 @@ class GradesPageState extends State<GradesPage> {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //ColorUtils.stringToColor(user.displayName ?? "?"), .tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -212,6 +212,10 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
// currentState = LiveCardState.empty; // currentState = LiveCardState.empty;
// } // }
// TODO: REMOVE IN PRODUCTION BUILD!!!
print(_liveCard.currentState);
_liveCard.currentState = LiveCardState.morning;
return Scaffold( return Scaffold(
body: Stack( body: Stack(
children: [ children: [
@ -307,7 +311,7 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //!settings.presentationMode .tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?") //? ColorUtils.stringToColor(user.displayName ?? "?")
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
badge: updateProvider.available, badge: updateProvider.available,
@ -321,8 +325,11 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
// expandedHeight: _liveCardAnimation.value * 238.0, // expandedHeight: _liveCardAnimation.value * 238.0,
expandedHeight: _liveCardAnimation.value * expandedHeight: _liveCardAnimation.value *
(_liveCard.currentState == LiveCardState.morning (_liveCard.currentState == LiveCardState.morning
? 280.0 ? 274.0
: 238.0), : (_liveCard.currentState ==
LiveCardState.duringLesson
? 288.0
: 238.0)),
// Live Card // Live Card
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
@ -330,12 +337,17 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 24.0, left: 24.0,
right: 24.0, right: 24.0,
top: (_liveCard.currentState == top: ((_liveCard.currentState ==
LiveCardState.morning LiveCardState.morning ||
_liveCard.currentState ==
LiveCardState.duringLesson)
? 0.0 ? 0.0
: 62.0) + : 62.0) +
MediaQuery.of(context).padding.top, MediaQuery.of(context).padding.top,
bottom: 52.0, bottom: _liveCard.currentState ==
LiveCardState.morning
? 44.0
: 52.0,
), ),
child: Transform.scale( child: Transform.scale(
scale: _liveCardAnimation.value, scale: _liveCardAnimation.value,

View File

@ -1,8 +1,17 @@
// ignore_for_file: unnecessary_null_comparison
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/helpers/subject.dart'; import 'package:refilc/helpers/subject.dart';
import 'package:refilc/icons/filc_icons.dart'; import 'package:refilc/icons/filc_icons.dart';
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc/ui/widgets/lesson/lesson_tile.dart';
import 'package:refilc_kreta_api/models/category.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_kreta_api/models/subject.dart';
import 'package:refilc_kreta_api/models/teacher.dart';
import 'package:refilc_mobile_ui/common/progress_bar.dart';
// import 'package:refilc_kreta_api/models/category.dart'; // import 'package:refilc_kreta_api/models/category.dart';
// import 'package:refilc_kreta_api/models/lesson.dart'; // import 'package:refilc_kreta_api/models/lesson.dart';
// import 'package:refilc_kreta_api/models/subject.dart'; // import 'package:refilc_kreta_api/models/subject.dart';
@ -60,28 +69,31 @@ class LiveCardStateA extends State<LiveCard> {
Duration bellDelay = liveCard.delay; Duration bellDelay = liveCard.delay;
// test // test
// liveCard.currentState = LiveCardState.morning; // TODO: REMOVE IN PRODUCTION BUILD!!!
// liveCard.nextLesson = Lesson( liveCard.currentState = LiveCardState.morning;
// date: DateTime.now().add(Duration( liveCard.nextLesson = Lesson(
// minutes: 30, date: DateTime.now().add(Duration(
// )), minutes: 30,
// subject: GradeSubject( )),
// category: Category(id: 'asd'), id: 'asd', name: 'Matematika'), subject: GradeSubject(
// lessonIndex: 'lessonIndex', category: Category(id: 'asd'), id: 'asd', name: 'Matematika'),
// teacher: Teacher(id: 'id', name: 'name'), lessonIndex: '1',
// start: DateTime.now().add(Duration( teacher: Teacher(id: 'id', name: 'name'),
// minutes: 30, start: DateTime.now().subtract(Duration(
// )), minutes: 30,
// end: DateTime.now().add(Duration( )),
// minutes: 30 + 45, end: DateTime.now().add(Duration(
// )), minutes: 15,
// homeworkId: 'homeworkId', )),
// id: 'id', homeworkId: 'homeworkId',
// description: 'description', id: 'id',
// room: 'ABC69', description: 'description',
// groupName: 'groupName', room: 'ABC69',
// name: 'name', groupName: 'groupName',
// ); name: 'name',
);
// liveCard.nextLesson = liveCard.currentLesson;
// final dt = DateTime(2024, 3, 22, 17, 12, 1, 1, 1); // final dt = DateTime(2024, 3, 22, 17, 12, 1, 1, 1);
@ -323,41 +335,234 @@ class LiveCardStateA extends State<LiveCard> {
final showMinutes = maxTime - elapsedTime > 60; final showMinutes = maxTime - elapsedTime > 60;
// child = LiveCardWidget(
// key: const Key('livecard.duringLesson'),
// liveCardState: liveCard.currentState,
// leading: liveCard.currentLesson!.lessonIndex +
// (RegExp(r'\d').hasMatch(liveCard.currentLesson!.lessonIndex)
// ? "."
// : ""),
// title: liveCard.currentLesson!.subject.renamedTo ??
// liveCard.currentLesson!.subject.name.capital(),
// titleItalic: liveCard.currentLesson!.subject.isRenamed &&
// settingsProvider.renamedSubjectsEnabled &&
// settingsProvider.renamedSubjectsItalics,
// subtitle: liveCard.currentLesson!.room,
// icon: SubjectIcon.resolveVariant(
// subject: liveCard.currentLesson!.subject, context: context),
// description: liveCard.currentLesson!.description != ""
// ? Text(liveCard.currentLesson!.description)
// : null,
// nextSubject: liveCard.nextLesson?.subject.renamedTo ??
// liveCard.nextLesson?.subject.name.capital(),
// nextSubjectItalic: liveCard.nextLesson?.subject.isRenamed == true &&
// settingsProvider.renamedSubjectsEnabled &&
// settingsProvider.renamedSubjectsItalics,
// nextRoom: liveCard.nextLesson?.room,
// progressMax: showMinutes ? maxTime / 60 : maxTime,
// progressCurrent: showMinutes ? elapsedTime / 60 : elapsedTime,
// progressAccuracy:
// showMinutes ? ProgressAccuracy.minutes : ProgressAccuracy.seconds,
// onProgressTap: () {
// showDialog(
// barrierColor: Colors.black,
// context: context,
// builder: (context) =>
// HeadsUpCountdown(maxTime: maxTime, elapsedTime: elapsedTime),
// );
// },
// );
// var titleItalic = liveCard.currentLesson!.subject.isRenamed &&
// settingsProvider.renamedSubjectsEnabled &&
// settingsProvider.renamedSubjectsItalics;
var nextSubject = liveCard.nextLesson?.subject.renamedTo ??
liveCard.nextLesson?.subject.name.capital();
var nextSubjectItalic =
liveCard.nextLesson?.subject.isRenamed == true &&
settingsProvider.renamedSubjectsEnabled &&
settingsProvider.renamedSubjectsItalics;
var progressMax = showMinutes ? maxTime / 60 : maxTime;
var progressCurrent = showMinutes ? elapsedTime / 60 : elapsedTime;
var progressAccuracy =
showMinutes ? ProgressAccuracy.minutes : ProgressAccuracy.seconds;
child = LiveCardWidget( child = LiveCardWidget(
key: const Key('livecard.duringLesson'), key: const Key('livecard.duringLesson'),
leading: liveCard.currentLesson!.lessonIndex + children: liveCard.currentLesson != null
(RegExp(r'\d').hasMatch(liveCard.currentLesson!.lessonIndex) ? [
? "." SplittedPanel(
: ""), hasShadow: false,
title: liveCard.currentLesson!.subject.renamedTo ?? padding: EdgeInsets.zero,
liveCard.currentLesson!.subject.name.capital(), cardPadding: EdgeInsets.zero,
titleItalic: liveCard.currentLesson!.subject.isRenamed && spacing: 8.0,
settingsProvider.renamedSubjectsEnabled && children: [
settingsProvider.renamedSubjectsItalics, SplittedPanel(
subtitle: liveCard.currentLesson!.room, hasShadow: false,
icon: SubjectIcon.resolveVariant( isTransparent: true,
subject: liveCard.currentLesson!.subject, context: context), padding: EdgeInsets.zero,
description: liveCard.currentLesson!.description != "" cardPadding: const EdgeInsets.symmetric(
? Text(liveCard.currentLesson!.description) horizontal: 12.0,
vertical: 0.0,
),
spacing: 0.0,
children: [
LessonTile(
liveCard.currentLesson!,
swapRoom: true,
currentLessonIndicator: false,
padding:
const EdgeInsets.only(top: 8.0, bottom: 4.0),
contentPadding: EdgeInsets.zero,
),
if (!(nextSubject == null &&
progressCurrent == null &&
progressMax == null))
Row(
children: [
const SizedBox(
width: 5.0,
),
if (progressCurrent != null &&
progressMax != null)
GestureDetector(
onTap: () {
showDialog(
barrierColor: Colors.black,
context: context,
builder: (context) => HeadsUpCountdown(
maxTime: maxTime,
elapsedTime: elapsedTime),
);
},
child: Container(
color: Colors.transparent,
child: Text(
"remaining ${progressAccuracy == ProgressAccuracy.minutes ? 'min' : 'sec'}"
.plural(
(progressMax - progressCurrent)
.round()),
maxLines: 1,
style: TextStyle(
fontWeight: FontWeight.w500,
color: AppColors.of(context)
.text
.withOpacity(.75),
height: 1.1,
),
),
),
)
],
),
if (progressCurrent != null && progressMax != null)
Padding(
padding:
const EdgeInsets.only(top: 4.0, bottom: 12.0),
child: ProgressBar(
value: progressCurrent / progressMax),
)
],
),
SplittedPanel(
hasShadow: false,
isTransparent: true,
padding: EdgeInsets.zero,
cardPadding: const EdgeInsets.symmetric(
horizontal: 18.0,
vertical: 11.0,
),
spacing: 0.0,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
liveCard.nextLesson == null
? Icons.home_outlined
: SubjectIcon.resolveVariant(
context: context,
subject:
liveCard.nextLesson!.subject,
),
size: 23.0,
),
const SizedBox(width: 12.0),
Text(
(liveCard.nextLesson?.subject
.isRenamed ??
false
? liveCard
.nextLesson?.subject.renamedTo
: liveCard
.nextLesson?.subject.name) ??
'go_home'.i18n,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w600,
fontStyle: nextSubjectItalic
? FontStyle.italic
: null,
),
),
],
),
Row(
children: liveCard.nextLesson != null
? [
Container(
width: (liveCard.nextLesson?.room
.length ??
0) >
20
? 111
: null,
padding: const EdgeInsets.symmetric(
horizontal: 5.5, vertical: 3.0),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius:
BorderRadius.circular(10.0),
),
child: Text(
liveCard.nextLesson!.room,
overflow: TextOverflow.ellipsis,
style: TextStyle(
height: 1.1,
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
),
),
const SizedBox(
width: 10,
),
Text(
'${DateFormat('H:mm').format(liveCard.nextLesson!.start)}-${DateFormat('H:mm').format(liveCard.nextLesson!.end)}',
style: const TextStyle(
fontSize: 12.5,
fontWeight: FontWeight.w500,
),
),
]
: [],
),
],
),
],
),
],
),
]
: null, : null,
nextSubject: liveCard.nextLesson?.subject.renamedTo ??
liveCard.nextLesson?.subject.name.capital(),
nextSubjectItalic: liveCard.nextLesson?.subject.isRenamed == true &&
settingsProvider.renamedSubjectsEnabled &&
settingsProvider.renamedSubjectsItalics,
nextRoom: liveCard.nextLesson?.room,
progressMax: showMinutes ? maxTime / 60 : maxTime,
progressCurrent: showMinutes ? elapsedTime / 60 : elapsedTime,
progressAccuracy:
showMinutes ? ProgressAccuracy.minutes : ProgressAccuracy.seconds,
onProgressTap: () {
showDialog(
barrierColor: Colors.black,
context: context,
builder: (context) =>
HeadsUpCountdown(maxTime: maxTime, elapsedTime: elapsedTime),
);
},
); );
break; break;
case LiveCardState.duringBreak: case LiveCardState.duringBreak:

View File

@ -23,6 +23,7 @@ extension Localization on String {
"s": "sec(s)", "s": "sec(s)",
// v5 // v5
"first_lesson_soon": "Your first lesson starts soon!", "first_lesson_soon": "Your first lesson starts soon!",
"go_home": "You've no more lessons today",
}, },
"hu_hu": { "hu_hu": {
"next": "Következő", "next": "Következő",
@ -44,6 +45,7 @@ extension Localization on String {
"s": "másodperc", "s": "másodperc",
// v5 // v5
"first_lesson_soon": "Hamarosan kezdődik az első órád!", "first_lesson_soon": "Hamarosan kezdődik az első órád!",
"go_home": "Ma már nincs több órád",
}, },
"de_de": { "de_de": {
"next": "Nächste", "next": "Nächste",
@ -65,6 +67,7 @@ extension Localization on String {
"s": "Sekunde", "s": "Sekunde",
// v5 // v5
"first_lesson_soon": "Ihre erste Unterrichtsstunde beginnt bald!", "first_lesson_soon": "Ihre erste Unterrichtsstunde beginnt bald!",
"go_home": "Sie haben heute keinen Unterricht mehr",
}, },
}; };

View File

@ -1,9 +1,11 @@
import 'package:refilc/api/providers/live_card_provider.dart';
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc_mobile_ui/common/progress_bar.dart'; import 'package:refilc_mobile_ui/common/progress_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:refilc_mobile_ui/pages/home/live_card/live_card.dart';
import 'live_card.i18n.dart'; import 'live_card.i18n.dart';
enum ProgressAccuracy { minutes, seconds } enum ProgressAccuracy { minutes, seconds }

View File

@ -105,7 +105,7 @@ class MessagesPageState extends State<MessagesPage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //ColorUtils.stringToColor(user.displayName ?? "?"), .tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -251,7 +251,7 @@ class NotesPageState extends State<NotesPage> with TickerProviderStateMixin {
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //ColorUtils.stringToColor(user.displayName ?? "?"), .tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -283,7 +283,7 @@ class TimetablePageState extends State<TimetablePage>
name: firstName, name: firstName,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //ColorUtils.stringToColor(user.displayName ?? "?"), .tertiary, //ColorUtils.stringToColor(user.displayName ?? "?"),
badge: updateProvider.available, badge: updateProvider.available,
role: user.role, role: user.role,
profilePictureString: user.picture, profilePictureString: user.picture,

View File

@ -18,6 +18,7 @@ class PlusPlanCard extends StatelessWidget {
this.active = false, this.active = false,
this.borderRadius, this.borderRadius,
this.features = const [], this.features = const [],
required this.docsAccepted,
}); });
final String iconPath; final String iconPath;
@ -30,11 +31,25 @@ class PlusPlanCard extends StatelessWidget {
final bool active; final bool active;
final BorderRadiusGeometry? borderRadius; final BorderRadiusGeometry? borderRadius;
final List<List<String>> features; final List<List<String>> features;
final bool docsAccepted;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (!docsAccepted) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text(
"El kell fogadnod az ÁSZF-et és az Adatkezelési Tájékoztatót!",
style:
TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
),
backgroundColor: Colors.white,
));
return;
}
if (Provider.of<PlusProvider>(context, listen: false).hasPremium) { if (Provider.of<PlusProvider>(context, listen: false).hasPremium) {
if (!active) { if (!active) {
launchUrl( launchUrl(

View File

@ -25,6 +25,7 @@ class PlusScreenState extends State<PlusScreen> {
} }
bool showLifetime = false; bool showLifetime = false;
bool docsAccepted = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -226,6 +227,7 @@ class PlusScreenState extends State<PlusScreen> {
['👑', 'rfp_15'.i18n], ['👑', 'rfp_15'.i18n],
['🔜', 'more_soon'.i18n], ['🔜', 'more_soon'.i18n],
], ],
docsAccepted: docsAccepted,
), ),
const SizedBox( const SizedBox(
height: 12.0, height: 12.0,
@ -259,6 +261,7 @@ class PlusScreenState extends State<PlusScreen> {
const ['🖋️', 'cap_tier_benefits'], const ['🖋️', 'cap_tier_benefits'],
['🔜', 'more_soon'.i18n], ['🔜', 'more_soon'.i18n],
], ],
docsAccepted: docsAccepted,
), ),
// const SizedBox( // const SizedBox(
// height: 8.0, // height: 8.0,
@ -373,6 +376,50 @@ class PlusScreenState extends State<PlusScreen> {
), ),
), ),
), ),
// aszf warning
const SizedBox(
height: 18.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0),
border: Border.all(
color: Colors.black.withOpacity(0.2),
),
),
child: CheckboxListTile(
contentPadding:
const EdgeInsets.only(left: 15.0, right: 10.0),
value: docsAccepted,
onChanged: (value) {
setState(() {
docsAccepted = !docsAccepted;
});
},
// title: Text(
// 'show_lifetime'.i18n,
// style: const TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.w500,
// ),
// ),
subtitle: const Text(
'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.start,
style: TextStyle(color: Colors.black),
),
),
),
// CheckboxListTile(value: false, onChanged: onChanged)
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 12.0),
// child: Text(
// '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)),
// ),
// ),
// faq section // faq section
const SizedBox( const SizedBox(
height: 30.0, height: 30.0,

View File

@ -34,7 +34,7 @@ class NavbarItem extends StatelessWidget {
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: active color: active
? Theme.of(context).colorScheme.secondary.withOpacity(.2) ? Theme.of(context).colorScheme.tertiary.withOpacity(.2)
: null, : null,
borderRadius: BorderRadius.circular(14.0), borderRadius: BorderRadius.circular(14.0),
), ),

View File

@ -30,7 +30,7 @@ class AccountView extends StatelessWidget {
AccountTile( AccountTile(
profileImage: ProfileImage( profileImage: ProfileImage(
name: _firstName, name: _firstName,
backgroundColor: Theme.of(context).colorScheme.secondary, backgroundColor: Theme.of(context).colorScheme.tertiary,
role: user.role, role: user.role,
), ),
name: SelectableText( name: SelectableText(

View File

@ -136,7 +136,7 @@ class SettingsScreenState extends State<SettingsScreen>
profilePictureString: account.picture, profilePictureString: account.picture,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //!settings.presentationMode .tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(account.name) //? ColorUtils.stringToColor(account.name)
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
), ),
@ -322,7 +322,7 @@ class SettingsScreenState extends State<SettingsScreen>
profilePictureString: user.picture, profilePictureString: user.picture,
backgroundColor: Theme.of(context) backgroundColor: Theme.of(context)
.colorScheme .colorScheme
.secondary, //!settings.presentationMode .tertiary, //!settings.presentationMode
//? ColorUtils.stringToColor(user.displayName ?? "?") //? ColorUtils.stringToColor(user.displayName ?? "?")
//: Theme.of(context).colorScheme.secondary, //: Theme.of(context).colorScheme.secondary,
), ),