widgetbook_generator 0.0.5 copy "widgetbook_generator: ^0.0.5" to clipboard
widgetbook_generator: ^0.0.5 copied to clipboard

outdated

A package to automate setup and maintanance of the widgetbook package by using code generation.

example/main.dart

import 'package:flutter/material.dart';
import 'package:widgetbook_annotation/widgetbook_annotation.dart';

@WidgetbookTheme.dark()
ThemeData darkTheme() => ThemeData.dark();

@WidgetbookStory(name: 'Default', type: CustomPadding)
Widget customPaddingStory(BuildContext context) {
  return Container(
    color: Colors.green,
    child: CustomPadding(
      widget: Text('Test'),
    ),
  );
}

class CustomPadding extends StatelessWidget {
  final Widget widget;
  const CustomPadding({
    Key? key,
    required this.widget,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(16),
      child: widget,
    );
  }
}

@WidgetbookApp(name: 'Example App')
class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: darkTheme(),
    );
  }
}
13
likes
0
pub points
90%
popularity

Publisher

verified publisherwidgetbook.io

A package to automate setup and maintanance of the widgetbook package by using code generation.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

analyzer, build, glob, source_gen, widgetbook_annotation, widgetbook_models

More

Packages that depend on widgetbook_generator