-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathValidationTextWidget.dart
More file actions
41 lines (38 loc) · 1.14 KB
/
Copy pathValidationTextWidget.dart
File metadata and controls
41 lines (38 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import 'package:flutter/material.dart';
/// ValidationTextWidget that represent style of each one of them and shows as list of condition that you want to the app user
class ValidationTextWidget extends StatelessWidget {
final bool? success;
final Color defaultColor;
final Color successColor;
final Color failureColor;
final String text;
final int? value;
final TextStyle? textStyle;
ValidationTextWidget({
required this.success,
required this.text,
required this.value,
required this.defaultColor,
required this.successColor,
required this.failureColor,
this.textStyle
});
@override
Widget build(BuildContext context) {
Color color = success == null ? defaultColor : success! ? successColor : failureColor;
return Row(
children: [
Icon(
success == null || success! ? Icons.check : Icons.close,
size: 20,
color: color,
),
const SizedBox(width: 10),
Text(
text.replaceFirst("-", value.toString()),
style: (textStyle ?? Theme.of(context).textTheme.bodyMedium)?.copyWith(color: color)
)
],
);
}
}