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.
 
 
 
 
 
 

34 lines
1.1 KiB

import 'package:flutter/widgets.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:info_tren/components/loading/loading_cupertino.dart';
import 'package:info_tren/components/loading/loading_fluent.dart';
import 'package:info_tren/components/loading/loading_material.dart';
import 'package:info_tren/models.dart';
import 'package:info_tren/providers.dart';
class Loading extends ConsumerWidget {
static const defaultText = 'Loading...';
final String? text;
const Loading({ super.key, this.text, });
@override
Widget build(BuildContext context, WidgetRef ref) {
final uiDesign = ref.watch(uiDesignProvider);
switch (uiDesign) {
case UiDesign.MATERIAL:
return LoadingMaterial(text: text ?? defaultText,);
case UiDesign.CUPERTINO:
return LoadingCupertino(text: text ?? defaultText,);
case UiDesign.FLUENT:
return LoadingFluent(text: text ?? defaultText,);
default:
throw UnmatchedUiDesignException(uiDesign);
}
}
}
abstract class LoadingCommon extends StatelessWidget {
final String text;
const LoadingCommon({required this.text, super.key,});
}