Make app dymanically resizable for phone & web
This commit is contained in:
@@ -7,6 +7,8 @@ class HomeTile extends StatefulWidget {
|
||||
final IconData tileIcon;
|
||||
final void Function() onTap;
|
||||
// final Widget tileIcon;
|
||||
final Color p;
|
||||
final Color s;
|
||||
|
||||
const HomeTile({
|
||||
super.key,
|
||||
@@ -14,6 +16,8 @@ class HomeTile extends StatefulWidget {
|
||||
required this.tileName,
|
||||
//required this.tileDescription,
|
||||
required this.tileIcon,
|
||||
required this.p,
|
||||
required this.s,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -26,12 +30,62 @@ class _HomeTileState extends State<HomeTile> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
mainC = MzanziInnovationHub.of(context)!.theme.secondaryColor();
|
||||
secondC = MzanziInnovationHub.of(context)!.theme.primaryColor();
|
||||
mainC = widget.p;
|
||||
secondC = widget.s;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget displayTile() {
|
||||
return FittedBox(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
onTapDown: (_) {
|
||||
setState(() {
|
||||
mainC = MzanziInnovationHub.of(context)!.theme.primaryColor();
|
||||
secondC =
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor();
|
||||
});
|
||||
},
|
||||
onTapUp: (_) {
|
||||
setState(() {
|
||||
mainC = MzanziInnovationHub.of(context)!.theme.secondaryColor();
|
||||
secondC = MzanziInnovationHub.of(context)!.theme.primaryColor();
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
decoration: BoxDecoration(
|
||||
color: mainC,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
//border: Border.all(color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 1.0),
|
||||
),
|
||||
child: Icon(
|
||||
widget.tileIcon,
|
||||
color: secondC,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
Text(
|
||||
widget.tileName,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: mainC,
|
||||
fontSize: 5.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FittedBox(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@@ -78,11 +132,6 @@ class _HomeTileState extends State<HomeTile> {
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return displayTile();
|
||||
// child: Card(
|
||||
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
// elevation: 20,
|
||||
|
||||
Reference in New Issue
Block a user