openai service

This commit is contained in:
2026-02-08 12:04:45 +06:00
parent 5c7b65a0d3
commit d7722ad81d
19 changed files with 1372 additions and 1008 deletions

View File

@@ -1,77 +1,55 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../models/models.dart';
import '../bloc/navigation_bloc.dart';
class BottomNav extends StatelessWidget {
const BottomNav({super.key});
final int currentIndex;
final ValueChanged<int> onTap;
const BottomNav({super.key, required this.currentIndex, required this.onTap});
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return BlocBuilder<NavigationBloc, NavigationState>(
builder: (context, state) {
final currentIndex = switch (state.screen) {
AppScreen.library ||
AppScreen.details ||
AppScreen.addBook ||
AppScreen.scanner => 0,
AppScreen.categories => 1,
AppScreen.wishlist => 2,
AppScreen.settings => 3,
};
return Container(
decoration: BoxDecoration(
color: colorScheme.surface,
border: Border(
top: BorderSide(color: colorScheme.outlineVariant, width: 1),
),
boxShadow: [
BoxShadow(
color: colorScheme.shadow,
blurRadius: 8,
offset: const Offset(0, -2),
),
],
return Container(
decoration: BoxDecoration(
color: colorScheme.surface,
border: Border(
top: BorderSide(color: colorScheme.outlineVariant, width: 1),
),
boxShadow: [
BoxShadow(
color: colorScheme.shadow,
blurRadius: 8,
offset: const Offset(0, -2),
),
child: BottomNavigationBar(
currentIndex: currentIndex,
backgroundColor: Colors.transparent,
elevation: 0,
selectedItemColor: colorScheme.primary,
unselectedItemColor: colorScheme.onSurface.withValues(alpha: 0.6),
onTap: (index) {
final screen = [
AppScreen.library,
AppScreen.categories,
AppScreen.wishlist,
AppScreen.settings,
][index];
context.read<NavigationBloc>().add(NavigateTo(screen));
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.local_library),
label: 'Библиотека',
),
BottomNavigationBarItem(
icon: Icon(Icons.category),
label: 'Категории',
),
BottomNavigationBarItem(
icon: Icon(Icons.bookmark),
label: 'Избранное',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Настройки',
),
],
],
),
child: BottomNavigationBar(
currentIndex: currentIndex,
onTap: onTap,
backgroundColor: Colors.transparent,
elevation: 0,
selectedItemColor: colorScheme.primary,
unselectedItemColor: colorScheme.onSurface.withValues(alpha: 0.6),
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.local_library),
label: 'Библиотека',
),
);
},
BottomNavigationBarItem(
icon: Icon(Icons.category),
label: 'Категории',
),
BottomNavigationBarItem(
icon: Icon(Icons.bookmark),
label: 'Избранное',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Настройки',
),
],
),
);
}
}