You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.4 KiB
81 lines
2.4 KiB
2 years ago
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:info_tren/pages/train_info_page/train_info_constants.dart';
|
||
|
|
||
|
class CupertinoBadge extends StatelessWidget {
|
||
|
final String text;
|
||
|
final String caption;
|
||
|
final bool isNotScheduled;
|
||
|
final bool isOnTime;
|
||
|
final bool isDelayed;
|
||
|
|
||
2 years ago
|
const CupertinoBadge({
|
||
2 years ago
|
required this.text,
|
||
|
required this.caption,
|
||
|
this.isNotScheduled = false,
|
||
|
this.isOnTime = false,
|
||
|
this.isDelayed = false,
|
||
2 years ago
|
super.key,
|
||
2 years ago
|
});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
2 years ago
|
Color foregroundColor = foregroundWhite;
|
||
2 years ago
|
Color? backgroundColor;
|
||
|
|
||
|
if (isNotScheduled) {
|
||
2 years ago
|
foregroundColor = const Color.fromRGBO(225, 175, 30, 1);
|
||
|
backgroundColor = const Color.fromRGBO(80, 40, 10, 1);
|
||
2 years ago
|
}
|
||
|
else if (isOnTime) {
|
||
2 years ago
|
foregroundColor = const Color.fromRGBO(130, 175, 65, 1);
|
||
|
backgroundColor = const Color.fromRGBO(40, 80, 10, 1);
|
||
2 years ago
|
}
|
||
|
else if (isDelayed) {
|
||
2 years ago
|
foregroundColor = const Color.fromRGBO(225, 75, 30, 1);
|
||
|
backgroundColor = const Color.fromRGBO(80, 20, 10, 1);
|
||
2 years ago
|
}
|
||
|
|
||
|
return Padding(
|
||
|
padding: const EdgeInsets.all(8),
|
||
|
child: Container(
|
||
|
decoration: BoxDecoration(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
border: Border.all(
|
||
|
width: 2,
|
||
|
color: foregroundColor,
|
||
|
),
|
||
|
color: backgroundColor,
|
||
|
// color: CupertinoColors.activeOrange,
|
||
|
),
|
||
|
width: 48,
|
||
|
height: 48,
|
||
|
child: Column(
|
||
|
mainAxisSize: MainAxisSize.min,
|
||
|
children: <Widget>[
|
||
|
Expanded(
|
||
|
child: Center(
|
||
|
child: Text(
|
||
|
text,
|
||
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||
|
fontSize: 20,
|
||
|
fontWeight: MediaQuery.of(context).boldText ? FontWeight.w400 : FontWeight.w200,
|
||
2 years ago
|
color: MediaQuery.of(context).boldText ? foregroundWhite : foregroundColor,
|
||
2 years ago
|
),
|
||
|
textAlign: TextAlign.center,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Text(
|
||
|
caption,
|
||
|
style: CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
||
|
fontSize: 12,
|
||
2 years ago
|
color: MediaQuery.of(context).boldText ? foregroundWhite : foregroundColor,
|
||
2 years ago
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|