@@ -24,9 +24,6 @@ import 'package:nfc_plinkd/utils/media/picker.dart';
24
24
class MyApp extends StatefulWidget {
25
25
const MyApp ({super .key});
26
26
27
- // final ConfigTheme? theme;
28
- // final ConfigLanguage? language;
29
-
30
27
@override
31
28
State <StatefulWidget > createState () => MyAppState ();
32
29
}
@@ -93,14 +90,14 @@ class MyAppState extends State<MyApp> {
93
90
Future <void > initDeepLinks () async {
94
91
final appLinks = AppLinks ();
95
92
96
- // appLinks.getInitialLink().then((uri) {
97
- // if (uri == null) return;
98
- // WidgetsBinding.instance.addPostFrameCallback((_) {
99
- // if (navigatorKey.currentContext == null) return;
100
- // openLinkWithUri(navigatorKey.currentContext!, uri)
101
- // .onError((error, _) => null);
102
- // });
103
- // });
93
+ appLinks.getInitialLink ().then ((uri) {
94
+ if (uri == null ) return ;
95
+ WidgetsBinding .instance.addPostFrameCallback ((_) {
96
+ if (navigatorKey.currentContext == null ) return ;
97
+ openLinkWithUri (navigatorKey.currentContext! , uri)
98
+ .onError ((error, _) => null );
99
+ });
100
+ });
104
101
linkSubscription = appLinks.uriLinkStream.listen ((uri) {
105
102
if (isInForeground) return ;
106
103
if (navigatorKey.currentContext == null ) return ;
@@ -140,24 +137,24 @@ class MyAppState extends State<MyApp> {
140
137
);
141
138
final routes = {
142
139
'/create' : (context) => ScaffoldWithDrawer (
143
- title: S .of (context)? .drawer_createPage ?? 'Create a Link' ,
144
- body: CreatePage (),
145
- drawer: sharedDrawer,
140
+ title: S .of (context)? .drawer_createPage ?? 'Create a Link' ,
141
+ body: CreatePage (),
142
+ drawer: sharedDrawer,
146
143
),
147
144
'/read' : (context) => ScaffoldWithDrawer (
148
- title: S .of (context)? .drawer_readPage ?? 'Read a Link' ,
149
- body: ReadPage (),
150
- drawer: sharedDrawer,
145
+ title: S .of (context)? .drawer_readPage ?? 'Read a Link' ,
146
+ body: ReadPage (),
147
+ drawer: sharedDrawer,
151
148
),
152
149
'/gallery' : (context) => ScaffoldWithDrawer (
153
- title: S .of (context)? .drawer_galleryPage ?? 'Link Gallery' ,
154
- body: GalleryPage (),
155
- drawer: sharedDrawer,
150
+ title: S .of (context)? .drawer_galleryPage ?? 'Link Gallery' ,
151
+ body: GalleryPage (),
152
+ drawer: sharedDrawer,
156
153
),
157
154
'/settings' : (context) => ScaffoldWithDrawer (
158
- title: S .of (context)? .drawer_settingPage ?? 'Settings' ,
159
- body: SettingsPage (),
160
- drawer: sharedDrawer,
155
+ title: S .of (context)? .drawer_settingPage ?? 'Settings' ,
156
+ body: SettingsPage (),
157
+ drawer: sharedDrawer,
161
158
),
162
159
};
163
160
@@ -189,7 +186,15 @@ class MyAppState extends State<MyApp> {
189
186
),
190
187
),
191
188
themeMode: themeProvider.theme.toThemeMode (),
192
- initialRoute: '/create' ,
189
+ home: Builder (
190
+ builder: (context) {
191
+ return ScaffoldWithDrawer (
192
+ title: S .of (context)? .drawer_createPage ?? 'Create a Link' ,
193
+ body: CreatePage (),
194
+ drawer: sharedDrawer,
195
+ );
196
+ },
197
+ ),
193
198
routes: routes,
194
199
);
195
200
}
0 commit comments