build abstract method
Builds the primary content widget for the view.
This method is the core rendering method for the view, responsible for creating the main UI when data is successfully loaded and the view is in a ready state.
Parameters:
context
: The current BuildContext for widget renderingviewModel
: The ViewModel associated with this view, providing data and state for rendering
Returns: A Widget representing the primary content of the view
Example:
@override
Widget build(BuildContext context, UserViewModel viewModel) {
return Scaffold(
appBar: AppBar(title: Text('User Profile')),
body: ListView(
children: [
Text(viewModel.userName),
Text(viewModel.userEmail),
],
),
);
}
Recommended Practices:
- Keep the method focused on rendering
- Delegate complex logic to the ViewModel
- Ensure the widget is responsive and adapts to different screen sizes
Implementation
@protected
Widget build(BuildContext context, TViewModel viewModel);