hux 0.14.0
hux: ^0.14.0 copied to clipboard
An open-source state of the art UI library for Flutter
#
A modern Flutter UI package with beautiful, customizable components designed for clean and consistent user interfaces.
Latest Version: 0.14.0 #
What's New in v0.14.0:
- Material 3 Seed Color Support: Customize your entire app's primary color with one line
- Use
HuxTheme.lightTheme.copyWith(colorScheme: ColorScheme.fromSeed(seedColor: Colors.pink))
- All Hux components automatically adapt to your custom seed color
- 100% backward compatible - no breaking changes
- Use
What's New in v0.13.0:
- New HuxSidebar Component: Complete navigation sidebar for app-wide navigation
HuxSidebar
- Main sidebar container with header and footer supportHuxSidebarItem
- Individual navigation items with selection state- Automatic selection state management
- Customizable width and padding
- Theme-aware styling with hover states
- Full documentation and integration examples
- New HuxCommand Component: Command palette for quick access to actions and navigation
- Keyboard shortcuts support (CMD+K on Mac, Ctrl+K on Windows/Linux)
- Real-time search and filtering as you type
- Keyboard navigation with arrow keys and Enter to execute
- Customizable commands with icons, shortcuts, and categories
- Modern design with 16px border radius and proper hover states
- Global keyboard shortcuts integration with
HuxCommandShortcuts.wrapper
- Apple symbol shortcuts (⌘, ⇧, ⌥, ⌃)
- Comprehensive documentation and examples
- Enhanced HuxSnackbar: Modern glassmorphism design with backdrop blur effects
- Fixed 400px width positioned at bottom-left
- Theme-adaptive blur intensity (5px light, 10px dark)
- Improved visual hierarchy with border and shadow
- Better contrast and readability
- New
surfaceOverlay
design token for consistent overlay styling
- Example App Improvements: Complete refactor with 564 fewer lines
- Cleaner code organization and structure
- Better component demonstrations
- Improved navigation with new sidebar
- Enhanced user experience
- Icon Library Migration: Complete transition from Feather Icons to Lucide Icons
- Updated all components to use
LucideIcons
instead ofFeatherIcons
- Added
lucide_icons: ^0.257.0
dependency - Maintained backward compatibility with existing icon usage patterns
- Updated all components to use
- Design Token Improvements: Enhanced
HuxTokens
for better visual hierarchy- New
surfaceOverlay
token for overlays and snackbars - Updated
surfaceElevated
to be 100% opaque for better accessibility - Fixed
borderSecondary
to use proper subtle color for better visual separation
- New
Features #
- Modern Design - Clean, minimal design language
- Dark Mode Support - Built-in light and dark theme support
- Data Visualization - Beautiful animated charts for data presentation
- Responsive - Components adapt to different screen sizes
- Customizable - Extensive customization options
- Easy to Use - Simple, intuitive API
Components #
Buttons #
HuxButton
- Customizable button with multiple variants (primary, secondary, outline, ghost)- Multiple sizes (small, medium, large)
- Loading states and icon support
Cards #
HuxCard
- Flexible card component with optional header, title, and actions- Customizable padding, margin, and border radius
- Tap handling support
Inputs #
HuxInput
- Enhanced text input with consistent styling (renamed from HuxTextField)HuxDateInput
- Date input with automatic formatting and integrated calendar picker
HuxCheckbox
- Interactive checkbox with custom styling and labels- Label, helper text, and error state support
- Multiple sizes and validation
HuxRadio
- Radio button controls for single selection from groups- Support for different value types
- Consistent sizing and theme adaptation
Dialogs #
HuxDialog
- General-purpose dialog with modern design and multiple size variants- Built-in close button with ghost styling and precise positioning
- Support for title, subtitle, content, and action buttons
- Consistent Hux design system integration
Date & Time Pickers #
showHuxDatePickerDialog
- Modern date picker with month/year selectionshowHuxTimePickerDialog
- Clean time picker with hour/minute dropdowns- Theme-aware styling with Hux design tokens
- Responsive calendar grid and smart navigation
Widgets #
HuxLoading
- Customizable loading indicatorsHuxLoadingOverlay
- Full-screen loading overlay
HuxChart
- Beautiful data visualization with line and bar charts
Context Menu #
HuxContextMenu
- Right-click context menus with smart positioningHuxContextMenuItem
- Individual menu items with icons and statesHuxContextMenuDivider
- Visual separators for menu groups- Cross-platform support with proper web context menu handling
Right-click the example app components to see context menus in action!
Switch #
HuxSwitch
- Toggle switch with smooth animations between on/off states
Tooltip #
HuxTooltip
- Contextual help and information with optional icon support- Automatic light/dark theme adaptation
- Customizable positioning, colors, and timing
- Support for any icon library (Material Icons, Lucide, Feather, etc.)
Feedback & Status #
HuxBadge
- Status indicators and notification counters with semantic variants
HuxSnackbar
- Temporary notification messages with semantic variants (previously HuxAlert)
Avatar #
HuxAvatar
- Circular user images with initials fallback, custom colors, and beautiful gradient variantsHuxAvatarGroup
- Display multiple avatars with overlapping or spaced layouts
Pagination #
HuxPagination
- Navigate through pages with intelligent ellipsis handling (originally contributed by @Kingsley-EZE)- Previous/next arrow buttons with proper disabled states
- Configurable maximum pages to show
- Theme-aware styling with HuxTokens
- WCAG AA compliant contrast ratios
- Compact button design with proper spacing
Sidebar #
HuxSidebar
- Complete navigation sidebar component for app-wide navigationHuxSidebarItem
- Individual navigation items with automatic selection state- Optional header and footer sections
- Customizable width and padding
- Theme-aware styling with hover states
- Perfect for dashboard and multi-page applications
Command #
HuxCommand
- Powerful command palette for quick access to actions and navigation- Keyboard shortcuts support (CMD+K on Mac, Ctrl+K on Windows/Linux)
- Real-time search and filtering as you type
- Keyboard navigation with arrow keys and Enter to execute
- Customizable commands with icons, shortcuts, and categories
- Global keyboard shortcuts integration with
HuxCommandShortcuts.wrapper
Theme #
HuxTheme
- Pre-configured light and dark themes with Material 3 seed color supportHuxColors
- Comprehensive color paletteHuxTokens
- Semantic design tokens that adapt to custom themes
Documentation #
📚 Complete Documentation - Visit our comprehensive documentation site for detailed guides, API references, and examples.
🎨 Figma Library - Access the complete Hux UI design system in Figma with all components, colors, and design tokens.
✨ Recently Updated: Our documentation has been completely restructured with individual pages for each component, alphabetical navigation, and improved clarity!
Quick Links #
Installation #
flutter pub add hux
Usage #
Basic Setup #
Wrap your app with the Hux theme:
import 'package:flutter/material.dart';
import 'package:hux/hux.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Hux UI Demo',
theme: HuxTheme.lightTheme,
darkTheme: HuxTheme.darkTheme,
home: MyHomePage(),
);
}
}
Using Components #
Button
HuxButton(
onPressed: () => print('Button pressed'),
child: Text('Primary Button'),
variant: HuxButtonVariant.primary,
size: HuxButtonSize.medium,
icon: Icons.star,
)
Text Field
HuxInput(
label: 'Email',
hint: 'Enter your email',
prefixIcon: Icon(Icons.email),
onChanged: (value) => print(value),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your email';
}
return null;
},
)
Card
HuxCard(
title: 'Card Title',
subtitle: 'Card subtitle',
action: IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {},
),
child: Text('Card content goes here'),
onTap: () => print('Card tapped'),
)
Dialog
// Basic dialog
showHuxDialog(
context: context,
title: 'Confirm Action',
content: Text('Are you sure you want to proceed?'),
actions: [
HuxButton(
onPressed: () => Navigator.of(context).pop(false),
variant: HuxButtonVariant.secondary,
child: Text('Cancel'),
),
HuxButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text('Confirm'),
),
],
);
Date & Time Pickers
// Date picker
final DateTime? selectedDate = await showHuxDatePickerDialog(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2020),
lastDate: DateTime(2030),
);
// Time picker
final TimeOfDay? selectedTime = await showHuxTimePickerDialog(
context: context,
initialTime: TimeOfDay.now(),
);
Loading
// Simple loading indicator
HuxLoading(size: HuxLoadingSize.medium)
// Loading overlay
HuxLoadingOverlay(
isLoading: true,
message: 'Loading...',
child: YourContent(),
)
Charts
// Line chart
HuxChart.line(
data: [
{'x': 1, 'y': 10},
{'x': 2, 'y': 20},
{'x': 3, 'y': 15},
],
xField: 'x',
yField: 'y',
title: 'Sales Over Time',
subtitle: 'Monthly data',
primaryColor: Colors.blue,
)
// Bar chart
HuxChart.bar(
data: [
{'category': 'A', 'value': 30},
{'category': 'B', 'value': 45},
{'category': 'C', 'value': 25},
],
xField: 'category',
yField: 'value',
title: 'Category Analysis',
)
Context Menu
HuxContextMenu(
menuItems: [
HuxContextMenuItem(
text: 'Copy',
icon: FeatherIcons.copy,
onTap: () => print('Copy action'),
),
HuxContextMenuItem(
text: 'Paste',
icon: FeatherIcons.clipboard,
onTap: () => print('Paste action'),
isDisabled: true,
),
const HuxContextMenuDivider(),
HuxContextMenuItem(
text: 'Delete',
icon: FeatherIcons.trash2,
onTap: () => print('Delete action'),
isDestructive: true,
),
],
child: Container(
padding: const EdgeInsets.all(20),
child: const Text('Right-click me!'),
),
)
Avatar & Avatar Group
// Simple avatar with initials
HuxAvatar(
name: 'John Doe',
size: HuxAvatarSize.medium,
)
// Gradient avatar
HuxAvatar(
useGradient: true,
gradientVariant: HuxAvatarGradient.bluePurple,
size: HuxAvatarSize.medium,
)
// Avatar group with overlap
HuxAvatarGroup(
avatars: [
HuxAvatar(name: 'Alice'),
HuxAvatar(name: 'Bob'),
HuxAvatar(useGradient: true, gradientVariant: HuxAvatarGradient.greenBlue),
],
overlap: true,
maxVisible: 3,
)
Tooltip
// Basic tooltip
HuxTooltip(
message: 'This is a helpful tooltip',
child: Icon(Icons.info),
)
// Tooltip with icon and custom positioning
HuxTooltip(
message: 'Information about this feature',
icon: Icons.info_outline,
preferBelow: false,
verticalOffset: 16.0,
child: HuxButton(
onPressed: () {},
variant: HuxButtonVariant.outline,
child: Text('Hover me'),
),
)
Badges & Alerts
// Badge variants
HuxBadge(
label: 'New',
variant: HuxBadgeVariant.primary,
size: HuxBadgeSize.small,
)
// Alert with dismissal
HuxAlert(
variant: HuxAlertVariant.success,
title: 'Success!',
message: 'Operation completed successfully.',
showIcon: true,
onDismiss: () => print('Alert dismissed'),
)
Command Palette
// Define your commands
final commands = [
HuxCommandItem(
id: 'toggle-theme',
label: 'Toggle Theme',
description: 'Switch between light and dark mode',
shortcut: '⌘⇧T',
icon: LucideIcons.sun,
category: 'View',
onExecute: () => print('Theme toggled'),
),
HuxCommandItem(
id: 'settings',
label: 'Settings',
description: 'Open application settings',
shortcut: '⌘,',
icon: LucideIcons.settings,
category: 'Preferences',
onExecute: () => print('Settings opened'),
),
];
// Show the command palette
showHuxCommand(
context: context,
commands: commands,
placeholder: 'Type a command or search...',
onCommandSelected: (command) {
print('Selected: ${command.label}');
},
);
// Or wrap your app for global shortcuts
HuxCommandShortcuts.wrapper(
commands: commands,
child: MaterialApp(
home: MyHomePage(),
),
)
Customization #
All components can be customized using the provided parameters. For more advanced customization, you can extend the theme or override specific component styles.
Custom Colors #
// Access predefined colors
Container(
color: HuxColors.primary,
child: Text('Primary colored container'),
)
Support #
If you find Hux UI helpful and would like to support its continued development, consider becoming a GitHub Sponsor! 🌟
Your support helps us:
- Maintain and improve Hux UI components
- Create better documentation and examples
- Fix bugs and add new features faster
- Invest in new component development
Thank you to all our sponsors! Your contributions make a real difference in the Flutter community.
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
Fonts & Third-Party Licenses #
Manrope Font #
Hux UI uses the Manrope font family, licensed under the SIL Open Font License, Version 1.1.
Copyright 2018 The Manrope Project Authors (https://github.com/sharanda/manrope)
License #
This project is licensed under the MIT License - see the LICENSE file for details.