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