Skip to content

Commit

Permalink
doc: Documentations updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhi001 committed Apr 24, 2023
1 parent afb2db9 commit 51cfbec
Show file tree
Hide file tree
Showing 17 changed files with 343 additions and 123 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ Overall, FormStack is a powerful tool for creating dynamic user interfaces in Fl
}


```
### Load single json file from assets folder
``` dart
await FormStack.api() .loadFromAsset('assets/app.json');
```
### Load Mutiple json file from assets folder
``` dart
await FormStack.api()
.loadFromAssets(['assets/app.json', 'assets/full.json']);
```
### Read json file from assets to FormStack

Expand Down
6 changes: 4 additions & 2 deletions example/assets/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"options":[
{"key":"AUTISM_M_CHAT_R","text":"Screenig Tool For Autism In Child M-CHAT-R"},
{"key":"CALL_DRIVER","text":"Call Driver Now"},
{"key":"FULL_QUESTIONS","text":"Full Components"}
{"key":"FULL_QUESTIONS","text":"Full Components"},
{"key":"NEW_COMPONENTS","text":"New Components"}
],
"id":"CHOICE",
"relevantConditions":[{"id":"CALL_DRIVER","expression":"IN CALL_DRIVER"},
{"id":"AUTISM_QUESTIONS","expression":"IN AUTISM_M_CHAT_R" ,"formName":"formOne"},
{"id":"FULL_QUESTIONS_START","expression":"IN FULL_QUESTIONS" ,"formName":"full"}
{"id":"FULL_QUESTIONS_START","expression":"IN FULL_QUESTIONS" ,"formName":"full"},
{"id":"","expression":"IN NEW_COMPONENTS" ,"formName":"new_form"}
]
},{
"type": "QuestionStep",
Expand Down
19 changes: 13 additions & 6 deletions example/assets/full.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{


"full":
{
"steps":[
Expand Down Expand Up @@ -27,12 +28,14 @@
},{
"type": "QuestionStep",
"title":"Full Questions - Email",
"inputType":"email"
"inputType":"email",
"isOptional":true
},
{
"type": "QuestionStep",
"title":"Full Questions - Name",
"inputType":"name"
"inputType":"name",
"isOptional":true
},
{
"type": "QuestionStep",
Expand All @@ -42,22 +45,26 @@
{
"type": "QuestionStep",
"title":"Full Questions - Date",
"inputType":"date"
"inputType":"date",
"isOptional":true
},
{
"type": "QuestionStep",
"title":"Full Questions - DateTime",
"inputType":"dateTime"
"inputType":"dateTime",
"isOptional":true
},
{
"type": "QuestionStep",
"title":"Full Questions - Time",
"inputType":"time"
"inputType":"time",
"isOptional":true
},
{
"type": "QuestionStep",
"title":"Full Questions - Number",
"inputType":"number"
"inputType":"number",
"isOptional":true
},
{
"type": "QuestionStep",
Expand Down
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
41 changes: 41 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
8 changes: 2 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:formstack/formstack.dart';
Expand Down Expand Up @@ -58,10 +56,8 @@ class HomeScreen extends StatelessWidget {
trailing: const Icon(Icons.arrow_forward_ios_outlined),
onTap: () async {
FormStack.clearForms();
await FormStack.api().buildFormFromJson(await json
.decode(await rootBundle.loadString('assets/app.json')));
await FormStack.api().buildFormFromJson(await json
.decode(await rootBundle.loadString('assets/full.json')));
await FormStack.api()
.loadFromAssets(['assets/app.json', 'assets/full.json']);
// ignore: use_build_context_synchronously
Navigator.push(
context,
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#include "ephemeral/Flutter-Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
1 change: 1 addition & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
40 changes: 40 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
Loading

0 comments on commit 51cfbec

Please sign in to comment.