ente/lib/ui/common_elements.dart

91 lines
2.2 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
2020-08-09 14:58:41 +00:00
import 'package:flutter/widgets.dart';
2022-04-28 13:08:27 +00:00
Widget nothingToSeeHere({Color textColor}) {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
2022-05-17 11:38:21 +00:00
"Nothing to see here! 👀",
2022-04-28 13:08:27 +00:00
style: TextStyle(
color: textColor.withOpacity(0.35),
),
),
2020-12-12 01:11:12 +00:00
),
2022-04-28 13:08:27 +00:00
);
}
2021-05-12 15:12:16 +00:00
Widget button(
2020-11-10 14:55:28 +00:00
String text, {
double fontSize = 14,
VoidCallback onPressed,
2021-06-16 15:28:43 +00:00
double lineHeight,
EdgeInsets padding,
2020-11-10 14:55:28 +00:00
}) {
2021-05-12 15:12:16 +00:00
return InkWell(
child: OutlinedButton(
style: OutlinedButton.styleFrom(
shape: RoundedRectangleBorder(
2022-03-12 14:03:30 +00:00
borderRadius: BorderRadius.circular(8),
2021-05-12 15:12:16 +00:00
),
padding: padding ?? EdgeInsets.fromLTRB(50, 16, 50, 16),
2022-03-12 14:03:30 +00:00
textStyle: TextStyle(
fontWeight: FontWeight.w600,
fontFamily: 'Inter-SemiBold',
2021-05-12 15:12:16 +00:00
fontSize: fontSize,
2021-06-16 15:28:43 +00:00
height: lineHeight,
2021-05-12 15:12:16 +00:00
),
2022-03-12 14:03:30 +00:00
).copyWith(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return Colors.grey;
}
// return Color.fromRGBO(29, 184, 80, 1);
return Colors.white;
},
),
foregroundColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) {
return Colors.white;
}
return Colors.black;
},
),
alignment: Alignment.center,
2021-05-12 15:12:16 +00:00
),
2022-03-12 14:03:30 +00:00
child: Text(text),
2021-05-12 15:12:16 +00:00
onPressed: onPressed,
),
);
}
2021-04-20 11:06:40 +00:00
final emptyContainer = const SizedBox.shrink();
2021-05-12 16:37:14 +00:00
Animatable<Color> passwordStrengthColors = TweenSequence<Color>(
[
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: Colors.red,
end: Colors.yellow,
),
),
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: Colors.yellow,
end: Colors.lightGreen,
),
),
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: Colors.lightGreen,
end: Color.fromRGBO(45, 194, 98, 1.0),
),
),
],
);