Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form Builder & Form Scope #213

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7f035af
Mirai FormBuilder and FormScope
DivyanshuBhargavaSecurrency Sep 20, 2023
b62120a
Added `MiraiNetworkResult` type in mirai/network_request to handle di…
i-asimkhan Sep 21, 2023
39689cd
Removed `signin` example for home screen json
i-asimkhan Sep 21, 2023
dcddc22
Merge pull request #211 from Securrency-OSS/asim/api-results
divyanshub024 Sep 21, 2023
082d3cf
Fix network-request model export in mirai/action_parsers
i-asimkhan Sep 21, 2023
d08db5d
Merge pull request #212 from Securrency-OSS/asim/form-builder/export-…
divyanshub024 Sep 21, 2023
442a783
fix: Remove "initialValue" passing into TextFormField as it's paased …
DivyanshuBhargavaSecurrency Sep 22, 2023
a0a7a03
Merge remote-tracking branch 'origin/dv/form-builder' into dv/form-bu…
DivyanshuBhargavaSecurrency Sep 22, 2023
2cc8471
Added export for action models and parsers in mirai/action_parsers
i-asimkhan Sep 22, 2023
0de6917
Removed repeated imports from framework/mirai.dart
i-asimkhan Sep 22, 2023
9676eb7
Converted request body<data> to dynamic type to handle `List` in apis…
i-asimkhan Sep 22, 2023
9e378d7
Merge pull request #214 from Securrency-OSS/asim/form-builder/export-…
divyanshub024 Sep 25, 2023
52708a2
merge: Branch `dv/form-builder` into `asim/form-builder/request-type`
i-asimkhan Sep 25, 2023
4c5b0e4
Merge pull request #216 from Securrency-OSS/asim/form-builder/request…
divyanshub024 Sep 25, 2023
56f400d
Exported `services` in mirai framework
i-asimkhan Sep 25, 2023
3693472
Merge pull request #218 from Securrency-OSS/asim/form-builder/export-…
divyanshub024 Sep 25, 2023
c3961dd
fixed body return in `mirai_network_service` in case of body other th…
i-asimkhan Sep 26, 2023
4ac1982
Added body type converted to MultipartFile in case of a file in the r…
i-asimkhan Sep 26, 2023
8cec41e
Merge pull request #219 from Securrency-OSS/asim/form-builder/form-re…
divyanshub024 Sep 26, 2023
b38ac87
Fixed form data return in json body builder in mirai_network_service
i-asimkhan Sep 26, 2023
2578f91
Refactored mirai network service and added future.wait in get body
i-asimkhan Sep 26, 2023
a52f734
Fixed load values from any action in json body construction in Mirai …
i-asimkhan Sep 27, 2023
e3f2d4d
Renamed values of `finalBody` to `callbackValue` in `netwrok_service`
i-asimkhan Sep 27, 2023
400b071
Updated Future.value from `onCallFromJson` type to dynamic in case if…
i-asimkhan Sep 27, 2023
72c8396
Added response check for value !=null in `network_request_parser`
i-asimkhan Sep 27, 2023
2fa4795
Merge pull request #220 from Securrency-OSS/asim/form-builder/form-re…
i-asimkhan Sep 27, 2023
8aa1a4a
Refactored update body json in `mirai_network_service` for deep into …
i-asimkhan Sep 27, 2023
86e5c39
Updated body from json in `mirai_network_service` to handle list of b…
i-asimkhan Sep 27, 2023
1db557d
Added default case for status-code not provided
i-asimkhan Sep 28, 2023
0ee5d7d
Updated response message and title in network_request_parser
i-asimkhan Oct 2, 2023
a327084
Merge pull request #221 from Securrency-OSS/asim/form-builder/updated…
divyanshub024 Oct 4, 2023
0feb06f
Add logs in MiraiNetworkRequestParser
DivyanshuBhargavaSecurrency Oct 4, 2023
c171974
Merge remote-tracking branch 'origin/dv/form-builder' into dv/form-bu…
DivyanshuBhargavaSecurrency Oct 4, 2023
998839f
refactor: Updated netowrk headers to be taken from the storage or any…
i-asimkhan Oct 9, 2023
5ec07a4
refactor: Updated `headers` type to dynamic from `map`
i-asimkhan Oct 9, 2023
8b00123
refactor: Updated webview.freezed and webview.generated files
i-asimkhan Oct 9, 2023
7583248
refactor: Network request headers type changed to map
i-asimkhan Oct 9, 2023
aae897b
refactor: Updated headers and content-type of dio options in dio init…
i-asimkhan Oct 10, 2023
8f74fb6
Merge branch 'main' into dv/form-builder
divyanshub024 Oct 13, 2023
5131ed9
Merge branch 'main' into dv/form-builder
divyanshub024 Oct 17, 2023
d927917
Merge pull request #225 from Securrency-OSS/asim/dv/form-builder
divyanshub024 Oct 19, 2023
486cf14
fix: Removed imports from `mirai.dart` and rebuilt packages
i-asimkhan Oct 23, 2023
0daccaf
fix: Built framework and example app to fix PR workflow failing (dart…
i-asimkhan Oct 25, 2023
5765701
Merge pull request #231 from Securrency-OSS/asim/form-builder-fix
divyanshub024 Nov 9, 2023
462d540
Merge branch 'main' into dv/form-builder
i-asimkhan Nov 28, 2023
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"brightness": "light",
"disabledColor": "#60FEF7FF",
"fontFamily": "Handjet",
i-asimkhan marked this conversation as resolved.
Show resolved Hide resolved
"colorScheme": {
"brightness": "light",
"primary": "#6750a4",
Expand Down
186 changes: 186 additions & 0 deletions examples/mirai_gallery/assets/json/sign_in_screen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"type": "scaffold",
i-asimkhan marked this conversation as resolved.
Show resolved Hide resolved
"resizeToAvoidBottomInset": false,
"appBar": {
"type": "appBar"
},
"body": {
"type": "padding",
"padding": {
"top": 24,
"bottom": 40,
"left": 24,
"right": 24
},
"child": {
"type": "form",
"child": {
"type": "column",
"crossAxisAlignment": "start",
"children": [
{
"type": "text",
"data": "Welcome Back!",
"style": {
"fontSize": 32,
"fontWeight": "w700"
}
},
{
"type": "sizedBox",
"height": 40
},
{
"id": "email",
"type": "textFormField",
"keyboardType": "emailAddress",
"textInputAction": "next",
"maxLines": 1,
"decoration": {
"hintText": "Email Address"
}
},
{
"type": "sizedBox",
"height": 16
},
{
"id": "password",
"type": "textFormField",
"keyboardType": "visiblePassword",
"textInputAction": "done",
"maxLines": 1,
"obscureText": true,
"decoration": {
"hintText": "Password",
"suffixIcon": {
"type": "icon",
"iconType": "cupertino",
"icon": "eye",
"size": 20
}
}
},
{
"type": "sizedBox",
"height": 8
},
{
"type": "row",
"mainAxisAlignment": "end",
"children": [
{
"type": "textButton",
"onPressed": {},
"child": {
"type": "text",
"data": "Forgot Password?",
"style": {
"fontSize": 14,
"fontWeight": "w500",
"color": "#80FFFFFF"
}
}
}
]
},
{
"type": "expanded",
"child": {
"type": "sizedBox",
"height": 24
}
},
{
"type": "elevatedButton",
"child": {
"type": "text",
"data": "Sign In"
},
"onPressed": {
"actionType": "networkRequest",
"url": "https://demo-identity.securrency.com/connect/token",
divyanshub024 marked this conversation as resolved.
Show resolved Hide resolved
"method": "post",
"contentType": "application/x-www-form-urlencoded",
"body": {
"username": {
"actionType": "getFormDataValue",
"id": "email"
},
"password": {
"actionType": "getFormDataValue",
"id": "password"
},
"client_id": "mobile",
"scope": "openid email roles profile identity.public identity.admin entity securrency.finance securrency.exchange securrency.ens",
"grant_type": "mobile"
},
"results": [
{
"statusCode": 200,
"action": {
"actionType": "navigate",
"navigationStyle": "pushReplacement",
"assetPath": "assets/json/user_profile_screen.json"
}
},
{
"statusCode": 400,
"action": {
"actionType": "showDialog",
"widget": {
"type": "alertDialog",
"titlePadding": {
"top": 8,
"left": 12,
"right": 12
},
"contentPadding": {
"top": 8,
"left": 12,
"right": 12
},
"title": {
"type": "text",
"data": "Failed to SignIn",
"align": "center",
"style": {
"fontSize": 21
}
},
"content": {
"type": "text",
"data": "Invalid username or password.",
"align": "center",
"style": {
"fontSize": 14
}
},
"actions": [
{
"type": "textButton",
"child": {
"type": "text",
"data": "OK"
},
"onPressed": {
"actionType": "navigate",
"navigationStyle": "pop"
}
},
{
"type": "sizedBox",
"width": 12
}
]
}
}
}
]
}
}
]
}
}
}
}
43 changes: 43 additions & 0 deletions examples/mirai_gallery/assets/json/user_profile_screen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"type": "scaffold",
"resizeToAvoidBottomInset": false,
"appBar": {
"type": "appBar",
"title": {
"type": "text",
"data": "Welcome!"
}
},
"body": {
"type": "column",
"crossAxisAlignment": "start",
"children": [
{
"type": "expanded",
"child": {
"type": "padding",
"padding": {
"top": 24,
"left": 24,
"right": 24,
"bottom": 24
},
"child": {
"type": "column",
"children": [
{
"type": "text",
"data": "You will see your profile details here.",
"textAlign": "center",
"style": {
"fontSize": 16,
"fontWeight": "w400"
}
}
]
}
}
}
]
}
}
42 changes: 21 additions & 21 deletions examples/mirai_gallery/lib/app/example/example_screen.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,30 @@ class _$ExampleScreenCopyWithImpl<$Res, $Val extends ExampleScreen>
}

/// @nodoc
abstract class _$$_ExampleScreenCopyWith<$Res>
abstract class _$$ExampleScreenImplCopyWith<$Res>
implements $ExampleScreenCopyWith<$Res> {
factory _$$_ExampleScreenCopyWith(
_$_ExampleScreen value, $Res Function(_$_ExampleScreen) then) =
__$$_ExampleScreenCopyWithImpl<$Res>;
factory _$$ExampleScreenImplCopyWith(
_$ExampleScreenImpl value, $Res Function(_$ExampleScreenImpl) then) =
__$$ExampleScreenImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String assetPath});
}

/// @nodoc
class __$$_ExampleScreenCopyWithImpl<$Res>
extends _$ExampleScreenCopyWithImpl<$Res, _$_ExampleScreen>
implements _$$_ExampleScreenCopyWith<$Res> {
__$$_ExampleScreenCopyWithImpl(
_$_ExampleScreen _value, $Res Function(_$_ExampleScreen) _then)
class __$$ExampleScreenImplCopyWithImpl<$Res>
extends _$ExampleScreenCopyWithImpl<$Res, _$ExampleScreenImpl>
implements _$$ExampleScreenImplCopyWith<$Res> {
__$$ExampleScreenImplCopyWithImpl(
_$ExampleScreenImpl _value, $Res Function(_$ExampleScreenImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
@override
$Res call({
Object? assetPath = null,
}) {
return _then(_$_ExampleScreen(
return _then(_$ExampleScreenImpl(
assetPath: null == assetPath
? _value.assetPath
: assetPath // ignore: cast_nullable_to_non_nullable
Expand All @@ -96,11 +96,11 @@ class __$$_ExampleScreenCopyWithImpl<$Res>

/// @nodoc
@JsonSerializable()
class _$_ExampleScreen implements _ExampleScreen {
const _$_ExampleScreen({required this.assetPath});
class _$ExampleScreenImpl implements _ExampleScreen {
const _$ExampleScreenImpl({required this.assetPath});

factory _$_ExampleScreen.fromJson(Map<String, dynamic> json) =>
_$$_ExampleScreenFromJson(json);
factory _$ExampleScreenImpl.fromJson(Map<String, dynamic> json) =>
_$$ExampleScreenImplFromJson(json);

@override
final String assetPath;
Expand All @@ -114,7 +114,7 @@ class _$_ExampleScreen implements _ExampleScreen {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_ExampleScreen &&
other is _$ExampleScreenImpl &&
(identical(other.assetPath, assetPath) ||
other.assetPath == assetPath));
}
Expand All @@ -126,28 +126,28 @@ class _$_ExampleScreen implements _ExampleScreen {
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$_ExampleScreenCopyWith<_$_ExampleScreen> get copyWith =>
__$$_ExampleScreenCopyWithImpl<_$_ExampleScreen>(this, _$identity);
_$$ExampleScreenImplCopyWith<_$ExampleScreenImpl> get copyWith =>
__$$ExampleScreenImplCopyWithImpl<_$ExampleScreenImpl>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_ExampleScreenToJson(
return _$$ExampleScreenImplToJson(
this,
);
}
}

abstract class _ExampleScreen implements ExampleScreen {
const factory _ExampleScreen({required final String assetPath}) =
_$_ExampleScreen;
_$ExampleScreenImpl;

factory _ExampleScreen.fromJson(Map<String, dynamic> json) =
_$_ExampleScreen.fromJson;
_$ExampleScreenImpl.fromJson;

@override
String get assetPath;
@override
@JsonKey(ignore: true)
_$$_ExampleScreenCopyWith<_$_ExampleScreen> get copyWith =>
_$$ExampleScreenImplCopyWith<_$ExampleScreenImpl> get copyWith =>
throw _privateConstructorUsedError;
}
6 changes: 3 additions & 3 deletions examples/mirai_gallery/lib/app/example/example_screen.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions examples/mirai_gallery/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import 'dart:io';

import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mirai/mirai.dart';
Expand All @@ -8,11 +12,18 @@ import 'package:mirai_gallery/app_theme/app_theme_cubit.dart';
import 'package:mirai_webview/mirai_webview.dart';

void main() async {
Dio dio = Dio();
(dio.httpClientAdapter as IOHttpClientAdapter).createHttpClient = () =>
HttpClient()
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;

await Mirai.initialize(
parsers: const [
ExampleScreenParser(),
MiraiWebViewParser(),
],
dio: dio,
);

runApp(const MyApp());
Expand Down
Loading