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.
 
 
 
 
 
 

59 lines
1.6 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:info_tren/components/badge/badge_cupertino.dart';
import 'package:info_tren/components/badge/badge_fluent.dart';
import 'package:info_tren/components/badge/badge_material.dart';
import 'package:info_tren/models.dart';
import 'package:info_tren/providers.dart';
class Badge extends ConsumerWidget {
final String text;
final String caption;
final bool isNotScheduled;
final bool isOnTime;
final bool isDelayed;
const Badge({
super.key,
required this.text,
required this.caption,
this.isNotScheduled = false,
this.isOnTime = false,
this.isDelayed = false,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final uiDesign = ref.watch(uiDesignProvider);
switch (uiDesign) {
case UiDesign.MATERIAL:
return MaterialBadge(
text: text,
caption: caption,
isNotScheduled: isNotScheduled,
isOnTime: isOnTime,
isDelayed: isDelayed,
);
case UiDesign.CUPERTINO:
return CupertinoBadge(
text: text,
caption: caption,
isNotScheduled: isNotScheduled,
isOnTime: isOnTime,
isDelayed: isDelayed,
);
case UiDesign.FLUENT:
return FluentBadge(
text: text,
caption: caption,
isNotScheduled: isNotScheduled,
isOnTime: isOnTime,
isDelayed: isDelayed,
);
default:
throw UnmatchedUiDesignException(uiDesign);
}
}
}