搜索插件、代码仓与 APP 分类

插件详情v10.0.0

flutter_helper_utils

Flutter Helper Utils 包提供了各种扩展和辅助方法,可使开发更加高效。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1300
喜欢数
48
Pub 分数
160

安装插件

flutter pub add flutter_helper_utils

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Flutter Helper Utils 包提供了一组扩展和实用方法,旨在简化 Flutter 开发。它通过提供便捷且可重用的函数来增强生产力,这些函数适用于常见的任务,如字符串操作、日期格式化和小部件工具。该包以简洁性为核心设计,可无缝集成到跨多个平台的现有项目中。其轻量级特性确保了对性能影响最小,同时最大化开发效率。非常适合希望减少样板代码并保持一致编码实践的团队。

适合场景

  • 简化字符串和日期操作
  • 减少重复的部件代码
  • 在项目间标准化实用函数
  • 加速UI开发
  • 提高代码可读性
  • 启用跨平台一致性

主要特点

  • 一组功能丰富的实用扩展
  • 跨平台兼容性
  • 最小性能开销
  • 通过 pub 实现轻松集成
  • 简洁、可读的 API 设计
  • 文档详尽的实用方法

适合对象

  • 初学者到高级的Flutter开发者
  • 寻求代码标准化的团队
  • 需要快速原型设计的项目
  • 希望减少样板代码的开发者
  • 面向多个平台的应用程序

使用建议

  • 如果包含未使用的功能,可能会引入依赖项膨胀
  • 需要仔细审查扩展范围
  • 不适合高度专业化的用例
  • 有限的自定义选项
  • 最好与其他工具配合使用
  • 依赖稳定的 Dart/Flutter 版本

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Helper Utils

flutter_helper_utils is a curated Flutter utility package focused on a few high-value areas:

  • adaptive UI and breakpoint helpers
  • color parsing, transformation, and accessibility utilities
  • typed list and sliver list widgets
  • focused BuildContext and UI extensions
  • dart_helper_utils re-exported for the Dart-only helpers that still fit the package surface
Flutter Helper Utils Logo

Version 9 intentionally makes the package smaller and more deliberate.

Documentation

Full documentation: https://omar-hanafy.github.io/flutter_helper_utils/

The site is built from site/ in this repository, so it ships with the package rather than trailing behind it.

AI coding-assistant support

This repository ships a package-specific agent plugin for Claude Code and OpenAI Codex (this is tooling for coding agents, not a runtime feature of the Flutter package). It teaches the agent the exact flutter_helper_utils APIs - breakpoint/adaptive-UI semantics, TypedListView contracts, color parsing and WCAG helpers, navigation and theme member names, the v8-to-v9 breaking migration, and version-aware upgrades.

Install in Claude Code:

/plugin marketplace add omar-hanafy/flutter_helper_utils
/plugin install flutter-helper-utils@flutter-helper-utils-tools

Install in OpenAI Codex (CLI; the IDE extension does not support plugins - use its $skill-installer there instead):

codex plugin marketplace add omar-hanafy/flutter_helper_utils
codex plugin add flutter-helper-utils@flutter-helper-utils-tools

Start a new agent session after installing so the skills load. Then try prompts like "make this screen adaptive with flutter_helper_utils breakpoints" or "migrate this app from flutter_helper_utils 8.x to 9.x", or invoke a skill explicitly in Claude Code, e.g. /flutter-helper-utils:use-flutter-helper-utils.

The plugin is installed from this Git repository (not from the pub.dev archive), contains markdown skills only - no hooks, no MCP servers, no telemetry - and its version tracks the package version. Details, the full capability list, updating, and uninstalling are in tooling/ai/flutter-helper-utils/README.md.

Install

dependencies:
  flutter_helper_utils: ^9.2.0

Imports

Most users should import the package once:

import 'package:flutter_helper_utils/flutter_helper_utils.dart';

If you only want the shortcut-heavy surface, use the opt-in sugar import:

import 'package:flutter_helper_utils/sugar.dart';

Notifiers

Notifier utilities were extracted from this package in v9.

If you need the old notifier-style workflows, use better_value_notifier

Highlights

Adaptive UI
runApp(
  const PlatformTypeProvider(
    child: MyApp(),
  ),
);

@override
Widget build(BuildContext context) {
  final breakpoint = context.watchBreakpoint;

  if (breakpoint.isMobile) {
    return const MobileLayout();
  }
  if (breakpoint.isTablet) {
    return const TabletLayout();
  }
  return const DesktopLayout();
}
PlatformEnv
final report = PlatformEnv.report();
final os = PlatformEnv.operatingSystem;
final locale = PlatformEnv.localeName;
final processors = PlatformEnv.numberOfProcessors;
Color Toolkit
final brand = tryToColor('#F97316') ?? Colors.orange;
final accent = tryToColor('rgb(14 165 233)') ?? Colors.blue;

final hex = brand.toHex(includeAlpha: true);
final readableText = brand.contrastColor();
final passesAA = brand.meetsWCAG(
  readableText,
  level: WCAGLevel.aa,
  context: WCAGContext.normalText,
);

Color parsing supports:

  • hex strings
  • rgb(...) and rgba(...)
  • hsl(...) and hsla(...)
  • hwb(...)
  • CSS named colors
Typed Lists
TypedListView<Product>(
  items: products,
  itemBuilder: (context, index, product) {
    return ProductTile(product: product);
  },
  spacing: 12,
  header: const Text('Products'),
);
CustomScrollView(
  slivers: [
    const SliverAppBar(title: Text('Products')),
    products.buildSliverList(
      itemBuilder: (context, index, product) {
        return ProductTile(product: product);
      },
      spacing: 12,
    ),
  ],
);
BuildContext and UI Helpers

Use context.popPage() for guarded back navigation and context.forcePopPage() when the current route should be removed directly.

context.pushPage(const DetailsPage());
await context.popPage();
context.showSnackBar(const SnackBar(content: Text('Saved')));
context.unfocus();

final theme = context.themeData;
final width = context.widthPx;
final height = context.heightPx;
Opt-in Sugar
final padding = 16.edgeInsetsAll;
final hSpace = 12.heightBox();
final radius = 24.allCircular;
final rawColor = 0xFFF97316.color;

0xFFF97316.color lives in sugar.dart, not in the main color toolkit.

Widgets

Included widgets and widget systems:

  • PlatformTypeProvider
  • PlatformInfoLayoutBuilder
  • BreakpointLayoutBuilder
  • TypedListView
  • TypedSliverList
  • GradientWidget
  • MultiTapDetector
  • ThemeWithoutEffects

Migration

Version 9 includes several breaking changes:

  • notifier utilities moved to better_value_notifier
  • deprecated Color.add* aliases removed
  • GradientWidget.gradientAlignment removed
  • explicit navigation naming finalized
  • focus helper naming finalized

For the full v9 migration guide, read migration_guides.md.

Example

The example app in example/ was rebuilt for v9 and acts as the current visual reference for the package surface.

License

MIT

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。