first commit for mih package toolkit

This commit is contained in:
2026-03-06 15:38:41 +02:00
parent 3a90e777a8
commit 76999db7c5
168 changed files with 10542 additions and 71 deletions

View File

@@ -0,0 +1,318 @@
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class ToolBodyOne extends StatefulWidget {
const ToolBodyOne({super.key});
@override
State<ToolBodyOne> createState() => _ToolBodyOneState();
}
class _ToolBodyOneState extends State<ToolBodyOne> {
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
bodyItem: MihSingleChildScroll(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"This tool body is to showcase mih button, windows snackbar and colors",
style: TextStyle(fontSize: 24, color: MihColors.secondary()),
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.secondary(),
width: 300,
child: Text(
"Show Snackbar",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
MihSnackBar(
backgroundColor: MihColors.red(),
child: Text(
"Hello from the snackbar",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.secondary(),
width: 300,
child: Text(
"Open Mih Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
showMihWindow(null, null, "Default Window");
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.grey(),
width: 300,
child: Text(
"Grey Button",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
showMihWindow(
MihColors.grey(),
MihColors.primary(),
"Grey Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Green Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Green Button Pressed");
showMihWindow(
MihColors.green(),
MihColors.primary(),
"Green Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Red Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Red Button Pressed");
showMihWindow(
MihColors.red(),
MihColors.primary(),
"Red Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.pink(),
width: 300,
child: Text(
"Pink Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Pink Button Pressed");
showMihWindow(
MihColors.pink(),
MihColors.primary(),
"Pink Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.orange(),
width: 300,
child: Text(
"Orange Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Orange Button Pressed");
showMihWindow(
MihColors.orange(),
MihColors.primary(),
"Orange Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.yellow(),
width: 300,
child: Text(
"Yellow Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Yellow Button Pressed");
showMihWindow(
MihColors.yellow(),
MihColors.primary(),
"Yellow Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.bluishPurple(),
width: 300,
child: Text(
"Bluish Purple Window",
style: TextStyle(
color: MihColors.secondary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Bluish Purple Button Pressed");
showMihWindow(
MihColors.bluishPurple(),
MihColors.secondary(),
"Bluish Purple Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.purple(),
width: 300,
child: Text(
"Purple Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Purple Button Pressed");
showMihWindow(
MihColors.purple(),
MihColors.primary(),
"Purple Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.gold(),
width: 300,
child: Text(
"Gold Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Gold Button Pressed");
showMihWindow(
MihColors.gold(),
MihColors.primary(),
"Gold Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.silver(),
width: 300,
child: Text(
"Silver Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Silver Button Pressed");
showMihWindow(
MihColors.silver(),
MihColors.primary(),
"Silver Window",
);
},
),
SizedBox(height: 20),
MihButton(
buttonColor: MihColors.bronze(),
width: 300,
child: Text(
"Bronze Window",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onPressed: () {
debugPrint("Bronze Button Pressed");
showMihWindow(
MihColors.bronze(),
MihColors.primary(),
"Bronze Window",
);
},
),
SizedBox(height: 50),
],
),
),
);
}
void showMihWindow(Color? bdColor, Color? fgColor, String title) {
showDialog(
context: context,
builder: (context) {
return MihPackageWindow(
backgroundColor: bdColor,
foregroundColor: fgColor,
fullscreen: false,
windowTitle: title,
onWindowTapClose: () {
Navigator.of(context).pop();
},
windowBody: SizedBox(height: 500),
);
},
);
}
}

View File

@@ -0,0 +1,126 @@
import 'package:flutter/material.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
class ToolBodyTwo extends StatefulWidget {
const ToolBodyTwo({super.key});
@override
State<ToolBodyTwo> createState() => _ToolBodyTwoState();
}
class _ToolBodyTwoState extends State<ToolBodyTwo> {
final _formKey = GlobalKey<FormState>();
final FocusNode searchFocusNode = FocusNode();
final _searchController = TextEditingController();
final _textController = TextEditingController();
final _dropdownController = TextEditingController();
final _numericStepperController = TextEditingController();
final _radioController = TextEditingController();
final _dateController = TextEditingController();
final _timeController = TextEditingController();
@override
Widget build(BuildContext context) {
return MihPackageToolBody(
backgroundColor: MihColors.primary(),
bodyItem: MihSingleChildScroll(
child: MihForm(
formKey: _formKey,
formFields: [
Text(
"This tool body is to showcase mih iput fields with validation",
style: TextStyle(fontSize: 24, color: MihColors.secondary()),
),
SizedBox(height: 20),
MihSearchBar(
width: 300,
controller: _searchController,
hintText: "Search...",
prefixIcon: Icons.search,
fillColor: MihColors.secondary(),
hintColor: MihColors.primary(),
onPrefixIconTap: () {
debugPrint(
"Search initiated with query: ${_searchController.text}",
);
},
searchFocusNode: searchFocusNode,
),
SizedBox(height: 20),
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
width: 300,
controller: _textController,
hintText: "Text Input",
requiredText: true,
),
const SizedBox(height: 20),
MihDropdownField(
width: 300,
controller: _dropdownController,
hintText: "Dropdown Input",
dropdownOptions: [
"Option 1",
"Option 2",
"Option 3",
"Option 4",
"Option 5",
"Option 6",
],
requiredText: true,
editable: true,
enableSearch: true,
),
const SizedBox(height: 20),
MihNumericStepper(
width: 300,
controller: _numericStepperController,
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
hintText: "Numeric Stepper",
requiredText: true,
validationOn: true,
),
const SizedBox(height: 20),
MihRadioOptions(
width: 300,
controller: _radioController,
hintText: "Radio Options",
fillColor: MihColors.secondary(),
secondaryFillColor: MihColors.primary(),
requiredText: true,
radioOptions: ["Option 1", "Option 2", "Option 3"],
),
const SizedBox(height: 20),
MihToggle(
width: 300,
hintText: "Toggle",
initialPostion: false,
fillColor: MihColors.secondary(),
secondaryFillColor: MihColors.primary(),
onChange: (value) {
debugPrint("Toggle changed: $value");
},
),
const SizedBox(height: 20),
MihDateField(
width: 300,
controller: _dateController,
labelText: "Date Field",
required: true,
),
const SizedBox(height: 20),
MihTimeField(
width: 300,
controller: _timeController,
labelText: "Time Field",
required: true,
),
const SizedBox(height: 50),
],
),
),
);
}
}