| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import 'package:flutter/material.dart';
- class ImageButton extends StatelessWidget{
- final VoidCallback onPressed;
- final String? title;
- final Widget image;
- const ImageButton({
- super.key,
- required this.onPressed,
- required this.image,
- this.title,
- });
- @override
- Widget build(BuildContext context) {
- var children = <Widget>[
- image,
- ];
- if (title != null){
- children.add(const SizedBox(height: 2));
- children.add(Text(title!));
- }
- return TextButton(
- onPressed: onPressed,
- style: TextButton.styleFrom(
- minimumSize: Size.zero,
- padding: const EdgeInsets.all(5),
- textStyle: const TextStyle(
- color: Color(0xff818181),
- fontSize: 10,
- ),
- backgroundColor: Colors.transparent,
- foregroundColor: const Color(0xff818181),
- shape:RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(0),
- ),
- ),
- child: Column( // Replace with a Row for horizontal icon + text
- children: children,
- )
- );
- }
- }
|