Skip to content

Commit

Permalink
1.4.3 fix config not save
Browse files Browse the repository at this point in the history
  • Loading branch information
zmtzawqlp committed Sep 10, 2024
1 parent f37109d commit ad59ab6
Show file tree
Hide file tree
Showing 52 changed files with 755 additions and 372 deletions.
1 change: 0 additions & 1 deletion Flutter/json_to_dart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
**/ios/Runner/GeneratedPluginRegistrant.*

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!**/ios/**/default.mode1v3
Expand Down
34 changes: 17 additions & 17 deletions Flutter/json_to_dart/.metadata
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
# This file should be version controlled and should not be manually edited.

version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable
revision: "5874a72aa4c779a02553007c47dacbefba2374dc"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: android
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: ios
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: linux
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: macos
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: web
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- platform: windows
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc

# User provided section

Expand Down
4 changes: 4 additions & 0 deletions Flutter/json_to_dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.4.3

* fix config not save

## 1.4.2

* fix camelName error
Expand Down
2 changes: 1 addition & 1 deletion Flutter/json_to_dart/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ analyzer:
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore
# sdk_version_async_exported_from_core: ignore
exclude:
- "lib/models/*.g.dart"
# exclude:
Expand Down
40 changes: 21 additions & 19 deletions Flutter/json_to_dart/lib/main_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ import 'models/config.dart';
import 'models/dart_object.dart';

void showAlertDialog(String msg, [IconData data = Icons.warning]) {
SmartDialog.compatible.show(
widget: AlertDialog(
title: Icon(data),
content: Text(msg),
actions: <Widget>[
TextButton(
child: Text(appLocalizations.ok),
onPressed: () {
SmartDialog.compatible.dismiss();
},
),
],
));
SmartDialog.show(
builder: (BuildContext b) => AlertDialog(
title: Icon(data),
content: Text(msg),
actions: <Widget>[
TextButton(
child: Text(appLocalizations.ok),
onPressed: () {
SmartDialog.dismiss();
},
),
],
),
);
}

class MainController extends GetxController {
Expand Down Expand Up @@ -60,10 +61,11 @@ class MainController extends GetxController {
return;
}

SmartDialog.compatible.showLoading(
widget: const Center(
child: SpinKitCubeGrid(color: Colors.orange),
));
SmartDialog.showLoading(
builder: (BuildContext context) => const Center(
child: SpinKitCubeGrid(color: Colors.orange),
),
);

String inputText = text;
try {
Expand All @@ -85,7 +87,7 @@ class MainController extends GetxController {
// handleError(error, stackTrace);
// });
if (extendedObject == null) {
SmartDialog.compatible.dismiss();
SmartDialog.dismiss();
showAlertDialog(appLocalizations.illegalJson, Icons.error);
return;
}
Expand All @@ -111,7 +113,7 @@ class MainController extends GetxController {
} catch (error, stackTrace) {
handleError(error, stackTrace);
}
SmartDialog.compatible.dismiss();
SmartDialog.dismiss();
}

String? generateDart() {
Expand Down
1 change: 0 additions & 1 deletion Flutter/json_to_dart/lib/models/dart_object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:json_to_dart/utils/error_check/text_editing_controller.dart';
import 'package:json_to_dart/utils/my_string_buffer.dart';
import 'package:json_to_dart/utils/string_helper.dart';

import 'config.dart';
import 'dart_property.dart';

// ignore: must_be_immutable
Expand Down
1 change: 0 additions & 1 deletion Flutter/json_to_dart/lib/pages/json_tree_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:json_to_dart/style/text.dart';
import 'package:json_to_dart/utils/enums.dart';
import 'package:json_to_dart/utils/extension.dart';

import '../models/config.dart';
import '../widget/checkBox.dart';

class JsonTreeHeader extends StatelessWidget {
Expand Down
2 changes: 0 additions & 2 deletions Flutter/json_to_dart/lib/pages/json_tree_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import 'package:json_to_dart/utils/enums.dart';
import 'package:json_to_dart/utils/extension.dart';

import '../models/config.dart';
import '../models/dart_object.dart';
import '../utils/enums.dart';
import '../widget/checkBox.dart';

Widget _emptyWidget = Expanded(
Expand Down
2 changes: 1 addition & 1 deletion Flutter/json_to_dart/lib/pages/result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ResultDialog extends StatelessWidget {
),
CloseButton(
onPressed: () {
SmartDialog.compatible.dismiss();
SmartDialog.dismiss();
},
),
],
Expand Down
30 changes: 20 additions & 10 deletions Flutter/json_to_dart/lib/pages/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class SettingWidget extends StatelessWidget {
return;
}
if (ConfigSetting().showResultDialog.value) {
SmartDialog.compatible.show(
widget: ResultDialog(
SmartDialog.show(
builder: (BuildContext b) => ResultDialog(
text: dartText,
),
);
Expand All @@ -52,13 +52,13 @@ class SettingWidget extends StatelessWidget {
onPressed: () {
showModalBottomSheet<void>(
context: context,
constraints: const BoxConstraints.expand(),
builder: (BuildContext ctx) {
return Container(
height: double.infinity,
child: const MoreSetting(),
);
return const MoreSetting();
},
).whenComplete(() {});
).whenComplete(() {
ConfigSetting().save();
});
},
),
Obx(() {
Expand All @@ -77,6 +77,7 @@ class SettingWidget extends StatelessWidget {
.toList(),
onChanged: (Locale? value) {
ConfigSetting().locale.value = value!;
ConfigSetting().save();
Get.updateLocale(ConfigSetting().locale.value);
controller.formatJsonAndCreateDartObject();
},
Expand Down Expand Up @@ -108,6 +109,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (bool value) {
if (ConfigSetting().enableDataProtection.value != value) {
ConfigSetting().enableDataProtection.value = value;
ConfigSetting().save();
}
},
);
Expand All @@ -119,6 +121,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (bool value) {
if (value != ConfigSetting().enableArrayProtection.value) {
ConfigSetting().enableArrayProtection.value = value;
ConfigSetting().save();
}
},
);
Expand Down Expand Up @@ -148,7 +151,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (int? value) {
if (ConfigSetting().traverseArrayCount.value != value) {
ConfigSetting().traverseArrayCount.value = value!;

ConfigSetting().save();
if (controller.dartObject != null) {
controller.formatJsonAndCreateDartObject();
}
Expand Down Expand Up @@ -185,7 +188,7 @@ class MoreSetting extends StatelessWidget {
if (ConfigSetting().propertyNamingConventionsType.value !=
value) {
ConfigSetting().propertyNamingConventionsType.value = value!;

ConfigSetting().save();
controller.updateNameByNamingConventionsType();
}
},
Expand Down Expand Up @@ -215,7 +218,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (PropertyNameSortingType? value) {
if (ConfigSetting().propertyNameSortingType.value != value) {
ConfigSetting().propertyNameSortingType.value = value!;

ConfigSetting().save();
controller.orderPropeties();
}
},
Expand All @@ -229,6 +232,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (bool value) {
if (ConfigSetting().addMethod.value != value) {
ConfigSetting().addMethod.value = value;
ConfigSetting().save();
}
},
);
Expand All @@ -242,6 +246,7 @@ class MoreSetting extends StatelessWidget {
if (!value) {
ConfigSetting().smartNullable.value = false;
}
ConfigSetting().save();
},
);
}),
Expand All @@ -255,6 +260,7 @@ class MoreSetting extends StatelessWidget {
// if (!value) {
// controller.updateNullable(true);
// }
ConfigSetting().save();
},
);
}
Expand All @@ -270,6 +276,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (bool value) {
if (ConfigSetting().addCopyMethod.value != value) {
ConfigSetting().addCopyMethod.value = value;
ConfigSetting().save();
}
},
);
Expand All @@ -280,6 +287,7 @@ class MoreSetting extends StatelessWidget {
value: ConfigSetting().automaticCheck.value,
onChanged: (bool value) {
ConfigSetting().automaticCheck.value = value;
ConfigSetting().save();
},
);
}),
Expand All @@ -290,6 +298,7 @@ class MoreSetting extends StatelessWidget {
onChanged: (bool value) {
if (value != ConfigSetting().showResultDialog.value) {
ConfigSetting().showResultDialog.value = value;
ConfigSetting().save();
}
},
);
Expand Down Expand Up @@ -324,6 +333,7 @@ class MoreSetting extends StatelessWidget {
controller: controller.fileHeaderHelpController,
onChanged: (String value) {
ConfigSetting().fileHeaderInfo = value;
ConfigSetting().save();
},
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
Expand Down
1 change: 0 additions & 1 deletion Flutter/json_to_dart/lib/utils/dart_helper.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:json_to_dart/models/dart_property.dart';

import '../models/config.dart';
import '../models/dart_property.dart';
import 'enums.dart';

class DartHelper {
Expand Down
7 changes: 7 additions & 0 deletions Flutter/json_to_dart/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ set_target_properties(${BINARY_NAME}
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)


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

# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
Expand Down
20 changes: 20 additions & 0 deletions Flutter/json_to_dart/linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
return TRUE;
}

// Implements GApplication::startup.
static void my_application_startup(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);

// Perform any actions required at application startup.

G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}

// Implements GApplication::shutdown.
static void my_application_shutdown(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);

// Perform any actions required at application shutdown.

G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
}

// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
Expand All @@ -91,6 +109,8 @@ static void my_application_dispose(GObject* object) {
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FlutterMacOS
import Foundation

import path_provider_macos
import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
Loading

0 comments on commit ad59ab6

Please sign in to comment.