-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from ishanvaghani/radio_button
feat: Added support for radio widget
- Loading branch information
Showing
16 changed files
with
1,552 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "Mirai Radio" | ||
} | ||
}, | ||
"body": { | ||
"type": "form", | ||
"child": { | ||
"type": "radioGroup", | ||
"child": { | ||
"type": "column", | ||
"children": [ | ||
{ | ||
"type": "listTile", | ||
"leading": { | ||
"type": "radio", | ||
"radioType": "adaptive", | ||
"value": "1", | ||
"groupValue": "1" | ||
}, | ||
"title": { | ||
"type": "text", | ||
"data": "Male", | ||
"align": "center", | ||
"style": { | ||
"fontSize": 21 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "listTile", | ||
"leading": { | ||
"type": "radio", | ||
"radioType": "adaptive", | ||
"value": "2", | ||
"groupValue": "1" | ||
}, | ||
"title": { | ||
"type": "text", | ||
"data": "Female", | ||
"align": "center", | ||
"style": { | ||
"fontSize": 21 | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "listTile", | ||
"leading": { | ||
"type": "radio", | ||
"radioType": "adaptive", | ||
"value": "3", | ||
"groupValue": "1" | ||
}, | ||
"title": { | ||
"type": "text", | ||
"data": "Other", | ||
"align": "center", | ||
"style": { | ||
"fontSize": 21 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
packages/mirai/lib/src/parsers/mirai_mouse_cursor/mirai_mouse_cursor.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import 'package:flutter/services.dart'; | ||
|
||
enum MiraiMouseCursor { | ||
none, | ||
basic, | ||
click, | ||
forbidden, | ||
wait, | ||
progress, | ||
contextMenu, | ||
help, | ||
text, | ||
verticalText, | ||
cell, | ||
precise, | ||
move, | ||
grab, | ||
grabbing, | ||
noDrop, | ||
alias, | ||
copy, | ||
disappearing, | ||
allScroll, | ||
resizeLeftRight, | ||
resizeUpDown, | ||
resizeUpLeftDownRight, | ||
resizeUpRightDownLeft, | ||
resizeUp, | ||
resizeDown, | ||
resizeLeft, | ||
resizeRight, | ||
resizeUpLeft, | ||
resizeUpRight, | ||
resizeDownLeft, | ||
resizeDownRight, | ||
resizeColumn, | ||
resizeRow, | ||
zoomIn, | ||
zoomOut; | ||
|
||
SystemMouseCursor get value { | ||
switch (this) { | ||
case MiraiMouseCursor.none: | ||
return SystemMouseCursors.none; | ||
case MiraiMouseCursor.basic: | ||
return SystemMouseCursors.basic; | ||
case MiraiMouseCursor.click: | ||
return SystemMouseCursors.click; | ||
case MiraiMouseCursor.forbidden: | ||
return SystemMouseCursors.forbidden; | ||
case MiraiMouseCursor.wait: | ||
return SystemMouseCursors.wait; | ||
case MiraiMouseCursor.progress: | ||
return SystemMouseCursors.progress; | ||
case MiraiMouseCursor.contextMenu: | ||
return SystemMouseCursors.contextMenu; | ||
case MiraiMouseCursor.help: | ||
return SystemMouseCursors.help; | ||
case MiraiMouseCursor.text: | ||
return SystemMouseCursors.text; | ||
case MiraiMouseCursor.verticalText: | ||
return SystemMouseCursors.verticalText; | ||
case MiraiMouseCursor.cell: | ||
return SystemMouseCursors.cell; | ||
case MiraiMouseCursor.precise: | ||
return SystemMouseCursors.precise; | ||
case MiraiMouseCursor.move: | ||
return SystemMouseCursors.move; | ||
case MiraiMouseCursor.grab: | ||
return SystemMouseCursors.grab; | ||
case MiraiMouseCursor.grabbing: | ||
return SystemMouseCursors.grabbing; | ||
case MiraiMouseCursor.noDrop: | ||
return SystemMouseCursors.noDrop; | ||
case MiraiMouseCursor.alias: | ||
return SystemMouseCursors.alias; | ||
case MiraiMouseCursor.copy: | ||
return SystemMouseCursors.copy; | ||
case MiraiMouseCursor.disappearing: | ||
return SystemMouseCursors.disappearing; | ||
case MiraiMouseCursor.allScroll: | ||
return SystemMouseCursors.allScroll; | ||
case MiraiMouseCursor.resizeLeftRight: | ||
return SystemMouseCursors.resizeLeftRight; | ||
case MiraiMouseCursor.resizeUpDown: | ||
return SystemMouseCursors.resizeUpDown; | ||
case MiraiMouseCursor.resizeUpLeftDownRight: | ||
return SystemMouseCursors.resizeUpLeftDownRight; | ||
case MiraiMouseCursor.resizeUpRightDownLeft: | ||
return SystemMouseCursors.resizeUpRightDownLeft; | ||
case MiraiMouseCursor.resizeUp: | ||
return SystemMouseCursors.resizeUp; | ||
case MiraiMouseCursor.resizeDown: | ||
return SystemMouseCursors.resizeDown; | ||
case MiraiMouseCursor.resizeLeft: | ||
return SystemMouseCursors.resizeLeft; | ||
case MiraiMouseCursor.resizeRight: | ||
return SystemMouseCursors.resizeRight; | ||
case MiraiMouseCursor.resizeUpLeft: | ||
return SystemMouseCursors.resizeUpLeft; | ||
case MiraiMouseCursor.resizeUpRight: | ||
return SystemMouseCursors.resizeUpRight; | ||
case MiraiMouseCursor.resizeDownLeft: | ||
return SystemMouseCursors.resizeDownLeft; | ||
case MiraiMouseCursor.resizeDownRight: | ||
return SystemMouseCursors.resizeDownRight; | ||
case MiraiMouseCursor.resizeColumn: | ||
return SystemMouseCursors.resizeColumn; | ||
case MiraiMouseCursor.resizeRow: | ||
return SystemMouseCursors.resizeRow; | ||
case MiraiMouseCursor.zoomIn: | ||
return SystemMouseCursors.zoomIn; | ||
case MiraiMouseCursor.zoomOut: | ||
return SystemMouseCursors.zoomOut; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/mirai/lib/src/parsers/mirai_radio/mirai_radio.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mirai/mirai.dart'; | ||
import 'package:mirai/src/parsers/mirai_mouse_cursor/mirai_mouse_cursor.dart'; | ||
|
||
export 'package:mirai/src/parsers/mirai_radio/mirai_radio_parser.dart'; | ||
|
||
part 'mirai_radio.freezed.dart'; | ||
part 'mirai_radio.g.dart'; | ||
|
||
enum MiraiRadioType { adaptive, cupertino, material } | ||
|
||
@freezed | ||
class MiraiRadio with _$MiraiRadio { | ||
const factory MiraiRadio({ | ||
@Default(MiraiRadioType.material) MiraiRadioType radioType, | ||
dynamic value, | ||
Map<String, dynamic>? onChanged, | ||
MiraiMouseCursor? mouseCursor, | ||
@Default(false) bool toggleable, | ||
String? activeColor, | ||
String? inactiveColor, | ||
String? fillColor, | ||
String? focusColor, | ||
String? hoverColor, | ||
String? overlayColor, | ||
double? splashRadius, | ||
MaterialTapTargetSize? materialTapTargetSize, | ||
MiraiVisualDensity? visualDensity, | ||
@Default(false) bool autofocus, | ||
@Default(false) bool useCheckmarkStyle, | ||
@Default(false) bool useCupertinoCheckmarkStyle, | ||
}) = _MiraiRadio; | ||
|
||
factory MiraiRadio.fromJson(Map<String, dynamic> json) => | ||
_$MiraiRadioFromJson(json); | ||
} |
Oops, something went wrong.