loris/lib/partials/main_scaffold.dart
2022-06-16 22:30:02 +02:00

40 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:slothmu/pages/chat/%20chat.dart';
import 'package:slothmu/pages/timeline/timeline.dart';
import 'package:slothmu/pages/settings/settings.dart';
class MainScaffold extends StatefulWidget {
const MainScaffold({Key? key}) : super(key: key);
@override
State<MainScaffold> createState() => _MainScaffoldState();
}
class _MainScaffoldState extends State<MainScaffold> {
int index = 0;
final screens = [
Timeline(),
Chat(),
Settings(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: screens[index],
bottomNavigationBar: NavigationBar(
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
elevation: 0,
height: 60,
onDestinationSelected: (index) => setState(() => this.index = index),
selectedIndex: index,
destinations: const [
NavigationDestination(
icon: Icon(Icons.list_alt), label: "Timeline"),
NavigationDestination(icon: Icon(Icons.chat), label: "Chat"),
NavigationDestination(
icon: Icon(Icons.settings), label: "Settings"),
]),
);
}
}