runable
This commit is contained in:
55
lib/app.dart
Normal file
55
lib/app.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'core/theme/app_theme.dart';
|
||||
import 'features/home/presentation/pages/home_page.dart';
|
||||
import 'features/products/presentation/pages/products_page.dart';
|
||||
import 'features/categories/presentation/pages/categories_page.dart';
|
||||
import 'features/settings/presentation/pages/settings_page.dart';
|
||||
import 'features/settings/presentation/providers/theme_provider.dart';
|
||||
import 'shared/widgets/app_bottom_nav.dart';
|
||||
|
||||
/// Root application widget
|
||||
class RetailApp extends ConsumerStatefulWidget {
|
||||
const RetailApp({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<RetailApp> createState() => _RetailAppState();
|
||||
}
|
||||
|
||||
class _RetailAppState extends ConsumerState<RetailApp> {
|
||||
int _currentIndex = 0;
|
||||
|
||||
final List<Widget> _pages = const [
|
||||
HomePage(),
|
||||
ProductsPage(),
|
||||
CategoriesPage(),
|
||||
SettingsPage(),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeMode = ref.watch(themeModeFromThemeProvider);
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Retail POS',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme(),
|
||||
darkTheme: AppTheme.darkTheme(),
|
||||
themeMode: themeMode,
|
||||
home: Scaffold(
|
||||
body: IndexedStack(
|
||||
index: _currentIndex,
|
||||
children: _pages,
|
||||
),
|
||||
bottomNavigationBar: AppBottomNav(
|
||||
currentIndex: _currentIndex,
|
||||
onTap: (index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user