Skip to content

peiffer-innovations/json_dynamic_widget_plugin_ionicons

Repository files navigation

Table of Contents

json_dynamic_widget_plugin_ionicons

Table of Contents

Live Example

Introduction

Plugin to the JSON Dynamic Widget to provide named support for Ionicons using the ionicons library as the base.

Using the Plugin

import 'package:json_dynamic_widget/json_dynamic_widget.dart';
import 'package:json_dynamic_widget_plugin_ionicons/json_dynamic_widget_plugin_ionicons.dart';


void main() {
  // Ensure Flutter's binding is complete
  WidgetsFlutterBinding.ensureInitialized();

  // ...

  // Get an instance of the registry
  var registry = JsonWidgetRegistry.instance;

  // Bind the plugin to the registry.  This is necessary for the registry to
  // find the widget provided by the plugin
  JsonIoniconsPluginRegistrar.registerDefaults(registry: registry);

  // ...
}

The icons can be referenced by name ising the new ionicon type such as:

{
  'type': 'ionicon',
  'args': {
    'icon': 'arrow_up'
  }
}