-
Notifications
You must be signed in to change notification settings - Fork 10
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 #97 from ishanvaghani/slider
feat: Added support for slider widget
- Loading branch information
Showing
13 changed files
with
1,022 additions
and
3 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,24 @@ | ||
{ | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "Mirai Slider" | ||
} | ||
}, | ||
"body": { | ||
"type": "form", | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"id": "example_slider", | ||
"type": "slider", | ||
"sliderType": "material", | ||
"value": 20, | ||
"max": 100, | ||
"divisions": 5 | ||
} | ||
} | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
packages/mirai/lib/src/parsers/mirai_slider/mirai_slider.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,38 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mirai/src/parsers/mirai_mouse_cursor/mirai_mouse_cursor.dart'; | ||
|
||
export 'package:mirai/src/parsers/mirai_slider/mirai_slider_parser.dart'; | ||
|
||
part 'mirai_slider.freezed.dart'; | ||
part 'mirai_slider.g.dart'; | ||
|
||
enum MiraiSliderType { adaptive, cupertino, material } | ||
|
||
@freezed | ||
class MiraiSlider with _$MiraiSlider { | ||
const factory MiraiSlider({ | ||
String? id, | ||
@Default(MiraiSliderType.material) MiraiSliderType sliderType, | ||
required double value, | ||
double? secondaryTrackValue, | ||
Map<String, dynamic>? onChanged, | ||
Map<String, dynamic>? onChangeStart, | ||
Map<String, dynamic>? onChangeEnd, | ||
@Default(0.0) double min, | ||
@Default(1.0) double max, | ||
int? divisions, | ||
String? label, | ||
String? activeColor, | ||
String? inactiveColor, | ||
String? secondaryActiveColor, | ||
String? thumbColor, | ||
String? overlayColor, | ||
MiraiMouseCursor? mouseCursor, | ||
@Default(false) bool autofocus, | ||
SliderInteraction? allowedInteraction, | ||
}) = _MiraiSlider; | ||
|
||
factory MiraiSlider.fromJson(Map<String, dynamic> json) => | ||
_$MiraiSliderFromJson(json); | ||
} |
Oops, something went wrong.