1
0
mirror of https://github.com/krawieck/lemmur/ synced 2024-12-12 00:26:23 +01:00
lemmur-app-android/lib/pages/home_page.dart
Marcin Wojnarowski 9f9cc52cf5
Feature/logging (#251)
* Add logging package

* Refresh linux files

* Android flavor setup

* Setup ios flavors

* Setup release CI

* Refactor CI

* Remove debug prints

* Create prod signingConfig only if exists

* Store recent logs

* Remove flavoring on desktop

* Fix android signing

* Fix release paths (except windows)

* Quote secret var

* debug

* Fix env vars

* Add log console

* Add logs section in bug issue template

* Add time to logs

* Add changelog entry

* Rename log console

* Remove key

* Change way of routing

* Add title
2021-09-23 19:25:03 +02:00

86 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../util/extensions/brightness.dart';
import 'communities_tab.dart';
import 'create_post.dart';
import 'home_tab.dart';
import 'profile_tab.dart';
import 'search_tab.dart';
class HomePage extends HookWidget {
const HomePage();
static const List<Widget> pages = [
HomeTab(),
CommunitiesTab(),
SearchTab(),
UserProfileTab(),
];
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final currentTab = useState(0);
useEffect(() {
Future.microtask(
() => SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: theme.scaffoldBackgroundColor,
systemNavigationBarIconBrightness: theme.brightness.reverse,
)),
);
return null;
}, [theme.scaffoldBackgroundColor]);
var tabCounter = 0;
tabButton(IconData icon) {
final tabNum = tabCounter++;
return IconButton(
icon: Icon(icon),
color: tabNum == currentTab.value ? theme.colorScheme.secondary : null,
onPressed: () => currentTab.value = tabNum,
);
}
return Scaffold(
extendBody: true,
body: Column(
children: [
Expanded(
child: IndexedStack(
index: currentTab.value,
children: pages,
),
),
const SizedBox(height: kMinInteractiveDimension / 2),
],
),
floatingActionButton: const CreatePostFab(),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: BottomAppBar(
shape: const CircularNotchedRectangle(),
notchMargin: 7,
child: SizedBox(
height: 60,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
tabButton(Icons.home),
tabButton(Icons.list),
const SizedBox.shrink(),
const SizedBox.shrink(),
tabButton(Icons.search),
tabButton(Icons.person),
],
),
),
),
);
}
}