2022-06-16 20:30:02 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-07-03 13:47:24 +00:00
|
|
|
import 'package:localization/localization.dart';
|
2022-07-03 14:56:41 +00:00
|
|
|
import 'package:slothmu/dialogues/makepost.dart';
|
2022-07-02 22:03:10 +00:00
|
|
|
import 'package:slothmu/pages/chat/chat.dart';
|
|
|
|
import 'package:slothmu/pages/notifications/notifications.dart';
|
2022-06-16 20:30:02 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-07-02 22:03:10 +00:00
|
|
|
final screens = [
|
2022-07-04 17:37:53 +00:00
|
|
|
const Timeline(),
|
2022-07-02 22:03:10 +00:00
|
|
|
chat(context),
|
|
|
|
notifications(context),
|
|
|
|
settings(context),
|
|
|
|
];
|
|
|
|
final buttons = [
|
|
|
|
FloatingActionButton(
|
2022-07-03 20:02:57 +00:00
|
|
|
child: const Icon(Icons.create),
|
2022-07-03 14:56:41 +00:00
|
|
|
onPressed: () => showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (context) => const MakePost(),
|
|
|
|
),
|
2022-07-02 22:03:10 +00:00
|
|
|
),
|
|
|
|
FloatingActionButton(
|
|
|
|
onPressed: () {},
|
|
|
|
child: const Icon(Icons.person_add),
|
|
|
|
),
|
|
|
|
FloatingActionButton(
|
|
|
|
onPressed: () {},
|
|
|
|
child: const Icon(Icons.clear_all),
|
|
|
|
),
|
|
|
|
null,
|
|
|
|
];
|
2022-06-16 20:30:02 +00:00
|
|
|
return Scaffold(
|
2022-07-02 22:03:10 +00:00
|
|
|
extendBody: true,
|
2022-06-16 20:30:02 +00:00
|
|
|
body: screens[index],
|
2022-07-02 22:03:10 +00:00
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
floatingActionButton: buttons[index],
|
|
|
|
bottomNavigationBar: BottomAppBar(
|
|
|
|
child: NavigationBar(
|
|
|
|
onDestinationSelected: (index) =>
|
|
|
|
setState(() => this.index = index),
|
|
|
|
selectedIndex: index,
|
2022-07-03 13:47:24 +00:00
|
|
|
destinations: [
|
2022-07-02 22:03:10 +00:00
|
|
|
NavigationDestination(
|
2022-07-03 13:47:24 +00:00
|
|
|
icon: const Icon(Icons.forum), label: "timeline".i18n()),
|
2022-07-02 22:03:10 +00:00
|
|
|
NavigationDestination(
|
2022-07-03 13:47:24 +00:00
|
|
|
icon: const Icon(Icons.chat), label: "chat".i18n()),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: const Icon(Icons.notifications),
|
|
|
|
label: "notifications".i18n()),
|
|
|
|
NavigationDestination(
|
|
|
|
icon: const Icon(Icons.settings), label: "settings".i18n()),
|
2022-07-02 22:03:10 +00:00
|
|
|
]),
|
|
|
|
),
|
2022-06-16 20:30:02 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|