fix example MIH Package
This commit is contained in:
66
README.md
66
README.md
@@ -38,18 +38,36 @@ import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
|
||||
|
||||
class ExamplePackage extends StatefulWidget {
|
||||
const ExamplePackage({super.key});
|
||||
|
||||
@override
|
||||
State<ExamplePackage> createState() => _ExamplePackageState();
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class _ExamplePackageState extends State<ExamplePackage> {
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(title: 'Flutter Demo', home: const ExampleMihPackage());
|
||||
}
|
||||
}
|
||||
|
||||
class ExampleMihPackage extends StatefulWidget {
|
||||
const ExampleMihPackage({super.key});
|
||||
|
||||
@override
|
||||
State<ExampleMihPackage> createState() => _ExampleMihPackageState();
|
||||
}
|
||||
|
||||
class _ExampleMihPackageState extends State<ExampleMihPackage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MihPackage(
|
||||
backgroundColor: MihColors.primary(),
|
||||
packageActionButton: actionButton(),
|
||||
packageTools: tools(),
|
||||
packageToolBodies: toolBodies(),
|
||||
@@ -67,6 +85,7 @@ class _ExamplePackageState extends State<ExamplePackage> {
|
||||
|
||||
Widget actionButton() {
|
||||
return MihPackageAction(
|
||||
iconColor: MihColors.secondary(),
|
||||
icon: Icon(Icons.arrow_back),
|
||||
iconSize: 35,
|
||||
onTap: () {
|
||||
@@ -81,29 +100,52 @@ class _ExamplePackageState extends State<ExamplePackage> {
|
||||
}
|
||||
|
||||
MihPackageTools tools() {
|
||||
Map<Widget, void Function()?> temp = {};
|
||||
temp[const Icon(Icons.calculate)] = () {
|
||||
Map<Widget, void Function()?> toolList = {};
|
||||
toolList[const Icon(Icons.calculate)] = () {
|
||||
setState(() {
|
||||
selectedbodyIndex = 0;
|
||||
});
|
||||
};
|
||||
temp[const Icon(Icons.money)] = () {
|
||||
toolList[const Icon(Icons.money)] = () {
|
||||
setState(() {
|
||||
selectedbodyIndex = 1;
|
||||
});
|
||||
};
|
||||
return MihPackageTools(tools: temp, selectedIndex: selectedbodyIndex);
|
||||
return MihPackageTools(
|
||||
tools: toolList,
|
||||
toolColor: MihColors.secondary(),
|
||||
onSelectedIconColor: MihColors.primary(),
|
||||
selectedIndex: selectedbodyIndex,
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> toolBodies() {
|
||||
return [
|
||||
MihPackageToolBody(
|
||||
backgroundColor: MihColors.primary(),
|
||||
bodyItem: Center(child: Text("Tool Body One")),
|
||||
bodyItem: Center(
|
||||
child: Text(
|
||||
"Tool Body One",
|
||||
style: TextStyle(
|
||||
color: MihColors.secondary(),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
MihPackageToolBody(
|
||||
backgroundColor: MihColors.secondary(),
|
||||
bodyItem: Center(child: Text("Tool Body Two")),
|
||||
bodyItem: Center(
|
||||
child: Text(
|
||||
"Tool Body Two",
|
||||
style: TextStyle(
|
||||
color: MihColors.primary(),
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user