Initial commit - app-padrao-1.0
This commit is contained in:
94
lib/core/constants/app_strings.dart
Normal file
94
lib/core/constants/app_strings.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
// Textos em Português-BR
|
||||
class AppStrings {
|
||||
// App
|
||||
static const String appName = 'Barber App';
|
||||
|
||||
// Login
|
||||
static const String login = 'Entrar';
|
||||
static const String email = 'E-mail';
|
||||
static const String password = 'Senha';
|
||||
static const String confirmPassword = 'Confirmar Senha';
|
||||
static const String forgotPassword = 'Esqueci minha senha';
|
||||
static const String createAccount = 'Criar Conta';
|
||||
static const String alreadyHaveAccount = 'Já tenho uma conta';
|
||||
static const String barberName = 'Nome do Barbeiro';
|
||||
static const String barberShopName = 'Nome da Barbearia';
|
||||
|
||||
// Navegação
|
||||
static const String home = 'Início';
|
||||
static const String haircuts = 'Cortes';
|
||||
static const String products = 'Produtos';
|
||||
static const String finances = 'Finanças';
|
||||
static const String settings = 'Configurações';
|
||||
|
||||
// Cortes
|
||||
static const String newHaircut = 'Novo Corte';
|
||||
static const String clientName = 'Nome do Cliente';
|
||||
static const String serviceType = 'Tipo de Serviço';
|
||||
static const String price = 'Valor';
|
||||
static const String notes = 'Observações';
|
||||
static const String date = 'Data';
|
||||
static const String time = 'Hora';
|
||||
static const String todayHaircuts = 'Cortes Hoje';
|
||||
static const String weekHaircuts = 'Cortes da Semana';
|
||||
static const String monthHaircuts = 'Cortes do Mês';
|
||||
|
||||
// Produtos
|
||||
static const String newProduct = 'Novo Produto';
|
||||
static const String productName = 'Nome do Produto';
|
||||
static const String category = 'Categoria';
|
||||
static const String quantity = 'Quantidade';
|
||||
static const String purchasePrice = 'Preço de Compra';
|
||||
static const String salePrice = 'Preço de Venda';
|
||||
static const String minStock = 'Estoque Mínimo';
|
||||
static const String lowStock = 'Estoque Baixo';
|
||||
|
||||
// Categorias de Produtos
|
||||
static const String categoryPastes = 'Pastas e Pomadas';
|
||||
static const String categoryBeverages = 'Bebidas (Frigobar)';
|
||||
static const String categoryAccessories = 'Acessórios';
|
||||
static const String categoryOther = 'Outros';
|
||||
|
||||
// Finanças
|
||||
static const String revenue = 'Receitas';
|
||||
static const String expenses = 'Despesas';
|
||||
static const String balance = 'Saldo';
|
||||
static const String accountsReceivable = 'A Receber';
|
||||
static const String accountsPayable = 'A Pagar';
|
||||
static const String newExpense = 'Nova Despesa';
|
||||
static const String newRevenue = 'Nova Receita';
|
||||
static const String description = 'Descrição';
|
||||
static const String dueDate = 'Data de Vencimento';
|
||||
static const String paid = 'Pago';
|
||||
static const String pending = 'Pendente';
|
||||
static const String markAsPaid = 'Marcar como Pago';
|
||||
|
||||
// Configurações
|
||||
static const String changeLogo = 'Alterar Logo';
|
||||
static const String changeColors = 'Alterar Cores';
|
||||
static const String primaryColor = 'Cor Principal';
|
||||
static const String logout = 'Sair';
|
||||
static const String profile = 'Perfil';
|
||||
|
||||
// Ações
|
||||
static const String save = 'Salvar';
|
||||
static const String cancel = 'Cancelar';
|
||||
static const String delete = 'Excluir';
|
||||
static const String edit = 'Editar';
|
||||
static const String confirm = 'Confirmar';
|
||||
static const String add = 'Adicionar';
|
||||
static const String search = 'Buscar';
|
||||
static const String filter = 'Filtrar';
|
||||
|
||||
// Mensagens
|
||||
static const String success = 'Sucesso!';
|
||||
static const String error = 'Erro!';
|
||||
static const String confirmDelete = 'Tem certeza que deseja excluir?';
|
||||
static const String savedSuccessfully = 'Salvo com sucesso!';
|
||||
static const String deletedSuccessfully = 'Excluído com sucesso!';
|
||||
static const String fillAllFields = 'Preencha todos os campos obrigatórios';
|
||||
static const String invalidEmail = 'E-mail inválido';
|
||||
static const String weakPassword = 'Senha muito fraca (mínimo 6 caracteres)';
|
||||
static const String passwordsDontMatch = 'As senhas não conferem';
|
||||
static const String loginError = 'Erro ao fazer login. Verifique suas credenciais.';
|
||||
}
|
||||
97
lib/core/database/database_service.dart
Normal file
97
lib/core/database/database_service.dart
Normal file
@@ -0,0 +1,97 @@
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:barber_app/features/auth/data/models/user_model.dart';
|
||||
import 'package:barber_app/features/haircuts/data/models/haircut_model.dart';
|
||||
import 'package:barber_app/features/products/data/models/product_model.dart';
|
||||
import 'package:barber_app/features/finances/data/models/transaction_model.dart';
|
||||
import 'package:barber_app/features/services/data/models/service_model.dart';
|
||||
import 'package:barber_app/features/settings/data/models/settings_model.dart';
|
||||
|
||||
class DatabaseService {
|
||||
static const String usersBox = 'users';
|
||||
static const String haircutsBox = 'haircuts';
|
||||
static const String productsBox = 'products';
|
||||
static const String transactionsBox = 'transactions';
|
||||
static const String settingsBox = 'settings';
|
||||
static const String servicesBox = 'services';
|
||||
static const String currentUserBox = 'currentUser';
|
||||
|
||||
static bool _initialized = false;
|
||||
|
||||
static Future<void> init() async {
|
||||
if (_initialized) return;
|
||||
|
||||
await Hive.initFlutter();
|
||||
|
||||
// Registra os adapters apenas se não foram registrados
|
||||
if (!Hive.isAdapterRegistered(0)) {
|
||||
Hive.registerAdapter(UserModelAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(1)) {
|
||||
Hive.registerAdapter(HaircutModelAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(2)) {
|
||||
Hive.registerAdapter(ProductModelAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(3)) {
|
||||
Hive.registerAdapter(TransactionTypeAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(4)) {
|
||||
Hive.registerAdapter(TransactionModelAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(5)) {
|
||||
Hive.registerAdapter(SettingsModelAdapter());
|
||||
}
|
||||
if (!Hive.isAdapterRegistered(6)) {
|
||||
Hive.registerAdapter(ServiceModelAdapter());
|
||||
}
|
||||
|
||||
// Abre as boxes
|
||||
await Hive.openBox<UserModel>(usersBox);
|
||||
await Hive.openBox<HaircutModel>(haircutsBox);
|
||||
await Hive.openBox<ProductModel>(productsBox);
|
||||
await Hive.openBox<TransactionModel>(transactionsBox);
|
||||
await Hive.openBox<SettingsModel>(settingsBox);
|
||||
await Hive.openBox<ServiceModel>(servicesBox);
|
||||
await Hive.openBox(currentUserBox);
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
// User Box
|
||||
static Box<UserModel> get usersBoxInstance => Hive.box<UserModel>(usersBox);
|
||||
|
||||
// Haircuts Box
|
||||
static Box<HaircutModel> get haircutsBoxInstance => Hive.box<HaircutModel>(haircutsBox);
|
||||
|
||||
// Products Box
|
||||
static Box<ProductModel> get productsBoxInstance => Hive.box<ProductModel>(productsBox);
|
||||
|
||||
// Transactions Box
|
||||
static Box<TransactionModel> get transactionsBoxInstance => Hive.box<TransactionModel>(transactionsBox);
|
||||
|
||||
// Settings Box
|
||||
static Box<SettingsModel> get settingsBoxInstance => Hive.box<SettingsModel>(settingsBox);
|
||||
|
||||
// Services Box
|
||||
static Box<ServiceModel> get servicesBoxInstance => Hive.box<ServiceModel>(servicesBox);
|
||||
|
||||
// Current User
|
||||
static Box get currentUserBoxInstance => Hive.box(currentUserBox);
|
||||
|
||||
// Métodos de sessão
|
||||
static Future<void> setCurrentUserId(String? userId) async {
|
||||
if (userId == null) {
|
||||
await currentUserBoxInstance.delete('currentUserId');
|
||||
} else {
|
||||
await currentUserBoxInstance.put('currentUserId', userId);
|
||||
}
|
||||
}
|
||||
|
||||
static String? getCurrentUserId() {
|
||||
return currentUserBoxInstance.get('currentUserId');
|
||||
}
|
||||
|
||||
static bool isLoggedIn() {
|
||||
return getCurrentUserId() != null;
|
||||
}
|
||||
}
|
||||
115
lib/core/theme/app_theme.dart
Normal file
115
lib/core/theme/app_theme.dart
Normal file
@@ -0,0 +1,115 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class AppColors {
|
||||
// Cores Base - Premium Cyber Gold
|
||||
static Color primaryColor = const Color(0xFFD4AF37);
|
||||
static const Color background = Color(0xFF080808); // Ultra Dark
|
||||
static const Color surface = Color(0xFF121212);
|
||||
static const Color surfaceLight = Color(0xFF1C1C1C);
|
||||
|
||||
// Cores Semânticas
|
||||
static const Color success = Color(0xFF00C853);
|
||||
static const Color error = Color(0xFFFF1744);
|
||||
static const Color warning = Color(0xFFFFAB00);
|
||||
static const Color info = Color(0xFF2979FF);
|
||||
|
||||
// Texto
|
||||
static const Color textPrimary = Colors.white;
|
||||
static const Color textSecondary = Color(0xFF8E8E93);
|
||||
|
||||
static void updatePrimaryColor(Color color) {
|
||||
primaryColor = color;
|
||||
}
|
||||
|
||||
static List<BoxShadow> get premiumShadow => [
|
||||
BoxShadow(
|
||||
color: Colors.black.withAlpha(50),
|
||||
blurRadius: 30,
|
||||
offset: const Offset(0, 15),
|
||||
),
|
||||
];
|
||||
|
||||
static LinearGradient get goldGradient => LinearGradient(
|
||||
colors: [primaryColor, primaryColor.withAlpha(200)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
);
|
||||
}
|
||||
|
||||
class AppTheme {
|
||||
static ThemeData get darkTheme {
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
scaffoldBackgroundColor: AppColors.background,
|
||||
primaryColor: AppColors.primaryColor,
|
||||
colorScheme: ColorScheme.dark(
|
||||
primary: AppColors.primaryColor,
|
||||
surface: AppColors.surface,
|
||||
error: AppColors.error,
|
||||
onPrimary: Colors.black,
|
||||
),
|
||||
|
||||
textTheme: GoogleFonts.outfitTextTheme(ThemeData.dark().textTheme)
|
||||
.copyWith(
|
||||
displayLarge: GoogleFonts.outfit(
|
||||
color: AppColors.textPrimary,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 34,
|
||||
letterSpacing: -1,
|
||||
),
|
||||
headlineMedium: GoogleFonts.outfit(
|
||||
color: AppColors.textPrimary,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: -0.5,
|
||||
),
|
||||
bodyLarge: GoogleFonts.inter(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
appBarTheme: AppBarTheme(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
centerTitle: false,
|
||||
titleTextStyle: GoogleFonts.outfit(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
|
||||
cardTheme: CardThemeData(
|
||||
color: AppColors.surface,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
side: BorderSide(color: Colors.white.withAlpha(10), width: 1),
|
||||
),
|
||||
),
|
||||
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryColor,
|
||||
foregroundColor: Colors.black,
|
||||
elevation: 10,
|
||||
shadowColor: AppColors.primaryColor.withAlpha(100),
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 30),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
textStyle: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static ThemeData get lightTheme =>
|
||||
darkTheme; // For simplicity, focusing on Dark Mode Elite
|
||||
}
|
||||
15
lib/core/utils/password_utils.dart
Normal file
15
lib/core/utils/password_utils.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
class PasswordUtils {
|
||||
// Hash simples para senha (para produção real, usar bcrypt)
|
||||
static String hashPassword(String password) {
|
||||
final bytes = utf8.encode(password);
|
||||
final digest = sha256.convert(bytes);
|
||||
return digest.toString();
|
||||
}
|
||||
|
||||
static bool verifyPassword(String password, String hash) {
|
||||
return hashPassword(password) == hash;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user