Flutter · colveor_ui
Base Screens
Base State classes give screens direct access to theme, screen size, navigation and toasts.
Base classes
Dart
class _ProfileScreenState extends VoState<ProfileScreen> {
@override
Widget build(BuildContext context) =>
VoButton(label: 'Edit', onPressed: () => push('/profile/edit'));
}
class _OrdersScreenState extends VoConsumerState<OrdersScreen> {
@override
void beforeBuild(BuildContext context, WidgetRef ref) {
// runs before every build
}
@override
Widget buildView(BuildContext context, WidgetRef ref) =>
Text('Hello', style: typography.titleLarge);
}| Name | Description |
|---|---|
VoState | Extends State. Override build as usual. |
VoConsumerState | Extends ConsumerState. Override buildView(context, ref), with an optional beforeBuild hook — or override build directly. |
Stateless widgets
There is no stateless base class. In a StatelessWidget or ConsumerWidget, use context.vo, which offers the same members:
Dart
VoButton(
label: 'Save',
onPressed: () => context.vo.showSuccessToast('Saved'),
)Available members
| Name | Description |
|---|---|
Theme | theme, colorScheme, flutterTextTheme, colors, sizes, typography, componentTheme, isDarkMode. |
Screen | mediaQuery, screenSize, screenWidth, screenHeight, safePadding, isPhone (<600), isTablet (≥600), isDesktop (≥1024). |
Navigation | router, push, pushReplace, pushAndClearStack, pop, currentPath, canPop. |
Toasts | showSuccessToast, showErrorToast, showWarningToast, showInfoToast, showToast, dismissAllToasts. |
Other | messenger, showSnackBar, unfocus. |