forked from firka/student-legacy
some livecard progress
This commit is contained in:
parent
3f782e762a
commit
51d8ef7707
@ -3,6 +3,8 @@ 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_mobile_ui/common/round_border_icon.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
|
||||||
import 'package:refilc_mobile_ui/pages/home/live_card/heads_up_countdown.dart';
|
import 'package:refilc_mobile_ui/pages/home/live_card/heads_up_countdown.dart';
|
||||||
import 'package:refilc_mobile_ui/screens/summary/summary_screen.dart';
|
import 'package:refilc_mobile_ui/screens/summary/summary_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -54,7 +56,7 @@ class LiveCardStateA extends State<LiveCard> {
|
|||||||
Duration bellDelay = liveCard.delay;
|
Duration bellDelay = liveCard.delay;
|
||||||
|
|
||||||
// test
|
// test
|
||||||
// liveCard.currentState = LiveCardState.morning;
|
liveCard.currentState = LiveCardState.morning;
|
||||||
|
|
||||||
switch (liveCard.currentState) {
|
switch (liveCard.currentState) {
|
||||||
case LiveCardState.summary:
|
case LiveCardState.summary:
|
||||||
@ -102,60 +104,113 @@ class LiveCardStateA extends State<LiveCard> {
|
|||||||
case LiveCardState.morning:
|
case LiveCardState.morning:
|
||||||
child = LiveCardWidget(
|
child = LiveCardWidget(
|
||||||
key: const Key('livecard.morning'),
|
key: const Key('livecard.morning'),
|
||||||
title: DateFormat("EEEE", I18n.of(context).locale.toString())
|
// title: DateFormat("EEEE", I18n.of(context).locale.toString())
|
||||||
.format(DateTime.now())
|
// .format(DateTime.now())
|
||||||
.capital(),
|
// .capital(),
|
||||||
icon: FeatherIcons.sun,
|
// icon: FeatherIcons.sun,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await MapsLauncher.launchQuery(
|
await MapsLauncher.launchQuery(
|
||||||
'${_userProvider.student?.school.city ?? ''} ${_userProvider.student?.school.name ?? ''}');
|
'${_userProvider.student?.school.city ?? ''} ${_userProvider.student?.school.name ?? ''}');
|
||||||
},
|
},
|
||||||
description: liveCard.nextLesson != null
|
// description: liveCard.nextLesson != null
|
||||||
? Text.rich(
|
// ? Text.rich(
|
||||||
TextSpan(
|
// TextSpan(
|
||||||
|
// children: [
|
||||||
|
// TextSpan(text: "first_lesson_1".i18n),
|
||||||
|
// TextSpan(
|
||||||
|
// text: liveCard.nextLesson!.subject.renamedTo ??
|
||||||
|
// liveCard.nextLesson!.subject.name.capital(),
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w600,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .colorScheme
|
||||||
|
// .secondary
|
||||||
|
// .withOpacity(.85),
|
||||||
|
// fontStyle: liveCard.nextLesson!.subject.isRenamed &&
|
||||||
|
// settingsProvider.renamedSubjectsItalics
|
||||||
|
// ? FontStyle.italic
|
||||||
|
// : null),
|
||||||
|
// ),
|
||||||
|
// TextSpan(text: "first_lesson_2".i18n),
|
||||||
|
// TextSpan(
|
||||||
|
// text: liveCard.nextLesson!.room.capital(),
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w600,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .colorScheme
|
||||||
|
// .secondary
|
||||||
|
// .withOpacity(.85),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// TextSpan(text: "first_lesson_3".i18n),
|
||||||
|
// TextSpan(
|
||||||
|
// text: DateFormat('H:mm')
|
||||||
|
// .format(liveCard.nextLesson!.start),
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w600,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .colorScheme
|
||||||
|
// .secondary
|
||||||
|
// .withOpacity(.85),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// TextSpan(text: "first_lesson_4".i18n),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// : null,
|
||||||
|
children: liveCard.nextLesson == null
|
||||||
|
? [
|
||||||
|
SplittedPanel(
|
||||||
|
hasShadow: false,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
cardPadding: const EdgeInsets.all(18.0),
|
||||||
|
spacing: 8.0,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: "first_lesson_1".i18n),
|
Column(
|
||||||
TextSpan(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
text: liveCard.nextLesson!.subject.renamedTo ??
|
children: [
|
||||||
liveCard.nextLesson!.subject.name.capital(),
|
Text('Hamarosan kezdődik az első órád!'),
|
||||||
style: TextStyle(
|
Text('1 óra 32 perc 26 másodperc'),
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
.withOpacity(.85),
|
|
||||||
fontStyle: liveCard.nextLesson!.subject.isRenamed &&
|
|
||||||
settingsProvider.renamedSubjectsItalics
|
|
||||||
? FontStyle.italic
|
|
||||||
: null),
|
|
||||||
),
|
|
||||||
TextSpan(text: "first_lesson_2".i18n),
|
|
||||||
TextSpan(
|
|
||||||
text: liveCard.nextLesson!.room.capital(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
.withOpacity(.85),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(text: "first_lesson_3".i18n),
|
|
||||||
TextSpan(
|
|
||||||
text: DateFormat('H:mm')
|
|
||||||
.format(liveCard.nextLesson!.start),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.secondary
|
|
||||||
.withOpacity(.85),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(text: "first_lesson_4".i18n),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
SubjectIcon.resolveVariant(
|
||||||
|
context: context,
|
||||||
|
subjectName: 'matekgeci',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12.0),
|
||||||
|
Text(
|
||||||
|
'matekfasz',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'8:00-8:45',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:i18n_extension/i18n_extension.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';
|
||||||
@ -26,6 +27,7 @@ class LiveCardWidget extends StatefulWidget {
|
|||||||
this.progressAccuracy = ProgressAccuracy.minutes,
|
this.progressAccuracy = ProgressAccuracy.minutes,
|
||||||
this.onProgressTap,
|
this.onProgressTap,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
|
this.children,
|
||||||
});
|
});
|
||||||
|
|
||||||
final bool isEvent;
|
final bool isEvent;
|
||||||
@ -43,6 +45,7 @@ class LiveCardWidget extends StatefulWidget {
|
|||||||
final ProgressAccuracy? progressAccuracy;
|
final ProgressAccuracy? progressAccuracy;
|
||||||
final Function()? onProgressTap;
|
final Function()? onProgressTap;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
|
final List<Widget>? children;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<LiveCardWidget> createState() => _LiveCardWidgetState();
|
State<LiveCardWidget> createState() => _LiveCardWidgetState();
|
||||||
@ -63,11 +66,17 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
curve: Curves.easeInOutBack,
|
curve: Curves.easeInOutBack,
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2.0),
|
margin: widget.children == null
|
||||||
padding: const EdgeInsets.all(12.0),
|
? const EdgeInsets.symmetric(vertical: 2.0)
|
||||||
|
: EdgeInsets.zero,
|
||||||
|
padding: widget.children == null
|
||||||
|
? const EdgeInsets.all(12.0)
|
||||||
|
: EdgeInsets.zero,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// color: Theme.of(context).colorScheme.background,
|
// color: Theme.of(context).colorScheme.background,
|
||||||
color: Colors.transparent,
|
color: widget.children != null
|
||||||
|
? Colors.transparent
|
||||||
|
: Theme.of(context).colorScheme.background,
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
if (Provider.of<SettingsProvider>(context, listen: false)
|
if (Provider.of<SettingsProvider>(context, listen: false)
|
||||||
@ -80,7 +89,9 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
padding: widget.children == null
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 6.0)
|
||||||
|
: EdgeInsets.zero,
|
||||||
child: OverflowBox(
|
child: OverflowBox(
|
||||||
maxHeight: 96.0,
|
maxHeight: 96.0,
|
||||||
child: widget.isEvent
|
child: widget.isEvent
|
||||||
@ -137,6 +148,10 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
: widget.children != null
|
||||||
|
? Column(
|
||||||
|
children: widget.children ?? [],
|
||||||
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
@ -163,7 +178,8 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceAround,
|
MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
@ -179,27 +195,34 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontStyle: widget
|
fontStyle: widget
|
||||||
.titleItalic
|
.titleItalic
|
||||||
? FontStyle.italic
|
? FontStyle
|
||||||
|
.italic
|
||||||
: null)),
|
: null)),
|
||||||
if (widget.subtitle != null)
|
if (widget.subtitle !=
|
||||||
|
null)
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets
|
margin:
|
||||||
|
const EdgeInsets
|
||||||
.only(
|
.only(
|
||||||
left: 6.0,
|
left: 6.0,
|
||||||
bottom: 3.0),
|
bottom:
|
||||||
|
3.0),
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets
|
const EdgeInsets
|
||||||
.symmetric(
|
.symmetric(
|
||||||
horizontal: 4.0,
|
horizontal:
|
||||||
vertical: 2.0),
|
4.0,
|
||||||
|
vertical:
|
||||||
|
2.0),
|
||||||
decoration:
|
decoration:
|
||||||
BoxDecoration(
|
BoxDecoration(
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
context)
|
context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.secondary
|
.secondary
|
||||||
.withOpacity(.3),
|
.withOpacity(
|
||||||
|
.3),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius
|
BorderRadius
|
||||||
.circular(
|
.circular(
|
||||||
@ -211,7 +234,8 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
height: 1.2,
|
height: 1.2,
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w600,
|
FontWeight
|
||||||
|
.w600,
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
context)
|
context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@ -223,18 +247,21 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
fontSize: 22.0),
|
fontSize: 22.0),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow:
|
||||||
|
TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.title != null)
|
if (widget.title != null)
|
||||||
const SizedBox(width: 6.0),
|
const SizedBox(width: 6.0),
|
||||||
if (widget.icon != null)
|
if (widget.icon != null)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
|
const EdgeInsets.symmetric(
|
||||||
vertical: 4.0),
|
vertical: 4.0),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
widget.icon,
|
widget.icon,
|
||||||
@ -263,7 +290,8 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
!(widget.nextSubject == null &&
|
!(widget.nextSubject == null &&
|
||||||
widget.progressCurrent ==
|
widget.progressCurrent ==
|
||||||
null &&
|
null &&
|
||||||
widget.progressMax == null)
|
widget.progressMax ==
|
||||||
|
null)
|
||||||
? 1
|
? 1
|
||||||
: 2,
|
: 2,
|
||||||
softWrap: false,
|
softWrap: false,
|
||||||
@ -296,17 +324,18 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
TextSpan(
|
TextSpan(
|
||||||
text: widget.nextSubject!,
|
text: widget.nextSubject!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontStyle:
|
fontStyle: widget
|
||||||
widget.nextSubjectItalic
|
.nextSubjectItalic
|
||||||
? FontStyle.italic
|
? FontStyle.italic
|
||||||
: null)),
|
: null)),
|
||||||
if (widget.nextRoom != null)
|
if (widget.nextRoom != null)
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(
|
margin:
|
||||||
|
const EdgeInsets.only(
|
||||||
left: 4.0),
|
left: 4.0),
|
||||||
padding:
|
padding: const EdgeInsets
|
||||||
const EdgeInsets.symmetric(
|
.symmetric(
|
||||||
horizontal: 3.0,
|
horizontal: 3.0,
|
||||||
vertical: 1.5),
|
vertical: 1.5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -323,7 +352,8 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
height: 1.1,
|
height: 1.1,
|
||||||
fontSize: 12.0,
|
fontSize: 12.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight:
|
||||||
|
FontWeight.w600,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.secondary
|
.secondary
|
||||||
@ -375,7 +405,8 @@ class _LiveCardWidgetState extends State<LiveCardWidget> {
|
|||||||
if (widget.progressCurrent != null &&
|
if (widget.progressCurrent != null &&
|
||||||
widget.progressMax != null)
|
widget.progressMax != null)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: ProgressBar(
|
child: ProgressBar(
|
||||||
value: widget.progressCurrent! /
|
value: widget.progressCurrent! /
|
||||||
widget.progressMax!),
|
widget.progressMax!),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user