From fb1a274bc9b16650d6a85761ad236b90cdbfd41a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 2 Jun 2020 19:03:52 +0530 Subject: Adds timer stream to home page --- lib/main.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/main.dart') diff --git a/lib/main.dart b/lib/main.dart index 9397dc9..64db33a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'package:flutter/material.dart'; import 'pages/Home.dart'; @@ -8,17 +9,24 @@ void main() { } class MyApp extends StatelessWidget { + final Stream time$ = Stream.periodic(Duration(seconds: 1), (_x) => DateTime.now()).asBroadcastStream(); + + @override + void dispose() { + time$.drain(); + } + // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', + title: 'owyn launcher', home: Scaffold( body: PageView( - controller: PageViewController(), + controller: PageController(), children: [ - HomeView(), - AppView(), + HomeView(time$: time$), + AppsView(), ], ), ), -- cgit v1.3.1