Skip to content

Commit e41d970

Browse files
committed
cold launch bug fixed
1 parent 560416b commit e41d970

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

lib/main.dart

+29-24
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import 'package:nfc_plinkd/utils/media/picker.dart';
2424
class MyApp extends StatefulWidget {
2525
const MyApp({super.key});
2626

27-
// final ConfigTheme? theme;
28-
// final ConfigLanguage? language;
29-
3027
@override
3128
State<StatefulWidget> createState() => MyAppState();
3229
}
@@ -93,14 +90,14 @@ class MyAppState extends State<MyApp> {
9390
Future<void> initDeepLinks() async {
9491
final appLinks = AppLinks();
9592

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+
});
104101
linkSubscription = appLinks.uriLinkStream.listen((uri) {
105102
if (isInForeground) return;
106103
if (navigatorKey.currentContext == null) return;
@@ -140,24 +137,24 @@ class MyAppState extends State<MyApp> {
140137
);
141138
final routes = {
142139
'/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,
146143
),
147144
'/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,
151148
),
152149
'/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,
156153
),
157154
'/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,
161158
),
162159
};
163160

@@ -189,7 +186,15 @@ class MyAppState extends State<MyApp> {
189186
),
190187
),
191188
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+
),
193198
routes: routes,
194199
);
195200
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 1.1.0
19+
version: 1.1.1
2020

2121
environment:
2222
sdk: ^3.6.1

0 commit comments

Comments
 (0)