Skip to content

Commit ad59ab6

Browse files
committed
1.4.3 fix config not save
1 parent f37109d commit ad59ab6

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

+755
-372
lines changed

Flutter/json_to_dart/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
**/ios/Runner/GeneratedPluginRegistrant.*
6868

6969
# Web related
70-
lib/generated_plugin_registrant.dart
7170

7271
# Exceptions to above rules.
7372
!**/ios/**/default.mode1v3

Flutter/json_to_dart/.metadata

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
8-
channel: stable
7+
revision: "5874a72aa4c779a02553007c47dacbefba2374dc"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
17-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
16+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
17+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
1818
- platform: android
19-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
20-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
19+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
20+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
2121
- platform: ios
22-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
23-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
22+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
23+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
2424
- platform: linux
25-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
26-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
25+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
26+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
2727
- platform: macos
28-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
29-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
28+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
29+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
3030
- platform: web
31-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
32-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
31+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
32+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
3333
- platform: windows
34-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
35-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
34+
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
35+
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
3636

3737
# User provided section
3838

Flutter/json_to_dart/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.3
2+
3+
* fix config not save
4+
15
## 1.4.2
26

37
* fix camelName error

Flutter/json_to_dart/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ analyzer:
3232
# Ignore analyzer hints for updating pubspecs when using Future or
3333
# Stream and not importing dart:async
3434
# Please see https://github.com/flutter/flutter/pull/24528 for details.
35-
sdk_version_async_exported_from_core: ignore
35+
# sdk_version_async_exported_from_core: ignore
3636
exclude:
3737
- "lib/models/*.g.dart"
3838
# exclude:

Flutter/json_to_dart/lib/main_controller.dart

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ import 'models/config.dart';
1818
import 'models/dart_object.dart';
1919

2020
void showAlertDialog(String msg, [IconData data = Icons.warning]) {
21-
SmartDialog.compatible.show(
22-
widget: AlertDialog(
23-
title: Icon(data),
24-
content: Text(msg),
25-
actions: <Widget>[
26-
TextButton(
27-
child: Text(appLocalizations.ok),
28-
onPressed: () {
29-
SmartDialog.compatible.dismiss();
30-
},
31-
),
32-
],
33-
));
21+
SmartDialog.show(
22+
builder: (BuildContext b) => AlertDialog(
23+
title: Icon(data),
24+
content: Text(msg),
25+
actions: <Widget>[
26+
TextButton(
27+
child: Text(appLocalizations.ok),
28+
onPressed: () {
29+
SmartDialog.dismiss();
30+
},
31+
),
32+
],
33+
),
34+
);
3435
}
3536

3637
class MainController extends GetxController {
@@ -60,10 +61,11 @@ class MainController extends GetxController {
6061
return;
6162
}
6263

63-
SmartDialog.compatible.showLoading(
64-
widget: const Center(
65-
child: SpinKitCubeGrid(color: Colors.orange),
66-
));
64+
SmartDialog.showLoading(
65+
builder: (BuildContext context) => const Center(
66+
child: SpinKitCubeGrid(color: Colors.orange),
67+
),
68+
);
6769

6870
String inputText = text;
6971
try {
@@ -85,7 +87,7 @@ class MainController extends GetxController {
8587
// handleError(error, stackTrace);
8688
// });
8789
if (extendedObject == null) {
88-
SmartDialog.compatible.dismiss();
90+
SmartDialog.dismiss();
8991
showAlertDialog(appLocalizations.illegalJson, Icons.error);
9092
return;
9193
}
@@ -111,7 +113,7 @@ class MainController extends GetxController {
111113
} catch (error, stackTrace) {
112114
handleError(error, stackTrace);
113115
}
114-
SmartDialog.compatible.dismiss();
116+
SmartDialog.dismiss();
115117
}
116118

117119
String? generateDart() {

Flutter/json_to_dart/lib/models/dart_object.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:json_to_dart/utils/error_check/text_editing_controller.dart';
99
import 'package:json_to_dart/utils/my_string_buffer.dart';
1010
import 'package:json_to_dart/utils/string_helper.dart';
1111

12-
import 'config.dart';
1312
import 'dart_property.dart';
1413

1514
// ignore: must_be_immutable

Flutter/json_to_dart/lib/pages/json_tree_header.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:json_to_dart/style/text.dart';
88
import 'package:json_to_dart/utils/enums.dart';
99
import 'package:json_to_dart/utils/extension.dart';
1010

11-
import '../models/config.dart';
1211
import '../widget/checkBox.dart';
1312

1413
class JsonTreeHeader extends StatelessWidget {

Flutter/json_to_dart/lib/pages/json_tree_item.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import 'package:json_to_dart/utils/enums.dart';
99
import 'package:json_to_dart/utils/extension.dart';
1010

1111
import '../models/config.dart';
12-
import '../models/dart_object.dart';
13-
import '../utils/enums.dart';
1412
import '../widget/checkBox.dart';
1513

1614
Widget _emptyWidget = Expanded(

Flutter/json_to_dart/lib/pages/result.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ResultDialog extends StatelessWidget {
3131
),
3232
CloseButton(
3333
onPressed: () {
34-
SmartDialog.compatible.dismiss();
34+
SmartDialog.dismiss();
3535
},
3636
),
3737
],

Flutter/json_to_dart/lib/pages/setting.dart

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class SettingWidget extends StatelessWidget {
3838
return;
3939
}
4040
if (ConfigSetting().showResultDialog.value) {
41-
SmartDialog.compatible.show(
42-
widget: ResultDialog(
41+
SmartDialog.show(
42+
builder: (BuildContext b) => ResultDialog(
4343
text: dartText,
4444
),
4545
);
@@ -52,13 +52,13 @@ class SettingWidget extends StatelessWidget {
5252
onPressed: () {
5353
showModalBottomSheet<void>(
5454
context: context,
55+
constraints: const BoxConstraints.expand(),
5556
builder: (BuildContext ctx) {
56-
return Container(
57-
height: double.infinity,
58-
child: const MoreSetting(),
59-
);
57+
return const MoreSetting();
6058
},
61-
).whenComplete(() {});
59+
).whenComplete(() {
60+
ConfigSetting().save();
61+
});
6262
},
6363
),
6464
Obx(() {
@@ -77,6 +77,7 @@ class SettingWidget extends StatelessWidget {
7777
.toList(),
7878
onChanged: (Locale? value) {
7979
ConfigSetting().locale.value = value!;
80+
ConfigSetting().save();
8081
Get.updateLocale(ConfigSetting().locale.value);
8182
controller.formatJsonAndCreateDartObject();
8283
},
@@ -108,6 +109,7 @@ class MoreSetting extends StatelessWidget {
108109
onChanged: (bool value) {
109110
if (ConfigSetting().enableDataProtection.value != value) {
110111
ConfigSetting().enableDataProtection.value = value;
112+
ConfigSetting().save();
111113
}
112114
},
113115
);
@@ -119,6 +121,7 @@ class MoreSetting extends StatelessWidget {
119121
onChanged: (bool value) {
120122
if (value != ConfigSetting().enableArrayProtection.value) {
121123
ConfigSetting().enableArrayProtection.value = value;
124+
ConfigSetting().save();
122125
}
123126
},
124127
);
@@ -148,7 +151,7 @@ class MoreSetting extends StatelessWidget {
148151
onChanged: (int? value) {
149152
if (ConfigSetting().traverseArrayCount.value != value) {
150153
ConfigSetting().traverseArrayCount.value = value!;
151-
154+
ConfigSetting().save();
152155
if (controller.dartObject != null) {
153156
controller.formatJsonAndCreateDartObject();
154157
}
@@ -185,7 +188,7 @@ class MoreSetting extends StatelessWidget {
185188
if (ConfigSetting().propertyNamingConventionsType.value !=
186189
value) {
187190
ConfigSetting().propertyNamingConventionsType.value = value!;
188-
191+
ConfigSetting().save();
189192
controller.updateNameByNamingConventionsType();
190193
}
191194
},
@@ -215,7 +218,7 @@ class MoreSetting extends StatelessWidget {
215218
onChanged: (PropertyNameSortingType? value) {
216219
if (ConfigSetting().propertyNameSortingType.value != value) {
217220
ConfigSetting().propertyNameSortingType.value = value!;
218-
221+
ConfigSetting().save();
219222
controller.orderPropeties();
220223
}
221224
},
@@ -229,6 +232,7 @@ class MoreSetting extends StatelessWidget {
229232
onChanged: (bool value) {
230233
if (ConfigSetting().addMethod.value != value) {
231234
ConfigSetting().addMethod.value = value;
235+
ConfigSetting().save();
232236
}
233237
},
234238
);
@@ -242,6 +246,7 @@ class MoreSetting extends StatelessWidget {
242246
if (!value) {
243247
ConfigSetting().smartNullable.value = false;
244248
}
249+
ConfigSetting().save();
245250
},
246251
);
247252
}),
@@ -255,6 +260,7 @@ class MoreSetting extends StatelessWidget {
255260
// if (!value) {
256261
// controller.updateNullable(true);
257262
// }
263+
ConfigSetting().save();
258264
},
259265
);
260266
}
@@ -270,6 +276,7 @@ class MoreSetting extends StatelessWidget {
270276
onChanged: (bool value) {
271277
if (ConfigSetting().addCopyMethod.value != value) {
272278
ConfigSetting().addCopyMethod.value = value;
279+
ConfigSetting().save();
273280
}
274281
},
275282
);
@@ -280,6 +287,7 @@ class MoreSetting extends StatelessWidget {
280287
value: ConfigSetting().automaticCheck.value,
281288
onChanged: (bool value) {
282289
ConfigSetting().automaticCheck.value = value;
290+
ConfigSetting().save();
283291
},
284292
);
285293
}),
@@ -290,6 +298,7 @@ class MoreSetting extends StatelessWidget {
290298
onChanged: (bool value) {
291299
if (value != ConfigSetting().showResultDialog.value) {
292300
ConfigSetting().showResultDialog.value = value;
301+
ConfigSetting().save();
293302
}
294303
},
295304
);
@@ -324,6 +333,7 @@ class MoreSetting extends StatelessWidget {
324333
controller: controller.fileHeaderHelpController,
325334
onChanged: (String value) {
326335
ConfigSetting().fileHeaderInfo = value;
336+
ConfigSetting().save();
327337
},
328338
decoration: InputDecoration(
329339
contentPadding: const EdgeInsets.symmetric(horizontal: 12),

Flutter/json_to_dart/lib/utils/dart_helper.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:json_to_dart/models/dart_property.dart';
22

33
import '../models/config.dart';
4-
import '../models/dart_property.dart';
54
import 'enums.dart';
65

76
class DartHelper {

Flutter/json_to_dart/linux/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ set_target_properties(${BINARY_NAME}
8686
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
8787
)
8888

89+
8990
# Generated plugin build rules, which manage building the plugins and adding
9091
# them to the application.
9192
include(flutter/generated_plugins.cmake)
@@ -122,6 +123,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
122123
COMPONENT Runtime)
123124
endforeach(bundled_library)
124125

126+
# Copy the native assets provided by the build.dart from all packages.
127+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
128+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
129+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
130+
COMPONENT Runtime)
131+
125132
# Fully re-copy the assets directory on each build to avoid having stale files
126133
# from a previous install.
127134
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")

Flutter/json_to_dart/linux/my_application.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8181
return TRUE;
8282
}
8383

84+
// Implements GApplication::startup.
85+
static void my_application_startup(GApplication* application) {
86+
//MyApplication* self = MY_APPLICATION(object);
87+
88+
// Perform any actions required at application startup.
89+
90+
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
91+
}
92+
93+
// Implements GApplication::shutdown.
94+
static void my_application_shutdown(GApplication* application) {
95+
//MyApplication* self = MY_APPLICATION(object);
96+
97+
// Perform any actions required at application shutdown.
98+
99+
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
100+
}
101+
84102
// Implements GObject::dispose.
85103
static void my_application_dispose(GObject* object) {
86104
MyApplication* self = MY_APPLICATION(object);
@@ -91,6 +109,8 @@ static void my_application_dispose(GObject* object) {
91109
static void my_application_class_init(MyApplicationClass* klass) {
92110
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93111
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
112+
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
113+
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
94114
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95115
}
96116

Flutter/json_to_dart/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import FlutterMacOS
66
import Foundation
77

8-
import path_provider_macos
8+
import path_provider_foundation
99

1010
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
1111
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))

0 commit comments

Comments
 (0)