Calculator Screens
ScreenOne (DiscountCalculatorScreen)
The discount calculator screen provides a form-based interface for calculating discounts with support for multiple discount types, additional discounts, and tax.Features
- Discount Type Toggle: Switch between percentage and fixed-amount discounts
- Form Validation: Validates numeric inputs and ranges
- Persistent State: Restores previous inputs from the provider
- Real-time Calculations: Updates results as discount type changes
- Results Display: Shows original price, savings, subtotal, tax, and final price
- Clear Function: Reset button to clear all inputs and results
Form Fields
The original price before any discounts. Required field with decimal validation.
The primary discount value. Label and icon change based on discount type.
Optional additional discount applied sequentially (percentage) or summed (fixed).
Optional tax percentage (IVA) applied to the subtotal.
Usage
UI Components
- Form validation with inline error messages
- Card-based layout with elevation
- Currency formatting (
$XX.XX) - Color-coded results (green for savings, red for tax)
- Responsive padding and spacing
- App bar with refresh action
ScreenTwo (SalesPriceCalculatorScreen)
The sales price calculator screen helps determine selling prices based on cost and desired profit margins.Features
- Margin Type Toggle: Switch between markup (profit on cost) and margin (profit on sales)
- Form Validation: Validates cost and profit percentage inputs
- Persistent State: Automatically restores previous calculations
- Financial Summary: Displays base price, profit amount, tax, and final selling price
- Clear Function: Reset button to start a new calculation
Form Fields
The base cost of the product. Required field with decimal validation.
The desired profit percentage. Interpretation depends on margin type.
Optional tax percentage (IVA) applied to the base sale price.
Usage
Margin Type Display
The toggle shows:- “Sobre Costo” (Markup): Profit calculated as percentage of cost
- “Sobre Venta (Pro)” (Margin): Profit calculated as percentage of selling price
Placeholder Screens
ScreenThree (ProductInventoryScreen)
A placeholder screen for future product inventory management functionality.Current Implementation
Displays:- Large inventory icon
- Welcome message
- “Return to Home” button
Usage
This screen is a placeholder and will be expanded in future releases to include product catalog management, stock tracking, and inventory operations.
ScreenFour (SalesHistoryScreen)
A placeholder screen for future sales history and reporting functionality.Current Implementation
Displays:- Large history icon
- Welcome message
- “Return to Home” button
Usage
This screen is a placeholder and will be expanded in future releases to include sales transaction history, analytics, and reporting features.
Navigation Screens
MyHomePage
The main navigation hub with animated menu buttons for accessing all features.Properties
The title displayed in the app bar (typically “Calculadora Numix”)
Features
- Responsive Layout: Adapts button width based on screen size
- Smooth Animations: Scale animation on hover using
MouseRegion - Theme Toggle: Switch between light and dark mode
- Centered Title: Displays app name in the app bar
- Menu Buttons: Four large, accessible buttons for main features
Menu Items
-
Calculadora de Descuentos (Discount Calculator)
- Icon:
Icons.discount - Navigates to
ScreenOne
- Icon:
-
Calculadora Precios Venta (Sales Price Calculator)
- Icon:
Icons.price_change - Navigates to
ScreenTwo
- Icon:
-
Inventario de Productos (Product Inventory)
- Icon:
Icons.inventory - Navigates to
ScreenThree
- Icon:
-
Historial de Ventas (Sales History)
- Icon:
Icons.history - Navigates to
ScreenFour
- Icon:
Usage
Button Styling
- Adaptive width: 70% on desktop (>600px), 90% on mobile
- Minimum height: 80px
- Rounded corners with 15px radius
- Elevation: 4
- Row layout with icon, text, and arrow
WelcomeScreen
An animated splash screen that displays the Numix logo and automatically navigates to the home page.Features
- Fade Animation: 2-second fade-in animation for the logo and text
- Auto Navigation: Automatically navigates to
MyHomePageafter 3 seconds - Centered Layout: Logo and app name centered on screen
- Smooth Transition: Uses
pushReplacementto prevent back navigation
Implementation Details
- Uses
SingleTickerProviderStateMixinfor animation controller - Animation duration: 2 seconds
- Display duration: 3 seconds total
- Fade opacity: 0 to 1
Usage
UI Components
- Large calculator icon (100px, blue color)
- “¡Numix!” title text (32px, bold)
- 20px spacing between elements
Common Patterns
Form Validation
All calculator screens useGlobalKey<FormState> for form validation:
Text Input Formatting
Numeric inputs useFilteringTextInputFormatter to allow only decimal numbers:
- Allows digits 0-9
- Allows one optional decimal point
- Limits to 2 decimal places
Currency Formatting
All screens format currency values consistently:Provider Integration
Screens useConsumer widgets to react to provider state changes:
State Restoration
Calculator screens restore previous inputs on initialization:Screen Transitions
All screens use standardMaterialPageRoute for navigation:
pushReplacement to prevent returning to the splash: