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.
65 lines
1.9 KiB
Dart
65 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
class AppFilledButton extends StatelessWidget {
|
|
final VoidCallback onPressed;
|
|
final String label;
|
|
final bool maxWidth, loading;
|
|
final Color buttonColor;
|
|
final Color textColor;
|
|
final bool showBorder;
|
|
final bool showIcon;
|
|
final Widget icon;
|
|
|
|
const AppFilledButton({
|
|
@required this.onPressed,
|
|
@required this.label,
|
|
this.maxWidth = false,
|
|
this.icon,
|
|
this.loading = false,
|
|
this.showBorder = false,
|
|
this.showIcon = false,
|
|
this.buttonColor,
|
|
this.textColor,
|
|
Key key,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 56.toScreenHeight,
|
|
width: maxWidth ? double.infinity : null,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10),
|
|
color: buttonColor ?? AppColor.blueStatus(context),
|
|
border: showBorder ? Border.all(color: textColor ?? AppColor.background(context)) : null,
|
|
),
|
|
child: loading
|
|
? SizedBox(
|
|
width: 24,
|
|
height: 24,
|
|
child: CircularProgressIndicator(
|
|
color: textColor ?? AppColor.background(context),
|
|
strokeWidth: 2,
|
|
),
|
|
)
|
|
: showIcon&&icon!=null?
|
|
Center(
|
|
child: Row(
|
|
mainAxisSize:MainAxisSize.min,
|
|
children: [
|
|
icon,
|
|
8.width,
|
|
label.heading6(context).custom(color: textColor ?? AppColor.background(context))
|
|
],
|
|
),
|
|
):
|
|
label.heading6(context).custom(color: textColor ?? AppColor.background(context)),
|
|
).onPress(onPressed);
|
|
}
|
|
}
|