Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
types: [opened, reopened, synchronize]

env:
FLUTTER_VERSION: '3.41.7'
FLUTTER_VERSION: 3.x

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ env:
MACOS_APP_RELEASE_UNSIGNED_PATH: build/macos/Build/Products/Release-unsigned
MACOS_APP_RELEASE_STAGING_PATH: build/macos/Build/Products/Release-staging
MACOS_APP_RELEASE_DEV_PATH: build/macos/Build/Products/Release-dev
FLUTTER_VERSION: "3.41.7"
FLUTTER_VERSION: 3.x

jobs:

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ utilised by the flutter version_widget package.

## 0.1 Stable beta release

+ Use file_picker v12.x API [0.0.13]
+ Remove null/empty values from output JSON [0.0.12 20260511 tonypioneer]
+ Update file_picker dependency [0.0.11 20260424 anushkavid]
+ Migrate to universal_web to allow native web build [0.0.10 20260217 dc]
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ analyzer:
exclude:
- ignore/**
- ignore/
- build/**
43 changes: 21 additions & 22 deletions lib/src/widgets/button_file_saver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
///
/// Authors: Tony Chen
/// Authors: Tony Chen, Dawei Chen

library;

import 'dart:convert';
import 'dart:io' show File;

import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -129,35 +128,35 @@ Future<void> saveDataForNonWeb(
) async {
final messenger = ScaffoldMessenger.of(context);

String? selectedFile = await FilePicker.saveFile(
dialogTitle: 'Please choose a filename and path to save the result',
fileName: defaultFileName,
type: FileType.custom,
allowedExtensions: ['json'],
);

if (selectedFile != null) {
final file = File(selectedFile);
try {
final jsonContent = jsonEncoder.convert(data);

try {
await file.writeAsString(jsonContent);
debugPrint('File saved at $selectedFile');
final selectedFileUri = await FilePicker.saveFile(
dialogTitle: 'Please choose a filename and path to save the result',
fileName: defaultFileName,
bytes: utf8.encode(jsonContent),
mimeType: 'application/json',
type: FileType.custom,
allowedExtensions: ['json'],
);

if (selectedFileUri != null) {
debugPrint('File saved at $selectedFileUri');

messenger.showSnackBar(
SnackBar(content: Text('Data saved as $selectedFile')),
SnackBar(content: Text('Data saved as $selectedFileUri')),
);
} catch (e) {
debugPrint('Error saving file: $e');

} else {
debugPrint('Save file dialog was cancelled.');
messenger.showSnackBar(
SnackBar(content: Text('Error saving file: $e')),
const SnackBar(content: Text('Save cancelled.')),
);
}
} else {
debugPrint('Save file dialog was cancelled.');
} catch (e) {
debugPrint('Error saving file: $e');

messenger.showSnackBar(
const SnackBar(content: Text('Save cancelled.')),
SnackBar(content: Text('Error saving file: $e')),
);
}
}
Expand Down
12 changes: 6 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: markdown_widget_builder
description: "Widget builder for surveys defined using markdown-like syntax."
version: 0.0.12
version: 0.0.13
homepage: https://github.com/anusii/markdown_widget_builder

environment:
Expand All @@ -18,23 +18,23 @@ dependencies:
flutter:
sdk: flutter

audioplayers: ^6.5.1
file_picker: ^11.0.2
flutter_markdown_plus: ^1.0.7
audioplayers: ^6.8.1
file_picker: ^12.1.3
flutter_markdown_plus: ^1.0.12
http: ^1.6.0
media_kit: ^1.2.6
media_kit_libs_video: ^1.0.7
media_kit_video: ^2.0.1
path: ^1.9.1
path_provider: ^2.1.5
path_provider: ^2.1.6
# universal_html: ^2.3.0
universal_web: ^1.1.1+1
url_launcher: ^6.3.2

dev_dependencies:
custom_lint: ^0.8.1
flutter_lints: ^6.0.0
import_order_lint: ^0.2.2
import_order_lint: ^0.2.3

flutter:
uses-material-design: true
Loading