widgetbook 2.4.1 widgetbook: ^2.4.1 copied to clipboard
A flutter storybook that helps professionals and teams to catalogue their widgets.
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
void main() {
runApp(const HotreloadWidgetbook());
}
class HotreloadWidgetbook extends StatelessWidget {
const HotreloadWidgetbook({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Widgetbook.material(
categories: [
WidgetbookCategory(
name: 'widgets',
widgets: [
WidgetbookComponent(
name: 'Button',
useCases: [
WidgetbookUseCase(
name: 'elevated',
builder: (context) => ElevatedButton(
onPressed: () {},
child: Text(
context.knobs
.number(
label: 'hello',
)
.toString(),
),
),
),
],
),
],
)
],
themes: [
WidgetbookTheme(
name: 'Light',
data: ThemeData.light(),
),
WidgetbookTheme(
name: 'Dark',
data: ThemeData.dark(),
),
],
appInfo: AppInfo(name: 'Example'),
);
}
}