Skip to content

Commit 31ddbe1

Browse files
authored
NStack SDK architectural changes (#63)
* NStack SDK architectural changes - Separate features like message and version control from NStackWidget - The newly introduced NStackFeatureHandlerWidget will be used for other NStack features - Only localization is the default for NStackWidget - Simplified the code generation part - Default localizations for the adaptive dialogue are configurable from the console. - Rearrange the folder structure * - Expose async API to get message and version update info - Doc update - Refactor * - Removed commented code block * - Moved getMessage API from NStack to NStackMessages - Moved getVersionInfo API from NStack to NStackVersionControl - Other clean-ups
1 parent da4c618 commit 31ddbe1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1654
-1562
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ SPEC CHECKSUMS:
3333
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
3434
nstack: a7ebf31d8c387ec76d4bfe5eb494d3ac81756d92
3535
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
36-
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
37-
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
36+
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
37+
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
3838

3939
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011
4040

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
97C146E61CF9000F007C117D /* Project object */ = {
157157
isa = PBXProject;
158158
attributes = {
159-
LastUpgradeCheck = 1430;
159+
LastUpgradeCheck = 1510;
160160
ORGANIZATIONNAME = "";
161161
TargetAttributes = {
162162
97C146ED1CF9000F007C117D = {

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/lib/main.dart

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,25 @@
11
import 'package:example/nstack.dart';
2+
import 'package:example/routes/routes.dart';
23
import 'package:flutter/material.dart';
34

45
void main() {
5-
runApp(const ExampleApp());
6+
runApp(ExampleApp());
67
}
78

89
class ExampleApp extends StatelessWidget {
9-
const ExampleApp({super.key});
10+
ExampleApp({super.key});
11+
final _router = AppRouter();
1012

1113
@override
1214
Widget build(BuildContext context) {
13-
return MaterialApp(
15+
return MaterialApp.router(
1416
builder: (context, child) {
1517
return NStackWidget(
1618
child: child!,
1719
);
1820
},
19-
home: const MainScreen(),
20-
);
21-
}
22-
}
23-
24-
class MainScreen extends StatelessWidget {
25-
const MainScreen({super.key});
26-
27-
@override
28-
Widget build(BuildContext context) {
29-
final localization = context.localization;
30-
final localizationAsset = localization.assets;
31-
final activeLanguage = localization.activeLanguage;
32-
33-
// Message option for receiving the Message response, will not show the default dialog.
34-
// void onMessage(Message message) {
35-
// if (kDebugMode) {
36-
// print(message.message);
37-
// }
38-
// }
39-
40-
// final customNstackHandlerConfiguration =
41-
// CustomNstackHandlerConfiguration(onMessage: onMessage);
42-
43-
// Message option for showing default dialog.
44-
final defaultHandlerConfiguration = DefaultNstackHandlerConfiguration(
45-
okButtonTitle: localizationAsset.test.okButtonTitle,
46-
openUrlButtonTitle: localizationAsset.test.openUrlButtonTitle,
47-
dialogTitle: localizationAsset.test.dialogTitle,
48-
);
49-
50-
return NStackVersionControlWidget(
51-
child: NStackMessageWidget(
52-
handlerConfiguration: defaultHandlerConfiguration,
53-
child: Scaffold(
54-
appBar: AppBar(
55-
title: Text(localizationAsset.test.testDollarSign),
56-
),
57-
body: Center(
58-
child: MaterialButton(
59-
onPressed: () {
60-
final locale = activeLanguage.locale == 'en-EN'
61-
? const Locale('de-AT')
62-
: const Locale('en-EN');
63-
localization.changeLocalization(locale);
64-
},
65-
child: Text(
66-
'Selected locale: ${activeLanguage.name}',
67-
),
68-
),
69-
),
70-
),
71-
),
21+
routerDelegate: _router.delegate(),
22+
routeInformationParser: _router.defaultRouteParser(),
7223
);
7324
}
7425
}

0 commit comments

Comments
 (0)