dynamic_component 0.2.1+1 copy "dynamic_component: ^0.2.1+1" to clipboard
dynamic_component: ^0.2.1+1 copied to clipboard

Build your Dynamic components that support simple logic and variable.

Build your Dynamic components that support simple logic and variable

Features #

  • Dynamic variable
  • Dynamic UI
  • UI Logic
    • If
    • Tap Event (Multiple)
    • When
  • codegen

Getting started #

dependencies:
  dynamic_component: any

dev_dependencies:
  # option
  dynamic_component_codegen: any

Usage #

Create your widget extends DynamicComponent #

Example code: example/lib/widget/my_list_item.dart

import 'package:dynamic_component/dynamic_component.dart';
import 'package:dynamic_component/dynamic_component_anotation.dart';
import 'package:example/widget/image_widget.dart';

part 'move_item.g.dart';

@Component(variables: [
  'movie_name',
  'movie_image',
])
class MovieItem extends DynamicComponent with _$MovieItemComponent {
  MovieItem({
    Map<String, dynamic>? data,
    Key? key,
  }) : super(data: data, key: key);

  @override
  Widget buildWidget(BuildContext context) {
    return Column(
      children: [
        Text(movieName),  // genarated,read from data['movie_name']
        ImageWidget(url: movieImage), // data['movie_image']
      ],
    );
  }

  @override
  DSLInfo? get dslInfo => null;
}

run flutter pub run build_runner build in your terminal

Export json #

Example code: example/test/export_all_widget_test.dart

MovieItem(data: _movieItemDataForExport).exportJson(context);
2
likes
130
pub points
0%
popularity

Publisher

unverified uploader

Build your Dynamic components that support simple logic and variable.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

dynamic_widget, flutter

More

Packages that depend on dynamic_component