diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-04 00:14:06 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-04 00:14:06 +0530 |
| commit | 497646527fd598c9d37b27220ad148c91a1f9225 (patch) | |
| tree | 0369f9995957857afcfd3e52dba523cdc65998ef /lib/main.dart | |
| parent | e8c7759250cf7a7eb1fc0047a4cef27cd75ab15b (diff) | |
| download | daft-launcher-497646527fd598c9d37b27220ad148c91a1f9225.tar.gz daft-launcher-497646527fd598c9d37b27220ad148c91a1f9225.zip | |
Refactors datetime to the top
Diffstat (limited to 'lib/main.dart')
| -rw-r--r-- | lib/main.dart | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/main.dart b/lib/main.dart index a223fb7..c41c1ad 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,10 +15,6 @@ void main() { } class MyAppState extends StreamState<MyApp> { - // Streams - final Stream<DateTime> time$ = - Stream.periodic(Duration(seconds: 1), (_x) => DateTime.now()).asBroadcastStream(); - // State final config = StreamStateValue<Config>( stream$: getConfig$(), @@ -28,6 +24,10 @@ class MyAppState extends StreamState<MyApp> { stream$: getFavorites$(), value: [], ); + final dateTime = StreamStateValue<DateTime>( + stream$: Stream.periodic(Duration(seconds: 1), (_x) => DateTime.now()).asBroadcastStream(), + value: DateTime.now(), + ); void initState() { super.initState(); initStateValue(config); @@ -36,12 +36,6 @@ class MyAppState extends StreamState<MyApp> { initFavorites(); } - @override - void dispose() { - super.dispose(); - time$.drain(); - } - ThemeData getLightTheme() { return ThemeData(brightness: Brightness.light); } @@ -84,8 +78,7 @@ class MyAppState extends StreamState<MyApp> { controller: PageController(keepPage: true), children: [ HomeView( - time$: time$, - defaultTime: DateTime.now(), + dateTime: dateTime.value, favoriteApps: favoriteApps.value, ), AppsView(), |
