Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
onTime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
onTime InnoLab
onTime
Commits
ddf6b856
Commit
ddf6b856
authored
1 year ago
by
doodlezucc
Browse files
Options
Downloads
Patches
Plain Diff
move view to app context
parent
2be33a66
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/context.dart
+6
-0
6 additions, 0 deletions
lib/context.dart
lib/main.dart
+1
-8
1 addition, 8 deletions
lib/main.dart
with
7 additions
and
8 deletions
lib/context.dart
+
6
−
0
View file @
ddf6b856
...
@@ -4,12 +4,17 @@ import 'untis/lecture.dart';
...
@@ -4,12 +4,17 @@ import 'untis/lecture.dart';
import
'user/profile.dart'
;
import
'user/profile.dart'
;
import
'user/save_state.dart'
;
import
'user/save_state.dart'
;
import
'util/listenable.dart'
;
import
'util/listenable.dart'
;
import
'views/mixed_class_view.dart'
;
import
'views/view.dart'
;
class
AppContext
{
class
AppContext
{
final
UntisFetch
untis
;
final
UntisFetch
untis
;
final
SaveManager
_saveManager
;
final
SaveManager
_saveManager
;
final
Listenable
<
Profile
?
>
profile
=
Listenable
(
null
);
final
Listenable
<
Profile
?
>
profile
=
Listenable
(
null
);
final
Listenable
<
DateTime
>
date
=
Listenable
(
DateTime
.
now
());
final
Listenable
<
DateTime
>
date
=
Listenable
(
DateTime
.
now
());
final
Listenable
<
TimetableView
>
view
=
Listenable
(
MixedClassView
(
classIds:
{}),
);
List
<
Class
>
?
classes
;
List
<
Class
>
?
classes
;
List
<
Lecture
>
?
lectures
;
List
<
Lecture
>
?
lectures
;
...
@@ -24,5 +29,6 @@ class AppContext {
...
@@ -24,5 +29,6 @@ class AppContext {
profile
.
value
!
profile
.
value
!
.
.
hiddenLectures
.
onChange
.
listen
((
_
)
=
>
save
())
.
.
hiddenLectures
.
onChange
.
listen
((
_
)
=
>
save
())
.
.
selectedClasses
.
onChange
.
listen
((
_
)
=
>
save
());
.
.
selectedClasses
.
onChange
.
listen
((
_
)
=
>
save
());
view
.
value
=
MixedClassView
(
classIds:
profile
.
value
!.
selectedClasses
);
}
}
}
}
This diff is collapsed.
Click to expand it.
lib/main.dart
+
1
−
8
View file @
ddf6b856
...
@@ -13,8 +13,6 @@ import 'untis/fetch.dart';
...
@@ -13,8 +13,6 @@ import 'untis/fetch.dart';
import
'untis/timetable.dart'
;
import
'untis/timetable.dart'
;
import
'user/save_state.dart'
;
import
'user/save_state.dart'
;
import
'util/listenable.dart'
;
import
'util/listenable.dart'
;
import
'views/mixed_class_view.dart'
;
import
'views/view.dart'
;
void
main
()
{
void
main
()
{
runApp
(
const
MyApp
());
runApp
(
const
MyApp
());
...
@@ -58,7 +56,6 @@ class MyHomePage extends StatefulWidget {
...
@@ -58,7 +56,6 @@ class MyHomePage extends StatefulWidget {
}
}
class
_MyHomePageState
extends
State
<
MyHomePage
>
{
class
_MyHomePageState
extends
State
<
MyHomePage
>
{
late
TimetableView
view
;
late
List
<
StreamSubscription
>
_subscriptions
;
late
List
<
StreamSubscription
>
_subscriptions
;
TimetableData
?
timetable
;
TimetableData
?
timetable
;
...
@@ -108,11 +105,7 @@ class _MyHomePageState extends State<MyHomePage> {
...
@@ -108,11 +105,7 @@ class _MyHomePageState extends State<MyHomePage> {
Future
<
void
>
fetchTimetable
()
async
{
Future
<
void
>
fetchTimetable
()
async
{
final
date
=
appContext
.
date
.
value
;
final
date
=
appContext
.
date
.
value
;
final
view
=
appContext
.
view
.
value
;
final
profile
=
await
appContext
.
profile
.
firstNotNull
;
final
selectedClasses
=
profile
.
selectedClasses
;
view
=
MixedClassView
(
classIds:
selectedClasses
);
final
fetchedTimetable
=
await
view
.
timetableOf
(
date
,
untis:
untis
);
final
fetchedTimetable
=
await
view
.
timetableOf
(
date
,
untis:
untis
);
setState
(()
{
setState
(()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment