json_dynamic_widget_plugin_ionicons 3.0.1+6 copy "json_dynamic_widget_plugin_ionicons: ^3.0.1+6" to clipboard
json_dynamic_widget_plugin_ionicons: ^3.0.1+6 copied to clipboard

A plugin to the JSON Dynamic Widget to provide String name support for ionicons

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:ionicons_named/ionicons_named.dart';
import 'package:json_dynamic_widget/json_dynamic_widget.dart';
import 'package:json_dynamic_widget_plugin_ionicons/json_dynamic_widget_plugin_ionicons.dart';
import 'package:json_theme/json_theme_schemas.dart';
import 'package:logging/logging.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  Logger.root.onRecord.listen((record) {
    debugPrint('${record.level.name}: ${record.time}: ${record.message}');
    if (record.error != null) {
      debugPrint('${record.error}');
    }
    if (record.stackTrace != null) {
      debugPrint('${record.stackTrace}');
    }
  });

  final navigatorKey = GlobalKey<NavigatorState>();

  final registry = JsonWidgetRegistry.instance;
  JsonIoniconsPlugin.bind(registry);

  // There are thousands of icons so the schema validation takes forever in
  // debug mode.  Let's turn it off.
  SchemaValidator.enabled = false;

  registry.navigatorKey = navigatorKey;

  final data = JsonWidgetData.fromDynamic(
    json.decode(
      await rootBundle.loadString('assets/pages/ionicons.json'),
    ),
  )!;

  registry.setValue('icons', ionicons);

  runApp(
    MaterialApp(
      debugShowCheckedModeBanner: false,
      home: ExampleWidgetPage(
        data: data,
      ),
      theme: ThemeData.light(),
    ),
  );
}

class ExampleWidgetPage extends StatelessWidget {
  ExampleWidgetPage({
    Key? key,
    required this.data,
  }) : super(key: key);

  final JsonWidgetData data;

  @override
  Widget build(BuildContext context) => data.build(context: context);
}
3
likes
0
points
24
downloads

Publisher

verified publisherpeifferinnovations.com

Weekly Downloads

A plugin to the JSON Dynamic Widget to provide String name support for ionicons

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

child_builder, flutter, ionicons_named, json_class, json_dynamic_widget, json_theme, logging, meta, uuid

More

Packages that depend on json_dynamic_widget_plugin_ionicons