@@ -11,9 +11,11 @@ import 'package:loggy/loggy.dart';
1111import 'package:path_provider/path_provider.dart' ;
1212import 'package:permission_handler/permission_handler.dart' ;
1313import 'package:sizer/sizer.dart' ;
14+ import 'package:taskwarrior/config/app_settings.dart' ;
1415import 'package:taskwarrior/controller/WidgetController.dart' ;
1516import 'package:taskwarrior/controller/onboarding_controller.dart' ;
1617import 'package:taskwarrior/routes/pageroute.dart' ;
18+ import 'package:taskwarrior/services/task_details.dart' ;
1719import 'package:taskwarrior/views/Onboarding/onboarding_screen.dart' ;
1820import 'package:taskwarrior/views/profile/profile.dart' ;
1921import 'package:taskwarrior/widgets/app_placeholder.dart' ;
@@ -48,35 +50,19 @@ Future main([List<String> args = const []]) async {
4850 '${testingDirectory .path }/profiles/acae0462-6a34-11e4-8001-002590720087' ,
4951 ).createSync (recursive: true );
5052 }
51- SystemChrome .setPreferredOrientations ([
52- DeviceOrientation .portraitUp,
53- DeviceOrientation .portraitDown
54- ]).then ((value) =>
55- runApp (
56- FutureBuilder <Directory >(
57- future: getApplicationDocumentsDirectory (),
58- builder: (context, snapshot) => (snapshot.hasData)
59- ? ProfilesWidget (
60- baseDirectory: testingDirectory ?? snapshot.data! ,
61- child: const MyApp (),
62- )
63- : const AppSetupPlaceholder (),
64- ),
65- ));
66- HomeWidget .widgetClicked.listen ((uri) async {
67- if (uri != null ) {
68- debugPrint ("i am here and uri is $uri " );
69- String ? uuid = uri.queryParameters["uuid" ];
70- debugPrint ('uuid is $uuid ' );
71- if (uuid!= null ) {
72- // Future.delayed(Duration(seconds: 5)).then((value) => Navigator.push(context, MaterialPageRoute(builder: (context) => DetailRoute(uuid),)));
73- }
74- }
75- if (uri? .host == "cardClicked" ) {
76- final taskUUID = uri! .queryParameters["uuid" ];
77- debugPrint (taskUUID);
78- }
79- });
53+ SystemChrome .setPreferredOrientations (
54+ [DeviceOrientation .portraitUp, DeviceOrientation .portraitDown])
55+ .then ((value) => runApp (
56+ FutureBuilder <Directory >(
57+ future: getApplicationDocumentsDirectory (),
58+ builder: (context, snapshot) => (snapshot.hasData)
59+ ? ProfilesWidget (
60+ baseDirectory: testingDirectory ?? snapshot.data! ,
61+ child: const MyApp (),
62+ )
63+ : const AppSetupPlaceholder (),
64+ ),
65+ ));
8066}
8167
8268Future init () async {
@@ -102,13 +88,33 @@ class _MyAppState extends State<MyApp> {
10288 Directory ? baseDirectory;
10389 List <Task > allData = [];
10490 bool stopTraver = false ;
91+
92+ bool isHomeWidgetTaskTapped = false ;
93+ late String uuid;
10594 @override
10695 void initState () {
10796 super .initState ();
10897
10998 ///sort the data by daily burn down
11099
111100 notificationService.initiliazeNotification ();
101+ helperFunction ();
102+ }
103+
104+ void helperFunction () async {
105+ Uri ? myUri = await HomeWidget .initiallyLaunchedFromHomeWidget ();
106+ if (myUri != null ) {
107+ if (myUri.host == "cardclicked" ) {
108+ if (myUri.queryParameters["uuid" ] != null ) {
109+ uuid = myUri.queryParameters["uuid" ] as String ;
110+ setState (() {
111+ isHomeWidgetTaskTapped = true ;
112+ });
113+ // print('is tapped is $isHomeWidgetTaskTapped');
114+ }
115+ // debugPrint('uuid is $uuid');
116+ }
117+ }
112118 }
113119
114120 @override
@@ -143,7 +149,17 @@ class _MyAppState extends State<MyApp> {
143149 PageRoutes .profile: (context) => const ProfilePage (),
144150 },
145151
146- home: CheckOnboardingStatus (),
152+ home: isHomeWidgetTaskTapped == false
153+ ? CheckOnboardingStatus ()
154+ : FutureBuilder (future: Future .delayed (const Duration (seconds: 2 )), builder: (context, snapshot) {
155+ if (snapshot.connectionState == ConnectionState .waiting) {
156+ return Scaffold (
157+ backgroundColor:
158+ AppSettings .isDarkMode ? Palette .kToDark.shade200 : Colors .white,
159+ body: const Center (child: CircularProgressIndicator ()));
160+ }
161+ return DetailRoute (uuid);
162+ },),
147163 );
148164 }));
149165 }
0 commit comments