Scobro Foundation Flutter
A comprehensive foundational Flutter package that provides reusable widgets, services, and framework components to accelerate Flutter application development.
Features
π Authentication
- User Login Screen: Pre-built login interface with form validation
- Authentication Service: Centralized authentication management
- Authorized Widget: Wrapper for protecting authenticated content
- User Management: Complete user model and service layer
π HTTP & API Services
- Web Request Service: Robust HTTP client with error handling
- API Configuration: Centralized API endpoint management
- Response Handling: Structured response processing with DTOs
π¨ UI Components
- Layout Widgets: Responsive layout components including
ConstrainedCentered
- Loading Panels: Consistent loading states across the app
- Error Panels: Standardized error display and handling
- Workflow Components: Multi-step workflow management with progress indicators
- Menu Components: Bottom sheets and menu utilities
ποΈ Framework & Architecture
- MVVM Framework: Base classes for ViewModels and ViewStates
- Riverpod Integration: Built-in state management with Riverpod
- App Services: Application lifecycle and initialization services
- Core Services: Centralized service management
π± Responsive Design
- Layout Wrapper: Responsive layout system for different screen sizes
- Mobile/Tablet/Desktop: Optimized layouts for various devices
- Constrained Layouts: Width-constrained centered layouts
Getting Started
Prerequisites
- Flutter SDK ^3.6.1
- Dart SDK ^3.6.1
Installation
Add this to your package's pubspec.yaml
file:
dependencies:
scobro_foundation_flutter: ^0.0.1
Dependencies
This package includes the following dependencies:
flutter_riverpod: ^2.6.1
- State managementloading_animation_widget: ^1.3.0
- Loading animationsflutter_svg: ^2.1.0
- SVG supporthttp: ^1.3.0
- HTTP clientrequests_plus: ^4.8.6
- Enhanced HTTP requests
Usage
Authentication
import 'package:scobro_foundation_flutter/authentication/user_login_screen.dart';
// Use the pre-built login screen
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: UserLogin(),
);
}
}
Layout Components
import 'package:scobro_foundation_flutter/widgets/layout/constrained_centered.dart';
// Create a centered, width-constrained layout
ConstrainedCentered(
width: 600,
child: Card(
child: Padding(
padding: EdgeInsets.all(16),
child: Text('Your content here'),
),
),
)
Loading and Error States
import 'package:scobro_foundation_flutter/widgets/loading_panel.dart';
import 'package:scobro_foundation_flutter/widgets/error_panel.dart';
// Wrap content with loading and error handling
LoadingPanel(
isLoading: isLoading,
childBuilder: (context) => ErrorPanel(
viewModel: viewModel,
state: state,
child: YourContent(),
),
)
MVVM Framework
import 'package:scobro_foundation_flutter/framework/view_model_bases.dart';
// Create a ViewModel
class MyViewModel extends ViewModelBase<MyViewState> {
@override
MyViewState build() => MyViewState();
Future<void> loadData() async {
await executeOperation(
() => apiService.getData(),
(result) => state = state.withData(result),
);
}
}
Workflow Components
import 'package:scobro_foundation_flutter/widgets/work_flows/work_flow.dart';
// Create a multi-step workflow
final steps = [
WorkflowStep(
id: 'step1',
title: 'Step 1',
description: 'First step description',
shortTitle: 'Step 1',
contentBuilder: (context) => Step1Content(),
),
// ... more steps
];
WorkflowWidget(
state: workflowState,
viewModel: workflowViewModel,
steps: steps,
)
Project Structure
lib/
βββ authentication/ # User authentication components
βββ core_services/ # Application lifecycle services
βββ core_widgets/ # Basic reusable widgets
βββ framework/ # MVVM framework base classes
βββ http/ # HTTP and API services
βββ widgets/ # UI components
βββ containers/ # Container widgets
βββ layout/ # Layout components
βββ lists/ # List-related widgets
βββ menus/ # Menu components
βββ work_flows/ # Workflow management
Additional Information
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Issues and Support
- Report bugs and feature requests through GitHub issues
- For questions and support, please open an issue with the appropriate label
License
This project is licensed under the MIT License - see the LICENSE file for details.
Version History
See CHANGELOG.md for a complete version history.
Libraries
- authentication/auth_service
- authentication/commands/google_sign_in_command
- authentication/dtos/get_current_user_details_result
- authentication/dtos/google_sign_in_command
- authentication/dtos/user_login_command
- authentication/dtos/user_login_command_result
- authentication/google_sign_in_services
- authentication/queries/get_current_user_details_query
- authentication/user_login_screen
- authentication/user_login_view_model
- authentication/user_model
- authentication/user_service
- core_services/app_configuration_service
- core_services/app_initialization_service
- core_services/app_manager_service
- core_services/app_sections
- core_services/app_startup_service
- core_services/app_web_request_services
- core_services/core_services
- core_widgets/app_wrap
- core_widgets/screen_wrap
- framework/loadable_state
- framework/view_model_bases
- framework/view_state_base
- http/api_config
- http/paging_models
- http/query_string_builder
- http/web_request_response
- http/web_request_service
- http/web_requests
- scobro_foundation_flutter
- widgets/centered_message
- widgets/containers/simple_box
- widgets/error_panel
- widgets/layout/conditional_view
- widgets/layout/constrained_centered
- widgets/layout/dialog_view
- widgets/layout/page_layout
- widgets/layout/parent_required
- widgets/layout/responsive_layout_wrapper
- widgets/layout/scaffolding
- widgets/layout/tabbed_header
- widgets/lists/list_container
- widgets/lists/list_view_wrapper
- widgets/lists/stack
- widgets/loading_panel
- widgets/menus/bottom_sheets
- widgets/work_flows/work_flow
- widgets/work_flows/work_flow_state
- widgets/work_flows/work_flow_step_indicator