demoflu 1.0.0 copy "demoflu: ^1.0.0" to clipboard
demoflu: ^1.0.0 copied to clipboard

Package demo builder. Web application to display package widgets usage.

DemoFlu #

Package demo builder. Web application to display package widgets usage.

Tutorial #

main.dart #

Use the DemoFluApp configuring menu and examples.

import 'package:demoflu/demoflu.dart';
import 'package:flutter/material.dart';
import 'package:tutorial/examples/stateless.dart';

void main() {
  runApp(DemoFluApp(title: 'Tutorial', menuItems: [
    DemoMenuItem(name: 'Section'),
    DemoMenuItem(name: 'Stateless', example: StatelessExample(), indent: 2)
  ]));
}

Or formatted using cascade notation

  runApp(DemoFluApp(title: 'Tutorial', menuItems: _menuItems()));
List<DemoMenuItem> _menuItems() {
  var builder = DemoMenuItem.builder();
  builder
    ..indent(1)
    ..add('Section')
    ..indent(2)
    ..add('Stateless', example: StatelessExample());
  return builder.menuItems;
}

Examples #

Create examples using your package.

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

class StatelessExample extends Example {
  StatelessExample()
      : super(
            widget: const MainWidget(),
            codeFile: 'lib/examples/stateless.dart',
            resizable: true);
}

class MainWidget extends StatelessWidget {
  const MainWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.blue[200], child: const Center(child: Text('Stateless')));
  }
}

pubspec.yaml #

Configure the assets to make the source code available.

  assets:
    - lib/examples/

Build for web #

flutter build web --release

Use --base-href if necessary

Need more? #

See the committed example for more details.

9
likes
0
pub points
0%
popularity

Publisher

verified publishercaduandrade.net

Package demo builder. Web application to display package widgets usage.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flex_color_picker, flutter, flutter_highlight, url_launcher

More

Packages that depend on demoflu