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

feat: Added support for MiraiStream for widgets inter-communication #164

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f02168f
Added basic structure for Form widget.
i-asimkhan Apr 10, 2023
81d8854
Added basic structure for `From` widget.
i-asimkhan Apr 11, 2023
52d2729
Added validation for From(context) in mirai form model.
i-asimkhan Apr 11, 2023
ea02a5b
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan Apr 11, 2023
49e8edd
Added state in the `Form` widget using bloc, which will handling user…
i-asimkhan Apr 13, 2023
9df3cd8
refactor: Renamed action type `validation` to `formValidation`
i-asimkhan Apr 13, 2023
0a8049d
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan Apr 19, 2023
39480e2
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan Apr 27, 2023
9356cd1
fix: Fixed validation in form example json
i-asimkhan Apr 28, 2023
95e685b
fix: Flutter format fix in mirai text form field file
i-asimkhan May 1, 2023
e52bb98
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan May 2, 2023
ccb2abc
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan May 10, 2023
62d99f9
Merge branch 'main' into `asim/mirai-form-widget`
i-asimkhan Jun 7, 2023
7c8acde
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan Jun 8, 2023
b00ab72
Merge branch 'main' into asim/mirai-form-widget
i-asimkhan Jul 5, 2023
33a2111
Fixed regex issue in input_validations to enable validations in form …
i-asimkhan Jul 5, 2023
bc42b37
Credit card number count validation added in form-example
i-asimkhan Jul 5, 2023
6c23061
Added mirai-stream for events trigger and listen
i-asimkhan Jul 11, 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
324 changes: 324 additions & 0 deletions examples/mirai_gallery/assets/json/form_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
{
"type": "scaffold",
"appBar": {
"type": "appBar",
"title": {
"type": "text",
"data": "Form"
}
},
"body": {
"type": "form",
"onBuild": {
"signal": {
"signalType": "listen",
"name": "submit"
}
},
"child": {
"type": "container",
"padding": {
"left": 12,
"right": 12,
"top": 12,
"bottom": 12
},
"child": {
"type": "scrollView",
"child": {
"type": "column",
"mainAxisAlignment": "center",
"crossAxisAlignment": "center",
"children": [
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "name",
"maxLines": 1,
"keyboardType": "text",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": false,
"decoration": {
"hintText": "What do people call you?",
"filled": true,
"icon": {
"type": "icon",
"iconType": "cupertino",
"icon": "person_solid",
"size": 24
},
"labelText": "Name*"
},
"inputFormatters": [
{
"type": "allow",
"rule": "[a-zA-Z]"
}
],
"validatorRules": [
{
"rule": "isName",
"message": "Enter a valid name"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "phone",
"maxLines": 1,
"keyboardType": "text",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": false,
"decoration": {
"hintText": "Where can we reach you?",
"filled": true,
"icon": {
"type": "icon",
"iconType": "cupertino",
"icon": "phone_solid",
"size": 24
},
"labelText": "Phone number*"
},
"inputFormatters": [
{
"type": "deny",
"rule": "[a-zA-Z]"
}
],
"validatorRules": [
{
"rule": "isNotEmpty",
"message": "Enter a valid phone number"
},
{
"rule": "(^(?:[+0]9)?[0-9]{10,12}$)",
"message": "Enter a valid phone number"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "email",
"maxLines": 1,
"keyboardType": "text",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": false,
"decoration": {
"hintText": "Your email address",
"filled": true,
"icon": {
"type": "icon",
"iconType": "material",
"icon": "email",
"size": 24
},
"labelText": "Email"
},
"validatorRules": [
{
"rule": "isEmail",
"message": "Enter a valid email address"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "card",
"maxLines": 1,
"keyboardType": "number",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": false,
"decoration": {
"hintText": "XXXX XXXX XXXX XXXX",
"filled": true,
"icon": {
"type": "icon",
"iconType": "material",
"icon": "credit_card",
"size": 24
},
"labelText": "Credit Card"
},
"validatorRules": [
{
"rule": "isNotEmpty",
"message": "Enter a valid card numbder"
},
{
"rule": "^[1-9]{15,16}$",
"message": "Enter a valid credit card number"
}
],
"inputFormatters": [
{
"type": "deny",
"rule": "[a-zA-Z]"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "password",
"maxLines": 1,
"keyboardType": "text",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": true,
"decoration": {
"filled": true,
"icon": {
"type": "icon",
"iconType": "material",
"icon": "password",
"size": 24
},
"suffixIcon": {
"type": "icon",
"iconType": "cupertino",
"icon": "eye",
"size": 24
},
"labelText": "Password*"
},
"validatorRules": [
{
"rule": "isPassword",
"message": "Enter a valid password"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 24
},
{
"type": "textFormField",
"key": "confirmPassword",
"maxLines": 1,
"keyboardType": "text",
"textInputAction": "done",
"textAlign": "start",
"textCapitalization": "none",
"textDirection": "ltr",
"textAlignVertical": "top",
"obscureText": true,
"decoration": {
"filled": true,
"icon": {
"type": "icon",
"iconType": "material",
"icon": "password",
"size": 24
},
"suffixIcon": {
"type": "icon",
"iconType": "cupertino",
"icon": "eye",
"size": 24
},
"labelText": "Re-type password*"
},
"validatorRules": [
{
"rule": "isPassword",
"message": "Enter a valid password"
}
],
"autovalidateMode": "onUserInteraction",
"readOnly": false,
"enabled": true
},
{
"type": "sizedBox",
"height": 32
},
{
"type": "elevatedButton",
"child": {
"type": "text",
"data": "Submit",
"style": {
"color": "#ffffff"
}
},
"style": {
"padding": {
"top": 8,
"left": 24,
"right": 24,
"bottom": 8
}
},
"onPressed": {
"signal": {
"signalType": "send",
"name": "submit"
}
},
"onBuild": {
"signal": {
"signalType": "listen",
"name": "enableDisableSubmit"
}
}
}
]
}
}
}
}
}
35 changes: 35 additions & 0 deletions examples/mirai_gallery/assets/json/home_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,41 @@
"assetPath": "assets/json/text_field_example.json"
}
}
},
{
"type": "listTile",
"leading": {
"type": "icon",
"iconType": "material",
"icon": "blur_circular_rounded"
},
"title": {
"type": "text",
"data": "Mirai Form",
"align": "center",
"style": {
"fontSize": 21
}
},
"subtitle": {
"type": "text",
"data": "A Form Widget",
"align": "center",
"style": {
"fontSize": 12
}
},
"isThreeLine": true,
"style": "list",
"onTap": {
"actionType": "navigate",
"navigationStyle": "push",
"navigationType": "screen",
"widgetJson": {
"type": "exampleScreen",
"assetPath": "assets/json/form_example.json"
}
}
}
]
}
Expand Down
Loading