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) AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/discover'); .pushNamedAndRemoveUntilIsFirst('/discover');
break; break;
case 3:
AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/settings');
break;
} }
}, },
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
selectedItemColor: Theme.of(context).accentColor, selectedItemColor: Theme.of(context).accentColor,
currentIndex: currentIndex, currentIndex: currentIndex,
//unselectedItemColor: Theme.of(context).textTheme.bodyText1.color,
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
showUnselectedLabels: false, showUnselectedLabels: true,
items: [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(currentIndex == 0 ? Icons.people : Icons.people_outlined), icon: Icon(currentIndex == 0 ? Icons.people : Icons.people_outlined),
@ -54,11 +49,6 @@ class DefaultBottomNavigationBar extends StatelessWidget {
: CupertinoIcons.compass), : CupertinoIcons.compass),
label: L10n.of(context).discover, 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', '/discover',
'/contacts', '/contacts',
'/settings',
}.contains(settings.name) }.contains(settings.name)
? CupertinoPageRoute(builder: builder) ? CupertinoPageRoute(builder: builder)
: FadeRoute(page: builder(context)), : FadeRoute(page: builder(context)),

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:adaptive_page_layout/adaptive_page_layout.dart'; import 'package:adaptive_page_layout/adaptive_page_layout.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/connection_status_header.dart'; import 'package:fluffychat/components/connection_status_header.dart';
import 'package:fluffychat/components/default_app_bar_search_field.dart'; import 'package:fluffychat/components/default_app_bar_search_field.dart';
import 'package:fluffychat/components/default_bottom_navigation_bar.dart'; import 'package:fluffychat/components/default_bottom_navigation_bar.dart';
@ -188,7 +189,22 @@ class _ChatListState extends State<ChatList> {
AppBar( AppBar(
elevation: 1, elevation: 1,
leading: selectMode == SelectMode.normal 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( : IconButton(
tooltip: L10n.of(context).cancel, tooltip: L10n.of(context).cancel,
icon: Icon(Icons.close_outlined), icon: Icon(Icons.close_outlined),
@ -360,8 +376,6 @@ class _ChatListState extends State<ChatList> {
.pushNamedAndRemoveUntilIsFirst('/newprivatechat'), .pushNamedAndRemoveUntilIsFirst('/newprivatechat'),
) )
: null, : null,
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: selectMode == SelectMode.normal bottomNavigationBar: selectMode == SelectMode.normal
? DefaultBottomNavigationBar(currentIndex: 1) ? DefaultBottomNavigationBar(currentIndex: 1)
: null, : null,

View File

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

View File

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