info_ui_package 1.2.3
info_ui_package: ^1.2.3 copied to clipboard
A Flutter package for creating beautiful and customizable list UIs with headers, cards, and more.
info_ui_package #
A Flutter package that provides a set of UI components for displaying information in a consistent and beautiful way.
Features #
InfoList
: A flexible list widget that can display any type of data with consistent styling- Built-in AsyncValue support for handling loading and error states
InfoCard
: A card widget that wraps content with a header and bodyInfoHeader
: A header widget for InfoCard with customizable title and style- Support for customizable styling and layouts
Getting started #
Add this to your package's pubspec.yaml
file:
dependencies:
info_ui_package: ^1.2.3
flutter_riverpod: ^2.5.1 # Required for AsyncValue support
Usage #
Basic InfoList Usage #
InfoList(
items: yourItems,
buildItem: (item) => YourCustomItemWidget(item: item),
backgroundColor: Colors.white,
contentPadding: EdgeInsets.zero,
)
InfoList with AsyncValue Support #
InfoList.when(
value: yourAsyncData, // AsyncValue<List<YourType>>
buildItem: (item) => YourCustomItemWidget(item: item),
shrinkWrap: false,
physics: const BouncingScrollPhysics(),
backgroundColor: Colors.white,
contentPadding: EdgeInsets.zero,
itemDecoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
),
),
),
)
Complete Example with InfoCard #
Info(
card: InfoCard(
header: InfoHeader(
title: 'Patient Information',
titleStyle: Theme.of(context).textTheme.titleLarge,
backgroundColor: Colors.white,
),
body: InfoList.when(
value: patientData, // AsyncValue<List<Patient>>
buildItem: (patient) => PatientInfoItem(patient: patient),
shrinkWrap: false,
physics: const BouncingScrollPhysics(),
backgroundColor: Colors.white,
contentPadding: EdgeInsets.zero,
itemDecoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
),
),
),
),
),
)
Additional Information #
InfoList Parameters #
items
: List of items to displaybuildItem
: Function to build each item widgetbackgroundColor
: Background color of the listcontentPadding
: Padding around the list contentshrinkWrap
: Whether the list should shrink-wrap its contentseparatorBuilder
: Custom separator builder between itemsphysics
: Scroll physics for the listitemPadding
: Padding for each itemitemDecoration
: Decoration for each item containerremoveTopPadding
: Whether to remove top padding
AsyncValue Support #
The InfoList.when
constructor automatically handles:
- Loading state with a centered CircularProgressIndicator
- Error state with a selectable error message
- Data state with your custom item builder
InfoCard Parameters #
header
: InfoHeader widget for the card titlebody
: Content to display in the card body
InfoHeader Parameters #
title
: Text to display in the headertitleStyle
: Text style for the titlebackgroundColor
: Background color of the header
Dependencies #
- flutter_riverpod: ^2.5.1 (Required for AsyncValue support)
- flutter_screenutil: ^5.9.0
- google_fonts: ^6.1.0
- cached_network_image: ^3.3.1
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.