Skip to content

Commit a3faf5a

Browse files
committed
fix: added NStackOpenWidget
1 parent 60d279b commit a3faf5a

File tree

5 files changed

+32
-40
lines changed

5 files changed

+32
-40
lines changed

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>9.0</string>
2525
</dict>
2626
</plist>

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ EXTERNAL SOURCES:
2424
:path: ".symlinks/plugins/shared_preferences/ios"
2525

2626
SPEC CHECKSUMS:
27-
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
27+
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
2828
nstack: a7ebf31d8c387ec76d4bfe5eb494d3ac81756d92
2929
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
3030
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@
348348
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
349349
GCC_WARN_UNUSED_FUNCTION = YES;
350350
GCC_WARN_UNUSED_VARIABLE = YES;
351-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
351+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
352352
MTL_ENABLE_DEBUG_INFO = NO;
353353
SDKROOT = iphoneos;
354354
SUPPORTED_PLATFORMS = iphoneos;
@@ -430,7 +430,7 @@
430430
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
431431
GCC_WARN_UNUSED_FUNCTION = YES;
432432
GCC_WARN_UNUSED_VARIABLE = YES;
433-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
433+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
434434
MTL_ENABLE_DEBUG_INFO = YES;
435435
ONLY_ACTIVE_ARCH = YES;
436436
SDKROOT = iphoneos;
@@ -479,7 +479,7 @@
479479
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
480480
GCC_WARN_UNUSED_FUNCTION = YES;
481481
GCC_WARN_UNUSED_VARIABLE = YES;
482-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
482+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
483483
MTL_ENABLE_DEBUG_INFO = NO;
484484
SDKROOT = iphoneos;
485485
SUPPORTED_PLATFORMS = iphoneos;

example/pubspec.lock

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: _fe_analyzer_shared
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "22.0.0"
10+
version: "25.0.0"
1111
analyzer:
1212
dependency: transitive
1313
description:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.7.1"
17+
version: "2.2.0"
1818
args:
1919
dependency: transitive
2020
description:
@@ -28,7 +28,7 @@ packages:
2828
name: async
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "2.6.1"
31+
version: "2.8.1"
3232
boolean_selector:
3333
dependency: transitive
3434
description:
@@ -105,7 +105,7 @@ packages:
105105
name: charcode
106106
url: "https://pub.dartlang.org"
107107
source: hosted
108-
version: "1.2.0"
108+
version: "1.3.1"
109109
checked_yaml:
110110
dependency: transitive
111111
description:
@@ -288,28 +288,21 @@ packages:
288288
name: meta
289289
url: "https://pub.dartlang.org"
290290
source: hosted
291-
version: "1.3.0"
291+
version: "1.7.0"
292292
mime:
293293
dependency: transitive
294294
description:
295295
name: mime
296296
url: "https://pub.dartlang.org"
297297
source: hosted
298298
version: "1.0.0"
299-
nested:
300-
dependency: transitive
301-
description:
302-
name: nested
303-
url: "https://pub.dartlang.org"
304-
source: hosted
305-
version: "1.0.0"
306299
nstack:
307300
dependency: "direct main"
308301
description:
309302
path: ".."
310303
relative: true
311304
source: path
312-
version: "0.3.0"
305+
version: "0.4.0"
313306
package_config:
314307
dependency: transitive
315308
description:
@@ -387,13 +380,6 @@ packages:
387380
url: "https://pub.dartlang.org"
388381
source: hosted
389382
version: "4.2.3"
390-
provider:
391-
dependency: "direct main"
392-
description:
393-
name: provider
394-
url: "https://pub.dartlang.org"
395-
source: hosted
396-
version: "6.0.0"
397383
pub_semver:
398384
dependency: transitive
399385
description:
@@ -517,7 +503,7 @@ packages:
517503
name: test_api
518504
url: "https://pub.dartlang.org"
519505
source: hosted
520-
version: "0.3.0"
506+
version: "0.4.2"
521507
timing:
522508
dependency: transitive
523509
description:

lib/src/nstack_builder.dart

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,30 @@ class NStackState extends State<NStackWidget> {
263263
setState(() {});
264264
}
265265
266-
_attemptAppOpen() {
267-
try {
268-
nstack.appOpen(Localizations.localeOf(context));
269-
} catch(e) {
270-
print("NStack could not call appOpen() as the NStackWidget is too far up the widget tree.");
271-
print("Consider calling NStackScope.of(context).nstack.appOpen(Localizations.localeOf(context)) in a splashscreen or later.");
272-
}
273-
}
274-
275-
@override
276-
void initState() {
277-
super.initState();
278-
_attemptAppOpen();
266+
@override
267+
Widget build(BuildContext context) {
268+
return NStackScope(child: widget.child, state: this, nstack: this.nstack, checksum: nstack.checksum,);
279269
}
270+
}
271+
272+
class NStackAppOpen extends StatefulWidget {
273+
const NStackAppOpen({Key? key, required this.child}) : super(key: key);
274+
275+
final Widget child;
280276
277+
@override
278+
_NStackAppOpenState createState() => _NStackAppOpenState();
279+
}
280+
281+
class _NStackAppOpenState extends State<NStackAppOpen> {
282+
bool _initializedNStack = false;
281283
@override
282284
Widget build(BuildContext context) {
283-
return NStackScope(child: widget.child, state: this, nstack: this.nstack, checksum: nstack.checksum,);
285+
if(!_initializedNStack) {
286+
NStackScope.of(context).nstack.appOpen(Localizations.localeOf(context));
287+
_initializedNStack = true;
288+
}
289+
return widget.child;
284290
}
285291
}
286292

0 commit comments

Comments
 (0)