Skip to content

Instantly share code, notes, and snippets.

@nbnD
Created June 3, 2022 07:46
Show Gist options
  • Save nbnD/54a8a88954a80e02b45b47197f7e7ca7 to your computer and use it in GitHub Desktop.
Save nbnD/54a8a88954a80e02b45b47197f7e7ca7 to your computer and use it in GitHub Desktop.
Resend Otp Timer
import 'package:flutter/material.dart';
// ignore: must_be_immutable
class CustomButton extends StatelessWidget {
final double minWidth;
final double maxWidth;
final double minHeight;
final Function onPressed;
final String title;
final Color color;
// ignore: prefer_typing_uninitialized_variables
var icon;
CustomButton({
Key? key,
required this.minWidth,
required this.maxWidth,
required this.minHeight,
required this.onPressed,
required this.color,
required this.title,
this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
onPressed();
},
child: ConstrainedBox(
constraints: BoxConstraints(
minWidth: minWidth,
maxWidth: maxWidth,
minHeight: minHeight,
),
child: Container(
decoration: BoxDecoration(
color: color,
border: Border.all(width: 2.0, color: Colors.white)),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
icon != null ? Icon(icon, color: Colors.white) : Container(),
icon != null ? const SizedBox(width: 10) : Container(),
Text(
title,
style: const TextStyle(color: Colors.white, fontSize: 18),
),
],
)),
)),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment