MihPackage class

The core container for MIH application modules.

MihPackage acts as a high-level scaffold that manages a multi-page interface. It synchronizes a set of toolbar icons (packageTools) with a scrollable/swipeable body (packageToolBodies).

Features:

  • PageView Integration: Seamlessly swipes between different tools.
  • Toolbar Sync: Automatically updates the MihPackageTools state when the page changes.
  • Double-Back Exit: Built-in logic to prevent accidental app closure on mobile devices.
  • Peak Animation: A subtle visual hint that more pages exist to the right.

Example:

MihPackage(
  selectedBodyIndex: 0,
  packageToolTitles: ['Home', 'Settings'],
  packageTools: MihPackageTools(...),
  packageToolBodies: [HomeWidget(), SettingsWidget()],
  onIndexChange: (index) => print("Navigated to $index"),
  packageActionButton: FloatingActionButton(...),
)
Inheritance

Constructors

MihPackage({Key? key, Color? backgroundColor, Color? titleColor, required Widget packageActionButton, required MihPackageTools packageTools, required List<Widget> packageToolBodies, required List<String> packageToolTitles, Widget? actionDrawer, required int selectedBodyIndex, required dynamic onIndexChange(int)})
const

Properties

actionDrawer Widget?
An optional drawer for actions.
final
backgroundColor Color?
The background color of the package
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onIndexChange → dynamic Function(int)
Callback triggered whenever the user swipes or navigates to a new page.
final
packageActionButton Widget
The floating action button or primary action trigger for this package.
final
packageToolBodies List<Widget>
The list of main content widgets for each "page" of the package.
final
packageTools MihPackageTools
The toolbar widget containing icons that correspond to the packageToolBodies pages.
final
packageToolTitles List<String>
The titles displayed in the header for each corresponding page.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedBodyIndex int
The initial page index to display.
final
titleColor Color?
The title color of the package
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<MihPackage>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited