|
- import 'package:flutter/material.dart';
-
- import '../../../themes/styles_text.dart';
-
- class Button2Icon extends StatelessWidget {
- final IconData leftIcon;
- final IconData? rightIcon;
- final Widget? rightWidget;
- final String title;
- final Function onPressed;
-
- const Button2Icon({
- super.key,
- required this.leftIcon,
- this.rightIcon,
- required this.title,
- required this.onPressed,
- this.rightWidget,
- });
-
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- onPressed();
- },
- child: Container(
- padding: EdgeInsets.all(8),
- margin: EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10),
- border: Border.all(
- color: Colors.grey.shade200,
- width: 1,
- ),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- leftIcon,
- size: 16,
- color: Colors.grey.shade500,
- ),
- const SizedBox(
- width: 4,
- ),
- Text(
- title,
- style: StylesText.caption2,
- ),
- const SizedBox(
- width: 4,
- ),
- rightIcon != null
- ? Icon(
- rightIcon,
- size: 16,
- color: Colors.grey.shade500,
- )
- : const SizedBox.shrink(),
- rightWidget ?? const SizedBox.shrink(),
- ],
- ),
- ),
- );
- }
- }
|