Skip to main content

fmtui 0.1.3 copy "fmtui: ^0.1.3" to clipboard
fmtui: ^0.1.3 copied to clipboard

A modern and customizable Flutter UI component library for building consistent applications.

example/lib/main.dart

import 'package:example/core/storage/shared_storage.dart';
import 'package:example/core/theme/showcase_colors.dart';
import 'package:example/showcase/home/component_showcase_page.dart';
import 'package:example/showcase/widgets/theme_controller.dart';
import 'package:flutter/material.dart';
import 'package:fmtui/fmtui.dart';
import 'package:get/get.dart';
import 'package:syntax_highlight/syntax_highlight.dart';

late final Highlighter dartLightHighlighter;
late final Highlighter dartDarkHighlighter;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final sharedStorage = await SharedStorage.init();
  Get.put(ThemeController(storage: sharedStorage), permanent: true);

  // Initialize supported languages.
  await Highlighter.initialize(['dart']);

  // initialize IconResolver for local assets
  await IconResolver.init(assetPrefix: 'assets/icons/');
  final bhim = IconResolver.resolve('bhim');

  debugPrint('BHIM assetPath: ${bhim.assetPath}');
  debugPrint('BHIM iconifyIcon: ${bhim.iconifyIcon}');

  // Load syntax highlighting themes.
  final lightTheme = await HighlighterTheme.loadLightTheme();
  final darkTheme = await HighlighterTheme.loadDarkTheme();

  // Create Dart highlighters.
  dartLightHighlighter = Highlighter(language: 'dart', theme: lightTheme);

  dartDarkHighlighter = Highlighter(language: 'dart', theme: darkTheme);

  runApp(const FmtUIExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    final themeController = Get.find<ThemeController>();
    return Obx(() {
      return MaterialApp(
        title: 'FMTUI Showcase',
        debugShowCheckedModeBanner: false,
        darkTheme: FmtTheme.light(
          colors: ShowcaseColors.light(),
          typography: FmtTypography.light().copyWith(
            fontFamily: "Inter",
            fontFamilyFallback: const ['Roboto', 'sans-serif'],
          ),
        ),
        theme: FmtTheme.dark(
          colors: ShowcaseColors.dark(),
          typography: FmtTypography.dark().copyWith(
            fontFamily: "Inter",
            fontFamilyFallback: const ['Roboto', 'sans-serif'],
          ),
        ),
        themeMode: themeController.themeMode,
        home: const ComponentShowcasePage(),
      );
    });
  }
}
0
likes
120
points
193
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A modern and customizable Flutter UI component library for building consistent applications.

Repository (GitHub)
View/report issues

Topics

#flutter #ui #widget #design-system #components

License

MIT (license)

Dependencies

br_ingredientes_icons, equatable, flutter, iconify_flutter, intl, material_symbols_icons, phosphor_flutter, url_launcher

More

Packages that depend on fmtui