You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm-flutter-app/lib/widgets/button/simple_button.dart

43 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
class SimpleButton extends StatelessWidget {
final String text;
final VoidCallback? onPress;
final Color textColor;
final Color? color;
final double? fontSize;
final List<Color>? colors;
SimpleButton(this.text, this.onPress, {this.color, this.textColor = Colors.white, this.fontSize, this.colors});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPress,
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
gradient: onPress == null
? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)])
: LinearGradient(
transform: const GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: colors ??
[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
]),
),
child: Text(
text,
style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48),
),
),
);
}
}