add tool titles and and examples

This commit is contained in:
2025-05-29 14:47:57 +02:00
parent 2dcb96e4ec
commit 4c4f2f5e28
2 changed files with 31 additions and 2 deletions

View File

@@ -117,12 +117,21 @@ class _PackageTestState extends State<PackageTest> {
return toolBodies;
}
List<String> getToolTitle() {
List<String> toolTitles = [
"Tool One",
"Tool Two",
];
return toolTitles;
}
@override
Widget build(BuildContext context) {
return MihPackage(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: _selcetedIndex,
onIndexChange: (newValue) {
setState(() {

View File

@@ -9,6 +9,7 @@ class MihPackage extends StatefulWidget {
final Widget appActionButton;
final MihPackageTools appTools;
final List<Widget> appBody;
final List<String>? appToolTitles;
final MIHAppDrawer? actionDrawer;
int selectedbodyIndex;
final Function(int) onIndexChange;
@@ -17,6 +18,7 @@ class MihPackage extends StatefulWidget {
required this.appActionButton,
required this.appTools,
required this.appBody,
this.appToolTitles,
this.actionDrawer,
required this.selectedbodyIndex,
required this.onIndexChange,
@@ -112,10 +114,28 @@ class _MihPackageState extends State<MihPackage>
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
widget.appActionButton,
Flexible(child: widget.appTools),
Expanded(
child: Container(
alignment: Alignment.centerRight,
// color: Colors.black,
child: Text(
widget.appToolTitles != null
? widget.appToolTitles![widget.selectedbodyIndex]
: "",
style: const TextStyle(
fontSize: 23,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(
width: 10,
),
widget.appTools,
],
),
const SizedBox(height: 5),