create new MIH Button

This commit is contained in:
2025-05-29 10:55:51 +02:00
parent 3d75efb0bb
commit c0a35411b5
46 changed files with 1704 additions and 2633 deletions

View File

@@ -1,48 +0,0 @@
import 'package:flutter/material.dart';
class MIHButton extends StatefulWidget {
final void Function()? onTap;
final String buttonText;
final Color buttonColor;
final Color textColor;
const MIHButton({
super.key,
required this.onTap,
required this.buttonText,
required this.buttonColor,
required this.textColor,
});
@override
State<MIHButton> createState() => _MIHButtonState();
}
class _MIHButtonState extends State<MIHButton> {
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: widget.onTap,
style: ElevatedButton.styleFrom(
backgroundColor: widget.buttonColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
),
child: Text(
widget.buttonText,
style: TextStyle(
//fontWeight: FontWeight.bold,
fontSize: 20,
color: widget.textColor,
fontWeight: FontWeight.bold,
),
),
);
}
}

View File

@@ -4,6 +4,7 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_single_child_scroll.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_circle_avatar.dart';
@@ -123,6 +124,70 @@ class _PackageToolOneState extends State<PackageToolOne> {
],
),
const SizedBox(height: 10),
MihButton(
onPressed: () {
print("Button Pressed");
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Click Me",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 10),
MihButton(
onPressed: () {
print("Button Pressed");
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: Row(
children: [
Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
Text(
"Click Me",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
],
),
),
const SizedBox(height: 10),
MihButton(
onPressed: () {
print("Button Pressed");
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.errorColor(),
width: 300,
child: Text(
"Click Me",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 10),
Container(
color: Colors.black,
width: 200,

View File

@@ -0,0 +1,43 @@
import 'package:animated_button/animated_button.dart';
import 'package:flutter/material.dart';
class MihButton extends StatefulWidget {
final void Function() onPressed;
final Color buttonColor;
final double width;
final double? height;
final double? borderRadius;
final Widget child;
const MihButton({
super.key,
required this.onPressed,
required this.buttonColor,
required this.width,
this.height,
this.borderRadius,
required this.child,
});
@override
State<MihButton> createState() => _MihButtonState();
}
class _MihButtonState extends State<MihButton> {
@override
Widget build(BuildContext context) {
return FittedBox(
fit: BoxFit.contain,
child: AnimatedButton(
width: widget.width,
height: widget.height ?? 50.0,
borderRadius: widget.borderRadius ?? 25.0,
color: widget.buttonColor,
shadowDegree: ShadowDegree.light,
duration: 30,
onPressed: widget.onPressed,
child: FittedBox(child: widget.child),
),
);
}
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import '../../main.dart';
import '../mih_inputs_and_buttons/mih_button.dart';
class MIHDeleteMessage extends StatefulWidget {
final String deleteType;
@@ -97,18 +97,21 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: widget.onTap,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MihButton(
onPressed: widget.onTap,
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Delete",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
))
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
@@ -179,18 +182,21 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: widget.onTap,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MihButton(
onPressed: widget.onTap,
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Delete",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
))
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
@@ -261,18 +267,22 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: widget.onTap,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MihButton(
onPressed: widget.onTap,
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Delete",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
))
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
@@ -343,18 +353,21 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: widget.onTap,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MihButton(
onPressed: widget.onTap,
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Delete",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
))
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
@@ -425,18 +438,21 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: widget.onTap,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MihButton(
onPressed: widget.onTap,
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Delete",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
))
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
),

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_button.dart';
import '../../main.dart';
import '../mih_inputs_and_buttons/mih_button.dart';
class MIHSuccessMessage extends StatefulWidget {
final String successType;
@@ -96,18 +96,21 @@ class _MIHSuccessMessageState extends State<MIHSuccessMessage> {
),
),
const SizedBox(height: 15),
SizedBox(
MihButton(
onPressed: () {
Navigator.pop(context);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
height: 50,
child: MIHButton(
onTap: () {
Navigator.pop(context);
},
buttonText: "Dismiss",
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: Text(
"Dismiss",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],