forked from firka/firka
home/*: fix loading spinner
This commit is contained in:
@@ -83,14 +83,15 @@ class _HomeGradesScreen extends State<HomeGradesScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (grades == null || week == null) {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 1.35,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(),
|
||||
DelayedSpinnerWidget(),
|
||||
SizedBox(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [DelayedSpinnerWidget()],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -154,127 +155,128 @@ class _HomeGradesScreen extends State<HomeGradesScreen> {
|
||||
var subjectAvgColor = getGradeColor(subjectAvg);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background, body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0,
|
||||
right: 20.0,
|
||||
top: 12.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20.0,
|
||||
right: 20.0,
|
||||
top: 12.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.data.l10n.subjects,
|
||||
style: appStyle.fonts.H_H2
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
)
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.data.l10n.subjects,
|
||||
style: appStyle.fonts.H_H2
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16), // TODO: Add graphs here
|
||||
// ...gradeCards,
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height -
|
||||
MediaQuery.of(context).padding.top -
|
||||
240,
|
||||
child: ListView(
|
||||
children: [
|
||||
Text(
|
||||
widget.data.l10n.your_subjects,
|
||||
style: appStyle.fonts.H_14px
|
||||
.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
...gradeCards,
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
widget.data.l10n.data,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.subject_avg,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: subjectAvgColor.withAlpha(38),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 8, right: 8, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
subjectAvg.toStringAsFixed(2),
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: subjectAvgColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.subject_avg_rounded,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: subjectAvgColor.withAlpha(38),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 8, right: 8, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
subjectAvgRounded.toStringAsFixed(2),
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: subjectAvgColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
FirkaCard(left: [
|
||||
Text(
|
||||
widget.data.l10n.class_avg,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
]),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.class_n,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Text(
|
||||
week!.response!
|
||||
.where((lesson) =>
|
||||
lesson.type.name != TimetableConsts.event)
|
||||
.length
|
||||
.toString(),
|
||||
style: appStyle.fonts.B_14SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16), // TODO: Add graphs here
|
||||
// ...gradeCards,
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height -
|
||||
MediaQuery.of(context).padding.top -
|
||||
240,
|
||||
child: ListView(
|
||||
children: [
|
||||
Text(
|
||||
widget.data.l10n.your_subjects,
|
||||
style: appStyle.fonts.H_14px
|
||||
.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
...gradeCards,
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
widget.data.l10n.data,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.subject_avg,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: subjectAvgColor.withAlpha(38),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 8, right: 8, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
subjectAvg.toStringAsFixed(2),
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: subjectAvgColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.subject_avg_rounded,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: subjectAvgColor.withAlpha(38),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 8, right: 8, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
subjectAvgRounded.toStringAsFixed(2),
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: subjectAvgColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
FirkaCard(left: [
|
||||
Text(
|
||||
widget.data.l10n.class_avg,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
]),
|
||||
FirkaCard(
|
||||
left: [
|
||||
Text(
|
||||
widget.data.l10n.class_n,
|
||||
style: appStyle.fonts.B_16SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Text(
|
||||
week!.response!
|
||||
.where((lesson) =>
|
||||
lesson.type.name != TimetableConsts.event)
|
||||
.length
|
||||
.toString(),
|
||||
style: appStyle.fonts.B_14SB
|
||||
.apply(color: appStyle.colors.textPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,14 +188,15 @@ class _HomeGradesSubjectScreen extends State<HomeGradesSubjectScreen> {
|
||||
),
|
||||
));
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 1.35,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(),
|
||||
DelayedSpinnerWidget(),
|
||||
SizedBox(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [DelayedSpinnerWidget()],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -13,6 +13,7 @@ import '../../../../helpers/api/model/timetable.dart';
|
||||
import '../../../../helpers/debug_helper.dart';
|
||||
import '../../../../helpers/update_notifier.dart';
|
||||
import '../../../../main.dart';
|
||||
import '../../../model/style.dart';
|
||||
import '../../widgets/home_main_welcome.dart';
|
||||
import '../../widgets/lesson_big.dart';
|
||||
|
||||
@@ -190,7 +191,18 @@ class _HomeMainScreen extends State<HomeMainScreen> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return DelayedSpinnerWidget();
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [DelayedSpinnerWidget()],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,14 +345,15 @@ class _HomeTimetableScreen extends State<HomeTimetableScreen> {
|
||||
)
|
||||
]));
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 1.35,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(),
|
||||
DelayedSpinnerWidget(),
|
||||
SizedBox(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [DelayedSpinnerWidget()],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -535,14 +535,15 @@ class _HomeTimetableMonthlyScreen extends State<HomeTimetableMonthlyScreen> {
|
||||
),
|
||||
]));
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 1.35,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
return Scaffold(
|
||||
backgroundColor: appStyle.colors.background,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(),
|
||||
DelayedSpinnerWidget(),
|
||||
SizedBox(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [DelayedSpinnerWidget()],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user