change: Settings button to appBar

This commit is contained in:
Christian Pauly 2021-02-25 13:24:07 +01:00
parent 4adb7f7ae0
commit 4860723748
5 changed files with 37 additions and 23 deletions

View File

@ -25,18 +25,13 @@ class DefaultBottomNavigationBar extends StatelessWidget {
AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/discover');
break;
case 3:
AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/settings');
break;
}
},
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
selectedItemColor: Theme.of(context).accentColor,
currentIndex: currentIndex,
//unselectedItemColor: Theme.of(context).textTheme.bodyText1.color,
type: BottomNavigationBarType.fixed,
showUnselectedLabels: false,
showUnselectedLabels: true,
items: [
BottomNavigationBarItem(
icon: Icon(currentIndex == 0 ? Icons.people : Icons.people_outlined),
@ -54,11 +49,6 @@ class DefaultBottomNavigationBar extends StatelessWidget {
: CupertinoIcons.compass),
label: L10n.of(context).discover,
),
BottomNavigationBarItem(
icon: Icon(
currentIndex == 3 ? Icons.settings : Icons.settings_outlined),
label: L10n.of(context).settings,
),
],
);
}

View File

@ -83,7 +83,6 @@ class App extends StatelessWidget {
'/',
'/discover',
'/contacts',
'/settings',
}.contains(settings.name)
? CupertinoPageRoute(builder: builder)
: FadeRoute(page: builder(context)),

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/connection_status_header.dart';
import 'package:fluffychat/components/default_app_bar_search_field.dart';
import 'package:fluffychat/components/default_bottom_navigation_bar.dart';
@ -188,7 +189,22 @@ class _ChatListState extends State<ChatList> {
AppBar(
elevation: 1,
leading: selectMode == SelectMode.normal
? null
? Center(
child: InkWell(
borderRadius: BorderRadius.circular(32),
child: FutureBuilder<Profile>(
future: Matrix.of(context).client.ownProfile,
builder: (_, snapshot) => Avatar(
snapshot.data?.avatarUrl ?? Uri.parse(''),
snapshot.data?.displayname ??
Matrix.of(context).client.userID.localpart,
size: 32,
),
),
onTap: () => AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/settings'),
),
)
: IconButton(
tooltip: L10n.of(context).cancel,
icon: Icon(Icons.close_outlined),
@ -360,8 +376,6 @@ class _ChatListState extends State<ChatList> {
.pushNamedAndRemoveUntilIsFirst('/newprivatechat'),
)
: null,
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: selectMode == SelectMode.normal
? DefaultBottomNavigationBar(currentIndex: 1)
: null,

View File

@ -62,7 +62,8 @@ class _ContactsState extends State<Contacts> {
@override
Widget build(BuildContext context) {
_onSync ??= Matrix.of(context).client.onSync.stream.listen((_) {
final client = Matrix.of(context).client;
_onSync ??= client.onSync.stream.listen((_) {
if (DateTime.now().millisecondsSinceEpoch -
_lastSetState.millisecondsSinceEpoch <
1000) {
@ -78,6 +79,10 @@ class _ContactsState extends State<Contacts> {
.where((p) =>
p.senderId.toLowerCase().contains(_controller.text.toLowerCase()))
.toList();
if (client.presences[client.userID]?.presence?.statusMsg?.isNotEmpty ??
false) {
contactList.add(client.presences[client.userID]);
}
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
@ -147,9 +152,8 @@ class _ContactsState extends State<Contacts> {
color: Theme.of(context).accentColor),
),
onPressed: () => FluffyShare.share(
L10n.of(context).inviteText(
Matrix.of(context).client.userID,
'https://matrix.to/#/${Matrix.of(context).client.userID}'),
L10n.of(context).inviteText(client.userID,
'https://matrix.to/#/${client.userID}'),
context),
),
),
@ -196,7 +200,13 @@ class _ContactListTile extends StatelessWidget {
),
),
title: Text(displayname),
subtitle: Text(contact.getLocalizedStatusMessage(context)),
subtitle: Text(contact.getLocalizedStatusMessage(context),
style: contact.presence.statusMsg?.isNotEmpty ?? false
? TextStyle(
color: Theme.of(context).accentColor,
fontWeight: FontWeight.bold,
)
: null),
onTap: () => AdaptivePageLayout.of(context).pushNamed(
'/rooms/${Matrix.of(context).client.getDirectChatFromUserId(contact.senderId)}'),
);

View File

@ -365,8 +365,10 @@ class _SettingsState extends State<Settings> {
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) =>
<Widget>[
SliverAppBar(
elevation: 1,
automaticallyImplyLeading: false,
leading: IconButton(
icon: Icon(Icons.close_outlined),
onPressed: () => AdaptivePageLayout.of(context).popUntilIsFirst(),
),
expandedHeight: 300.0,
floating: true,
pinned: true,
@ -590,7 +592,6 @@ class _SettingsState extends State<Settings> {
],
),
),
bottomNavigationBar: DefaultBottomNavigationBar(currentIndex: 3),
);
}
}