65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../widgets/app_logo.dart';
|
|
import '../widgets/sidebar_nav.dart';
|
|
|
|
class MainLayout extends StatefulWidget {
|
|
const MainLayout({super.key});
|
|
|
|
@override
|
|
State<MainLayout> createState() => _MainLayoutState();
|
|
}
|
|
|
|
class _MainLayoutState extends State<MainLayout> {
|
|
int _selectedIndex = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body:
|
|
Row(
|
|
children: [
|
|
Container(
|
|
width: 300,
|
|
color: Colors.grey[200],
|
|
child:
|
|
Column(
|
|
children: [
|
|
const AppLogo(),
|
|
Expanded(
|
|
child: SidebarNav(
|
|
selectedIndex: 0,
|
|
onItemSelected: (index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
},
|
|
)
|
|
)
|
|
]),
|
|
),
|
|
Expanded(
|
|
child: _buildContent(),
|
|
),
|
|
]
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildContent() {
|
|
switch (_selectedIndex) {
|
|
case 0:
|
|
return const Text('Home');
|
|
case 1:
|
|
return const Text('SoundSources');
|
|
case 2:
|
|
return const Text('Listen');
|
|
case 3:
|
|
return const Text('Settings');
|
|
case 4:
|
|
return const Text('About');
|
|
default:
|
|
return const Text('Home');
|
|
}
|
|
}
|
|
} |