moon_icons 0.1.1 copy "moon_icons: ^0.1.1" to clipboard
moon_icons: ^0.1.1 copied to clipboard

Moon Design System Icons. A collection of modern and beautifully crafted icons.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:moon_icons_demo/segment.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Moon Icons Demo",
      theme: ThemeData(),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    Map<String, Map<String, IconData>> segments = {};
    Map<String, Map<String, IconData>> lightSegments = {};
    Map<String, Map<String, IconData>> regularSegments = {};

    for (String key in iconsMap.keys) {
      // Extract the segment and type (like light or regular)
      List<String> parts = key.split('_');
      String segment = parts.first;
      String type = parts.last;

      if (type == "light") {
        if (!lightSegments.containsKey(segment)) {
          lightSegments[segment] = {};
        }
        lightSegments[segment]![key] = iconsMap[key]!;
      } else if (type == "regular") {
        if (!regularSegments.containsKey(segment)) {
          regularSegments[segment] = {};
        }
        regularSegments[segment]![key] = iconsMap[key]!;
      }
    }

    // Merging the "light" and "regular" segments in the desired order
    for (String segment in lightSegments.keys) {
      segments[segment] = lightSegments[segment]!;
    }
    for (String segment in regularSegments.keys) {
      if (!segments.containsKey(segment)) {
        segments[segment] = regularSegments[segment]!;
      } else {
        segments[segment]!.addAll(regularSegments[segment]!);
      }
    }

    return Scaffold(
      appBar: AppBar(
        title: Text("Moon Icons Demo"),
      ),
      body: CustomScrollView(
        slivers: segments.values.map((e) => Segment(segmentMap: e)).toList(),
      ),
    );
  }
}
4
likes
0
points
728
downloads

Publisher

verified publisheryolo.com

Weekly Downloads

Moon Design System Icons. A collection of modern and beautifully crafted icons.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on moon_icons