Merge pull request #105 from yaso-meth/BUG--Border-Around-Calc-tools
BUG--Border-Around-Calc-tools
This commit is contained in:
@@ -54,7 +54,7 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihAppToolBody(
|
return MihAppToolBody(
|
||||||
borderOn: false,
|
borderOn: true,
|
||||||
bodyItem: getBody(),
|
bodyItem: getBody(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -73,232 +73,219 @@ class _SimpleCalcState extends State<SimpleCalc> {
|
|||||||
calcWidth = 300;
|
calcWidth = 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Padding(
|
return Column(
|
||||||
padding: const EdgeInsets.all(10.0),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
child: Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.min,
|
Text(
|
||||||
children: <Widget>[
|
"Simple Calculator",
|
||||||
Text(
|
textAlign: TextAlign.center,
|
||||||
"Simple Calculator",
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
//color: Colors.white,
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Text(
|
||||||
|
userInput,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(
|
),
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
Container(
|
||||||
const SizedBox(height: 10),
|
width: double.infinity,
|
||||||
Container(
|
//color: Colors.white,
|
||||||
//color: Colors.white,
|
padding: const EdgeInsets.all(15),
|
||||||
padding: const EdgeInsets.all(20),
|
alignment: Alignment.centerRight,
|
||||||
alignment: Alignment.centerRight,
|
child: Text(
|
||||||
child: Text(
|
answer,
|
||||||
userInput,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 30,
|
||||||
fontSize: 18,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: SizedBox(
|
||||||
|
width: calcWidth,
|
||||||
|
child: GridView.builder(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
// padding: EdgeInsets.only(
|
||||||
|
// left: width / 10,
|
||||||
|
// right: width / 10,
|
||||||
|
// bottom: height / 15,
|
||||||
|
// //top: 20,
|
||||||
|
// ),
|
||||||
|
// shrinkWrap: true,
|
||||||
|
itemCount: buttons.length,
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 4,
|
||||||
|
//mainAxisExtent: 150,
|
||||||
),
|
),
|
||||||
),
|
itemBuilder: (context, index) {
|
||||||
),
|
// Clear Button
|
||||||
Container(
|
if (index == 0) {
|
||||||
width: double.infinity,
|
return Padding(
|
||||||
//color: Colors.white,
|
padding: const EdgeInsets.all(4.0),
|
||||||
padding: const EdgeInsets.all(15),
|
child: MIHButton(
|
||||||
alignment: Alignment.centerRight,
|
onTap: () {
|
||||||
child: Text(
|
setState(() {
|
||||||
answer,
|
userInput = '';
|
||||||
style: TextStyle(
|
answer = '0';
|
||||||
fontSize: 30,
|
});
|
||||||
color:
|
},
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
buttonText: buttons[index],
|
||||||
fontWeight: FontWeight.bold),
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
),
|
.theme
|
||||||
),
|
.messageTextColor(),
|
||||||
Container(
|
textColor:
|
||||||
alignment: Alignment.centerRight,
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
child: SizedBox(
|
),
|
||||||
width: calcWidth,
|
);
|
||||||
child: GridView.builder(
|
}
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
// padding: EdgeInsets.only(
|
|
||||||
// left: width / 10,
|
|
||||||
// right: width / 10,
|
|
||||||
// bottom: height / 15,
|
|
||||||
// //top: 20,
|
|
||||||
// ),
|
|
||||||
// shrinkWrap: true,
|
|
||||||
itemCount: buttons.length,
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4,
|
|
||||||
//mainAxisExtent: 150,
|
|
||||||
),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
// Clear Button
|
|
||||||
if (index == 0) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
userInput = '';
|
|
||||||
answer = '0';
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonText: buttons[index],
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.messageTextColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// +/- button
|
// +/- button
|
||||||
else if (index == 1) {
|
else if (index == 1) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(4.0),
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: MIHButton(
|
child: MIHButton(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
userInput += buttons[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonText: buttons[index],
|
||||||
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.messageTextColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// % Button
|
||||||
|
else if (index == 2) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
userInput += buttons[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonText: buttons[index],
|
||||||
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.messageTextColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Delete Button
|
||||||
|
else if (index == 3) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
userInput =
|
||||||
|
userInput.substring(0, userInput.length - 1);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonText: buttons[index],
|
||||||
|
buttonColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Equal_to Button
|
||||||
|
else if (index == 18) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
equalPressed();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buttonText: buttons[index],
|
||||||
|
buttonColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// +, -, / x buttons
|
||||||
|
else if (index == 7 ||
|
||||||
|
index == 11 ||
|
||||||
|
index == 15 ||
|
||||||
|
index == 19) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
if (answer == "0") {
|
||||||
setState(() {
|
setState(() {
|
||||||
userInput += buttons[index];
|
userInput += buttons[index];
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
buttonText: buttons[index],
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.messageTextColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// % Button
|
|
||||||
else if (index == 2) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
|
userInput = answer;
|
||||||
|
answer = "0";
|
||||||
userInput += buttons[index];
|
userInput += buttons[index];
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
buttonText: buttons[index],
|
// setState(() {
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
// userInput += buttons[index];
|
||||||
.theme
|
// });
|
||||||
.messageTextColor(),
|
},
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
buttonText: buttons[index],
|
||||||
.theme
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
.primaryColor(),
|
.theme
|
||||||
),
|
.messageTextColor(),
|
||||||
);
|
textColor:
|
||||||
}
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
// Delete Button
|
),
|
||||||
else if (index == 3) {
|
);
|
||||||
return Padding(
|
}
|
||||||
padding: const EdgeInsets.all(4.0),
|
// other buttons
|
||||||
child: MIHButton(
|
else {
|
||||||
onTap: () {
|
return Padding(
|
||||||
setState(() {
|
padding: const EdgeInsets.all(4.0),
|
||||||
userInput =
|
child: MIHButton(
|
||||||
userInput.substring(0, userInput.length - 1);
|
onTap: () {
|
||||||
});
|
setState(() {
|
||||||
},
|
userInput += buttons[index];
|
||||||
buttonText: buttons[index],
|
});
|
||||||
buttonColor:
|
},
|
||||||
MzanziInnovationHub.of(context)!.theme.errorColor(),
|
buttonText: buttons[index],
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.primaryColor(),
|
.secondaryColor(),
|
||||||
),
|
textColor:
|
||||||
);
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
}
|
),
|
||||||
// Equal_to Button
|
);
|
||||||
else if (index == 18) {
|
}
|
||||||
return Padding(
|
},
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
equalPressed();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonText: buttons[index],
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.successColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// +, -, / x buttons
|
|
||||||
else if (index == 7 ||
|
|
||||||
index == 11 ||
|
|
||||||
index == 15 ||
|
|
||||||
index == 19) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
if (answer == "0") {
|
|
||||||
setState(() {
|
|
||||||
userInput += buttons[index];
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
userInput = answer;
|
|
||||||
answer = "0";
|
|
||||||
userInput += buttons[index];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// setState(() {
|
|
||||||
// userInput += buttons[index];
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
buttonText: buttons[index],
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.messageTextColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// other buttons
|
|
||||||
else {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
userInput += buttons[index];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buttonText: buttons[index],
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.primaryColor(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,102 +262,97 @@ class _TipCalcState extends State<TipCalc> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihAppToolBody(
|
return MihAppToolBody(
|
||||||
borderOn: false,
|
borderOn: true,
|
||||||
bodyItem: getBody(),
|
bodyItem: getBody(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getBody() {
|
Widget getBody() {
|
||||||
return Padding(
|
return Column(
|
||||||
padding: const EdgeInsets.all(10.0),
|
mainAxisSize: MainAxisSize.max,
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.max,
|
Text(
|
||||||
children: <Widget>[
|
"Tip Calculator",
|
||||||
Text(
|
textAlign: TextAlign.center,
|
||||||
"Tip Calculator",
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
fontSize: 25,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 25,
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Divider(
|
),
|
||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MIHNumberField(
|
MIHNumberField(
|
||||||
controller: billAmountController,
|
controller: billAmountController,
|
||||||
hintText: "Bill Amount",
|
hintText: "Bill Amount",
|
||||||
editable: true,
|
editable: true,
|
||||||
required: true,
|
required: true,
|
||||||
enableDecimal: true,
|
enableDecimal: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MIHNumberField(
|
MIHNumberField(
|
||||||
controller: tipPercentageController,
|
controller: tipPercentageController,
|
||||||
hintText: "Tip %",
|
hintText: "Tip %",
|
||||||
editable: true,
|
editable: true,
|
||||||
required: true,
|
required: true,
|
||||||
enableDecimal: false,
|
enableDecimal: false,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
MIHDropdownField(
|
MIHDropdownField(
|
||||||
controller: splitBillController,
|
controller: splitBillController,
|
||||||
hintText: "Split Bill",
|
hintText: "Split Bill",
|
||||||
dropdownOptions: const ["Yes", "No"],
|
dropdownOptions: const ["Yes", "No"],
|
||||||
required: true,
|
required: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
enableSearch: false,
|
enableSearch: false,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
valueListenable: splitValue,
|
valueListenable: splitValue,
|
||||||
builder: (BuildContext context, String value, Widget? child) {
|
builder: (BuildContext context, String value, Widget? child) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: value == "Yes",
|
visible: value == "Yes",
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
MIHNumberField(
|
MIHNumberField(
|
||||||
controller: noPeopleController,
|
controller: noPeopleController,
|
||||||
hintText: "No. of People",
|
hintText: "No. of People",
|
||||||
editable: true,
|
editable: true,
|
||||||
required: true,
|
required: true,
|
||||||
enableDecimal: false,
|
enableDecimal: false,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
validateInput();
|
||||||
},
|
},
|
||||||
|
buttonText: "Calculate",
|
||||||
|
buttonColor: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
width: double.infinity,
|
const SizedBox(height: 10),
|
||||||
height: 50,
|
SizedBox(
|
||||||
child: MIHButton(
|
width: double.infinity,
|
||||||
onTap: () {
|
height: 50,
|
||||||
validateInput();
|
child: MIHButton(
|
||||||
},
|
onTap: () {
|
||||||
buttonText: "Calculate",
|
clearInput();
|
||||||
buttonColor:
|
},
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
buttonText: "Clear",
|
||||||
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
buttonColor: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
),
|
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
SizedBox(
|
],
|
||||||
width: double.infinity,
|
|
||||||
height: 50,
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
clearInput();
|
|
||||||
},
|
|
||||||
buttonText: "Clear",
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.8+32
|
version: 1.0.9+34
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.5.3 <4.0.0'
|
sdk: '>=3.5.3 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user