-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
405a068
commit 5761102
Showing
11 changed files
with
705 additions
and
23 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,42 @@ | ||
import 'package:demo/helpers/use_case_state.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:remix/remix.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
final _key = GlobalKey(); | ||
|
||
@widgetbook.UseCase( | ||
name: 'Slider Component', | ||
type: Slider, | ||
) | ||
Widget buildButtonUseCase(BuildContext context) { | ||
final knobState = WidgetbookState.of(context); | ||
return KeyedSubtree( | ||
key: _key, | ||
child: Scaffold( | ||
body: Center( | ||
child: SizedBox( | ||
width: 200, | ||
child: Slider( | ||
onChanged: (value) => knobState.updateKnob('value', value), | ||
disabled: context.knobs.boolean( | ||
label: 'disabled', | ||
initialValue: false, | ||
), | ||
divisions: context.knobs.int.input( | ||
label: 'divisions', | ||
initialValue: 0, | ||
), | ||
value: context.knobs.double.slider( | ||
label: 'value', | ||
min: 0, | ||
max: 1, | ||
initialValue: 0.25, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} |
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
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,43 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:mix/mix.dart'; | ||
import 'package:mix_annotations/mix_annotations.dart'; | ||
|
||
import '../../theme/remix_theme.dart'; | ||
import '../../theme/remix_tokens.dart'; | ||
|
||
part 'slider.g.dart'; | ||
part 'slider_style.dart'; | ||
part 'slider_theme.dart'; | ||
part 'slider_widget.dart'; | ||
|
||
@MixableSpec() | ||
class SliderSpec extends Spec<SliderSpec> with _$SliderSpec, Diagnosticable { | ||
final BoxSpec thumb; | ||
final BoxSpec track; | ||
final BoxSpec activeTrack; | ||
final BoxSpec division; | ||
|
||
/// {@macro button_spec_of} | ||
static const of = _$SliderSpec.of; | ||
|
||
static const from = _$SliderSpec.from; | ||
|
||
SliderSpec({ | ||
BoxSpec? thumb, | ||
BoxSpec? track, | ||
BoxSpec? activeTrack, | ||
BoxSpec? division, | ||
super.modifiers, | ||
super.animated, | ||
}) : thumb = thumb ?? const BoxSpec(), | ||
track = track ?? const BoxSpec(), | ||
activeTrack = activeTrack ?? const BoxSpec(), | ||
division = division ?? const BoxSpec(); | ||
|
||
@override | ||
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
super.debugFillProperties(properties); | ||
_debugFillProperties(properties); | ||
} | ||
} |
Oops, something went wrong.