Add global WIDGETBOOK-INDEX.md and refactor use case method names for consistency across components
This commit is contained in:
parent
80ca8f665a
commit
f135a6a5f7
10 changed files with 49 additions and 19 deletions
|
|
@ -132,7 +132,7 @@ Clip _knobClipBehavior(BuildContext context, {Clip initial = Clip.none}) =>
|
|||
);
|
||||
|
||||
@UseCase(name: 'default', type: ButtonGroupM3E)
|
||||
Widget buildButtonGroupM3EUseCase(BuildContext context) {
|
||||
Widget buildButtonGroupM3EDefaultUseCase(BuildContext context) {
|
||||
final ButtonGroupM3EType type = _knobType(context);
|
||||
final ButtonGroupM3EShape shape = _knobShape(context);
|
||||
final ButtonGroupM3ESize size = _knobSize(context);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ Widget _buildDemo(
|
|||
}
|
||||
|
||||
@UseCase(name: 'default', type: ButtonM3E)
|
||||
Widget buildButtonM3EUseCase(BuildContext context) {
|
||||
Widget buildButtonM3EDefaultUseCase(BuildContext context) {
|
||||
// Default uses filled style; other params adjustable with knobs
|
||||
return _buildDemo(context, style: ButtonM3EStyle.filled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Widget _buildFab(
|
|||
}
|
||||
|
||||
@widgetbook.UseCase(name: 'default', type: FabM3E)
|
||||
Widget buildFabM3EUseCase(BuildContext context) {
|
||||
Widget buildFabM3EDefaultUseCase(BuildContext context) {
|
||||
return _buildFab(context, kind: FabM3EKind.primary);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart';
|
|||
// - Complex objects get meaningful defaults with TODOs.
|
||||
|
||||
@UseCase(name: 'default', type: IconButtonM3E)
|
||||
Widget buildIconButtonM3EUseCase(BuildContext context) {
|
||||
Widget buildIconButtonM3EDefaultUseCase(BuildContext context) {
|
||||
final bool isToggle = context.knobs.boolean(
|
||||
label: 'is toggle (provides selected state)',
|
||||
initialValue: true,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loading_indicator_m3e/loading_indicator_m3e.dart';
|
||||
import 'package:material_new_shapes/material_new_shapes.dart';
|
||||
|
|
@ -23,9 +21,17 @@ List<RoundedPolygon> _polygonSet(String id) {
|
|||
case 'cookie→oval':
|
||||
return [MaterialShapes.cookie9Sided, MaterialShapes.oval];
|
||||
case 'softBurst→pill→sunny':
|
||||
return [MaterialShapes.softBurst, MaterialShapes.pill, MaterialShapes.sunny];
|
||||
return [
|
||||
MaterialShapes.softBurst,
|
||||
MaterialShapes.pill,
|
||||
MaterialShapes.sunny
|
||||
];
|
||||
case 'triangle→square→pentagon':
|
||||
return [MaterialShapes.triangle, MaterialShapes.square, MaterialShapes.pentagon];
|
||||
return [
|
||||
MaterialShapes.triangle,
|
||||
MaterialShapes.square,
|
||||
MaterialShapes.pentagon
|
||||
];
|
||||
default:
|
||||
return [
|
||||
MaterialShapes.softBurst,
|
||||
|
|
@ -120,7 +126,9 @@ Widget buildExpressiveLoadingIndicatorColorAndSemanticsUseCase(
|
|||
);
|
||||
}
|
||||
|
||||
@UseCase(name: 'edge: invalid polygons (debug assert)', type: ExpressiveLoadingIndicator)
|
||||
@UseCase(
|
||||
name: 'edge: invalid polygons (debug assert)',
|
||||
type: ExpressiveLoadingIndicator)
|
||||
Widget buildExpressiveLoadingIndicatorInvalidPolygonsUseCase(
|
||||
BuildContext context) {
|
||||
final enableInvalid = context.knobs.boolean(
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ List<RoundedPolygon> _polygonSet(String id) {
|
|||
}
|
||||
|
||||
@UseCase(name: 'default', type: LoadingIndicatorM3E)
|
||||
Widget buildLoadingIndicatorM3EUseCase(BuildContext context) {
|
||||
Widget buildLoadingIndicatorM3EDefaultUseCase(BuildContext context) {
|
||||
// Keep defaults: tokens-based sizing and colors, subtle container.
|
||||
return const Center(
|
||||
child: LoadingIndicatorM3E(),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:navigation_rail_m3e/navigation_rail_m3e.dart';
|
||||
import 'package:widgetbook/widgetbook.dart';
|
||||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
|
||||
import 'package:navigation_rail_m3e/navigation_rail_m3e.dart';
|
||||
|
||||
// Note: RailBadgeM3E shows nothing when count is null; dot when 0; count otherwise.
|
||||
|
||||
@widgetbook.UseCase(name: 'default', type: RailBadgeM3E)
|
||||
Widget buildRailBadgeM3EUseCase(BuildContext context) {
|
||||
Widget buildRailBadgeM3EDefaultUseCase(BuildContext context) {
|
||||
final count = context.knobs.intOrNull.slider(
|
||||
label: 'count',
|
||||
initialValue: 7,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbar_m3e/toolbar_m3e.dart';
|
||||
import 'package:widgetbook/widgetbook.dart';
|
||||
import 'package:widgetbook_annotation/widgetbook_annotation.dart';
|
||||
import 'package:toolbar_m3e/toolbar_m3e.dart';
|
||||
|
||||
@UseCase(name: 'default', type: ToolbarIconButtonM3E)
|
||||
Widget buildToolbarIconButtonM3EDefaultUseCase(BuildContext context) {
|
||||
|
|
@ -51,7 +49,8 @@ Widget buildToolbarIconButtonM3EDestructiveUseCase(BuildContext context) {
|
|||
}
|
||||
|
||||
@UseCase(name: 'custom_color_and_size', type: ToolbarIconButtonM3E)
|
||||
Widget buildToolbarIconButtonM3ECustomStyleUseCase(BuildContext context) {
|
||||
Widget buildToolbarIconButtonM3ECustomColorAndSizeUseCase(
|
||||
BuildContext context) {
|
||||
final color = context.knobs.color(label: 'color', initialValue: Colors.teal);
|
||||
final iconSize = context.knobs.double.slider(
|
||||
label: 'iconSize',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue