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; return toolBodies;
} }
List<String> getToolTitle() {
List<String> toolTitles = [
"Tool One",
"Tool Two",
];
return toolTitles;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MihPackage( return MihPackage(
appActionButton: getAction(), appActionButton: getAction(),
appTools: getTools(), appTools: getTools(),
appBody: getToolBody(), appBody: getToolBody(),
appToolTitles: getToolTitle(),
selectedbodyIndex: _selcetedIndex, selectedbodyIndex: _selcetedIndex,
onIndexChange: (newValue) { onIndexChange: (newValue) {
setState(() { setState(() {

View File

@@ -9,6 +9,7 @@ class MihPackage extends StatefulWidget {
final Widget appActionButton; final Widget appActionButton;
final MihPackageTools appTools; final MihPackageTools appTools;
final List<Widget> appBody; final List<Widget> appBody;
final List<String>? appToolTitles;
final MIHAppDrawer? actionDrawer; final MIHAppDrawer? actionDrawer;
int selectedbodyIndex; int selectedbodyIndex;
final Function(int) onIndexChange; final Function(int) onIndexChange;
@@ -17,6 +18,7 @@ class MihPackage extends StatefulWidget {
required this.appActionButton, required this.appActionButton,
required this.appTools, required this.appTools,
required this.appBody, required this.appBody,
this.appToolTitles,
this.actionDrawer, this.actionDrawer,
required this.selectedbodyIndex, required this.selectedbodyIndex,
required this.onIndexChange, required this.onIndexChange,
@@ -112,10 +114,28 @@ class _MihPackageState extends State<MihPackage>
children: [ children: [
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
widget.appActionButton, 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), const SizedBox(height: 5),