openai service
This commit is contained in:
@@ -62,8 +62,9 @@ class _BookCardState extends State<BookCard> {
|
||||
height: double.infinity,
|
||||
loadingBuilder:
|
||||
(context, child, loadingProgress) {
|
||||
if (loadingProgress == null)
|
||||
if (loadingProgress == null) {
|
||||
return child;
|
||||
}
|
||||
return ShimmerLoading(
|
||||
borderRadius: AppSpacing.radiusMedium,
|
||||
height: double.infinity,
|
||||
|
||||
@@ -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: 'Настройки',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'bottom_nav.dart';
|
||||
|
||||
class AppLayout extends StatelessWidget {
|
||||
final Widget child;
|
||||
final bool showBottomNav;
|
||||
|
||||
const AppLayout({super.key, required this.child, this.showBottomNav = true});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: child,
|
||||
bottomNavigationBar: showBottomNav ? const BottomNav() : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user