widgetbook 1.0.0-beta.1 widgetbook: ^1.0.0-beta.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';
class CustomWidget extends StatelessWidget {
const CustomWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.green,
child: const Text('hello world'),
);
}
}
class HotReload extends StatelessWidget {
const HotReload({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Widgetbook(
categories: [
WidgetbookCategory(
name: 'widgets',
widgets: [
WidgetbookWidget(
name: '$CustomWidget',
stories: [
WidgetbookUseCase(
name: 'Default',
builder: (context) => const CustomWidget(),
),
],
),
],
folders: [
WidgetbookFolder(
name: 'Texts',
widgets: [
WidgetbookWidget(
name: 'Normal Text',
stories: [
WidgetbookUseCase(
name: 'Default',
builder: (context) => const Text(
'The brown fox ...',
),
),
],
),
],
),
],
),
],
appInfo: AppInfo(
name: 'Widgetbook Example',
),
);
}
}
void main() {
runApp(const HotReload());
}