json_dynamic_widget_plugin_ionicons

实时示例

简介

JSON Dynamic Widget 提供的插件,使用 ionicons 库作为基础,提供对 Ionicons 的命名支持。

使用插件

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
  JsonIoniconsPlugin.bind(registry);

  // ...
}

可以使用新的 ionicon 类型按名称引用图标,例如:

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

GitHub

查看 Github