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

插件详情v1.2.7

flutter_helper_kit

flutter_helper_kit 帮助减少代码扩展和小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
286
喜欢数
33
Pub 分数
160

安装插件

flutter pub add flutter_helper_kit

插件介绍

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

flutter_helper_kit 是一个 Dart 扩展和 widget 增强包,旨在减少 Flutter 项目中的样板代码。它为常见数据类型提供实用扩展,并提供可重复使用的 widgets,以简化开发工作流程。通过提供简洁、直观的方法和组件,帮助开发者在多个平台上编写更清晰、更易维护的代码。该包支持 Android、iOS、Web、macOS、Windows 和 Linux,非常适合跨平台应用。其轻量级特性确保了最小的性能影响,同时最大化生产力。

适合场景

  • 快速创建用户界面组件
  • 减少重复代码
  • 跨平台开发
  • 简化数据类型操作
  • 提升开发人员的生产力
  • 简化状态管理工具

主要特点

  • 预构建的扩展方法
  • 可重用的 UI 小部件
  • 跨平台兼容性
  • 最小性能开销
  • 通过 pub 实现轻松集成
  • 干净、可读的代码输出

适合对象

  • Flutter 初学者寻求捷径
  • 经验丰富的开发人员优化工作流程
  • 致力于保持一致代码风格的团队
  • 需要快速原型设计的项目
  • 面向多个平台的应用程序

使用建议

  • 可能会略微增加包大小
  • 某些区域的文档有限
  • 最好与有条理的代码组织配合使用
  • 不适合高度专业化的用例
  • 需要了解 Dart 扩展

原始 README

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

flutter_helper_kit

A production-ready Flutter utility kit — extensions, widgets, animations, responsive sizing, and utils in one package with zero external dependencies (Flutter SDK only).

Consolidates helpers previously spread across custom_helper folders (Paydrop, WhereToNow, etc.) into a single maintainable package.

pub package

Platforms: Android · iOS · Web · macOS · Windows · Linux


Installation

dependencies:
  flutter_helper_kit: ^1.0.6
flutter pub add flutter_helper_kit
import 'package:flutter_helper_kit/flutter_helper_kit.dart';
Modular imports (smaller compile surface)
import 'package:flutter_helper_kit/flutter_helper_kit_extensions.dart';
import 'package:flutter_helper_kit/flutter_helper_kit_widgets.dart';
import 'package:flutter_helper_kit/flutter_helper_kit_animation.dart';
import 'package:flutter_helper_kit/flutter_helper_kit_responsive.dart';
import 'package:flutter_helper_kit/flutter_helper_kit_utils.dart';

Package structure

Every feature maps to a lib/ path. Use this table to find the right file.

Module Source path Key APIs
Extensions lib/extensions/ String, Color, DateTime, List, Map, Widget, Context, Alignment, Type conversion
Widgets lib/widgets/ AppButton, SliderButton, ReadMore, FlutterTag, Sharp corners, Pagination, etc.
Animation lib/animation/ 75+ animateWidget*, list animations, AnimatedGestureDetector
App Responsive lib/app_responsive/ ScreenUtilInit, .w, .h, .sp, .r, RPadding, RSizedBox
Reactive lib/reactive/ RxDateTime, RxnDateTime (ValueNotifier-based)
Utils lib/utils/ timeAgoCalculated, RandomImage, SystemUiUtils, MapCustomInfoWindow
Formatters lib/text_field/ NoLeadingSpaceFormatter, NoSpaceFormatter
Custom Painter lib/custom_painter/ GoogleLogoWidget

Full single import via flutter_helper_kit.dart.


Example app

Runnable demos for every module — each screen shows source file + API names.

cd example
flutter run

See example/README.md for catalog structure and how to add new demos.


Quick start

Responsive sizing (app_responsive/)
ScreenUtilInit(
  designSize: const Size(360, 690),
  builder: (_, child) => MaterialApp(home: child),
  child: Builder(
    builder: (context) => Container(
      width: 200.w,
      height: 80.h,
      child: Text('Hello', style: TextStyle(fontSize: 16.sp)),
    ),
  ),
);
API File
.w, .h, .sp, .r, .sw, .sh app_responsive/size_extension.dart
ScreenUtilInit app_responsive/screenutil_init.dart
RPadding, RSizedBox app_responsive/r_padding.dart, r_sized_box.dart
Widget animations (animation/)
Text('Hello')
  .animateWidgetElasticEntry()
  .animateWidgetGlassReveal();

// List item stagger
ListTile(title: Text('Item'))
  .animateListEntry(index: 0);

// Tap feedback
AnimatedGestureDetector(
  effectPreset: TapEffect.bounce,
  onTap: () {},
  child: Icon(Icons.favorite),
);
API File
animateWidget* (75+ methods) animation/widget_animation_extensions.dart
animateList* animation/list_item_animations.dart
AnimatedGestureDetector animation/animated_gesture_detector.dart
animateSheetReveal animation/animations_bottom_sheet.dart
Extensions
'edit_item'.toSnakeCase();           // string_case.dart
'user@mail.com'.isValidateEmail();  // validation.dart
1.50.toStringAsSmartRounded();       // smart_round_to_string.dart
Colors.blue.withColorOpacity(0.5);   // color_extension.dart
DateTime.now().timeAgo();            // date_extension.dart
'42'.toInt();                        // type_conversion.dart (on Object?)
context.showSnackBar(title: Text('Hi')); // build_context_extension.dart
Widgets
// Slider with shimmer label
SliderButton(
  width: 300,
  label: Text('Slide to confirm'),
  action: () async => true,
);

// Password strength meter
PasswordStrengthIndicator(textController: controller);

// Enhanced read-more with regex annotations
ReadMoreTextEnhanced(longText, trimLines: 3, annotations: [...]);

// iOS-style sheets (pass BuildContext)
AppCupertinoActionSheet.showActionSheet(
  context: context,
  actions: [ActionSheetItem(value: 'a', label: 'Option A')],
);

// Animated digit counter
UniversalDigitCounter(value: 12345, type: DigitAnimationType.simple);

// Ticket shape clipper
TicketClipper(
  clipper: PointedEdgeClipper(),
  child: Container(color: Colors.orange),
);

// Infinite scroll list
ListViewPagination(
  itemCount: items.length,
  hasNext: hasMore,
  nextData: fetchMore,
  itemBuilder: (_, i) => ListTile(title: Text(items[i])),
);
Widget File
AppButton widgets/app_button.dart
SliderButton widgets/slider_button.dart
PasswordStrengthIndicator widgets/password_strength_indicator/
ReadMoreText / ReadMoreTextEnhanced widgets/read_more_text.dart, read_more_enhanced.dart
FlutterTag widgets/flutter_tag/
SharpBorderRadius, SharpClipRect widgets/sharp_corners/
ListViewPagination widgets/list_view_pagination.dart
CenterTextDivider, CustomBanner widgets/center_text_divider.dart, custom_banner.dart
AvatarGlow, OutlineGlow widgets/avatar_glow/
TicketClipper widgets/ticket_clippers/
UniversalDigitCounter widgets/rolling_digit/
Reactive datetime (reactive/)
final rx = RxDateTime.now();
rx.addDuration(const Duration(hours: 1));
print(rx.format('yyyy-MM-dd'));
print(rx.timeAgo());

No GetX required — built on ValueNotifier<DateTime>.

Utils
timeAgoCalculated(DateTime.now().subtract(Duration(minutes: 5)));
RandomImage.picsumImage(300, 200);
RandomPicsumImage.image(width: 400, height: 300);
SystemUiUtils.setStatusBarColor(Colors.deepPurple);
Util File
timeAgoCalculated utils/ago_time.dart
RandomImage utils/random_image.dart
RandomPicsumImage utils/random_picsum_image.dart
SystemUiUtils utils/system_ui_utils.dart
MapCustomInfoWindow utils/map_custom_info_window.dart
showDialogWithCloseIcon utils/close_icon_show_dialog.dart
Validator utils/password_validator.dart
Numeral utils/numberal_utils.dart
Map info window (callback adapter)

No google_maps_flutter dependency in this package. Use CallbackMapInfoWindowAdapter:

final adapter = CallbackMapInfoWindowAdapter(
  onGetScreenCoordinate: (latLng) async {
    final coord = await googleMapController.getScreenCoordinate(
      LatLng(latLng.latitude, latLng.longitude),
    );
    return MapScreenCoordinate(coord.x, coord.y);
  },
);
controller.mapAdapter = adapter;
Text field formatters
TextField(
  inputFormatters: [
    NoLeadingSpaceFormatter(),
    NoSpaceFormatter(),
  ],
);

Extensions reference

String — extensions/string/
  • string_extension.dart — isEmptyOrNull, capitalize, reversed, parsing helpers
  • string_case.dart — toSnakeCase, toCamelCase, toPascalCase, toKebabCase, toTitleCase
  • validation.dart — isValidateEmail, validatePhone, extractPhoneNumber, URL/password checks
Color — extensions/color/color_extension.dart
  • toHex, createMaterialColor, lighten, darken, withColorOpacity, isDark, isLight
DateTime — extensions/date/
  • date_extension.dart — timeAgo, isToday, isYesterday, timezone helpers
  • date_format.dart — format(pattern:), formatTime()
List / Map / Set / Iterable — extensions/list/, map/, set/
  • firstOrNull, lastWhereOrNull, separatorEvery, getOrDefault, validate
Number — extensions/number/
  • integer_extension.dart, double_extension.dart, number_extension.dart
  • smart_round_to_string.dart — toStringAsSmartRounded()
  • height(), width(), circularBorderRadius spacing helpers
Widget / Context — extensions/widget/, context/
  • paddingAll, withSize, visible, expanded, centered
  • width, height, showSnackBar, theme, platform checks
Other
  • alignment/alignment_extensions.dart — isTop, isBottom, isLeft, isRight
  • type_conversion.dart — toInt, toDouble, toBool, toStr on Object?
  • bool/bool_extensions.dart — validate, toggle, toInt
  • duration/duration_extensions.dart — .delay
  • function/scope_functions_extension.dart — let, also, run, takeIf
  • random/random_extension.dart — random helpers on math.Random

Widgets reference

UI & feedback
Widget File Description
FlutterToast flutter_toast.dart Toast messages
CustomIndicator custom_indicator.dart Loading overlay
UnFocusable hide_keyboard.dart Dismiss keyboard on outside tap
DoublePressBackWidget double_press_back_widget.dart Press back twice to exit
TapSafeGesture tap_safe_gesture.dart Debounced async tap
TextShimmer, ProfileShimmer, … simmer.dart Shimmer placeholders
Layout & display
Widget File
Space, SliverSpace space/space.dart, sliver_space.dart
SeparatedColumn separated_column.dart
FlutterListView flutter_list_view.dart
DashDivider dash_divider.dart
DottedBorderWidget dotted_border_widget.dart
GradientText gradient_text.dart
Marquee marquee_widget.dart
TextAvatar, TextIcon text_avatar.dart, text_icon_widget.dart
WidgetHelper widget_helper.dart
Forms & input
Widget File
RoundedCheckBox rounded_checkbox_widget.dart
RatingBarWidget rating_bar_widget.dart
TimerBuilder timer_builder.dart

Typedefs

Callback types in utils/type_def.dart:

FutureVoidCallback, StringCallback, IntArgVoidCallback, DoubleCallback, and more.


Migration from custom_helper

Before After
import '.../custom_helper.dart' import 'package:flutter_helper_kit/flutter_helper_kit.dart'
Get.context in Cupertino dialogs Pass context: parameter
Rx<DateTime> (GetX) RxDateTime / RxnDateTime
Google Maps LatLng in info window MapLatLng + MapInfoWindowAdapter

Screenshots

Flutter Toast
Flutter Toast
Tap Safe Gesture
Tap Safe Gesture
Avatar Glow
Avatar Glow
Outline Avatar Glow
Outline Avatar Glow
Avatar Glow MultiColor
Avatar Glow MultiColor
Outline Avatar Glow MultiColor
Outline Avatar Glow MultiColor
App Button
App Button
Marquee
Marquee
RatingBar
RatingBar
Read More Text
Read More Text
Rounded Check Box
Rounded Check Box
Text Icon
Text Icon
showDialogWithCloseIcon
showDialogWithCloseIcon
Sharp Borders
Sharp Borders
Flutter Tag
Flutter Tag

Contributing

  • Issues & features: GitHub Issues
  • New widget/API: add under lib/, export in flutter_helper_kit.dart, register demo in example/lib/catalog/example_catalog.dart
  • Contact: sachin4kmt@gmail.com

If this package helps your project, consider giving it a star on GitHub.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。