fix: Minor apl bugs

This commit is contained in:
Krille Fear 2021-01-16 13:24:52 +00:00
parent 4b0f9fc8de
commit 05b95513f9
22 changed files with 170 additions and 135 deletions

View File

@ -114,8 +114,10 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
startCallAction(context); startCallAction(context);
break; break;
case 'details': case 'details':
await AdaptivePageLayout.of(context).pushNamedAndRemoveAllOthers( if (AdaptivePageLayout.of(context).viewDataStack.length < 3) {
'/rooms/${widget.room.id}/details'); await AdaptivePageLayout.of(context)
.pushNamed('/rooms/${widget.room.id}/details');
}
break; break;
} }

View File

@ -82,7 +82,7 @@ class FluffyRoutes {
case 'rooms': case 'rooms':
if (parts.length == 3) { if (parts.length == 3) {
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
); );
} else if (parts.length == 4) { } else if (parts.length == 4) {
@ -91,31 +91,31 @@ class FluffyRoutes {
switch (action) { switch (action) {
case 'details': case 'details':
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
rightView: (_) => ChatDetails(roomId), rightView: (_) => ChatDetails(roomId),
); );
case 'encryption': case 'encryption':
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
rightView: (_) => ChatEncryptionSettings(roomId), rightView: (_) => ChatEncryptionSettings(roomId),
); );
case 'permissions': case 'permissions':
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
rightView: (_) => ChatPermissionsSettings(roomId), rightView: (_) => ChatPermissionsSettings(roomId),
); );
case 'invite': case 'invite':
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
rightView: (_) => InvitationSelection(roomId), rightView: (_) => InvitationSelection(roomId),
); );
case 'emotes': case 'emotes':
return ViewData( return ViewData(
leftView: (_) => ChatList(), leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]), mainView: (_) => Chat(parts[2]),
rightView: (_) => MultipleEmotesSettings(roomId), rightView: (_) => MultipleEmotesSettings(roomId),
); );

View File

@ -36,6 +36,7 @@ class _ArchiveState extends State<Archive> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).archive), title: Text(L10n.of(context).archive),
elevation: _scrolledToTop ? 0 : null, elevation: _scrolledToTop ? 0 : null,
), ),

View File

@ -472,7 +472,8 @@ class _ChatState extends State<Chat> {
onPressed: () => setState(() => selectedEvents.clear()), onPressed: () => setState(() => selectedEvents.clear()),
) )
: null, : null,
titleSpacing: 0, titleSpacing:
AdaptivePageLayout.of(context).columnMode(context) ? null : 0,
title: selectedEvents.isEmpty title: selectedEvents.isEmpty
? StreamBuilder<Object>( ? StreamBuilder<Object>(
stream: room.onUpdate.stream, stream: room.onUpdate.stream,
@ -490,7 +491,12 @@ class _ChatState extends State<Chat> {
), ),
) )
: () => AdaptivePageLayout.of(context) : () => AdaptivePageLayout.of(context)
.pushNamed('/rooms/${room.id}/details'), .viewDataStack
.length <
3
? AdaptivePageLayout.of(context)
.pushNamed('/rooms/${room.id}/details')
: null,
title: Text( title: Text(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context))), MatrixLocals(L10n.of(context))),

View File

@ -172,6 +172,7 @@ class _ChatDetailsState extends State<ChatDetails> {
if (room == null) { if (room == null) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).oopsSomethingWentWrong), title: Text(L10n.of(context).oopsSomethingWentWrong),
), ),
body: Center( body: Center(
@ -192,6 +193,7 @@ class _ChatDetailsState extends State<ChatDetails> {
headerSliverBuilder: headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) => <Widget>[ (BuildContext context, bool innerBoxIsScrolled) => <Widget>[
SliverAppBar( SliverAppBar(
leading: BackButton(),
expandedHeight: 300.0, expandedHeight: 300.0,
floating: true, floating: true,
pinned: true, pinned: true,

View File

@ -91,6 +91,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).participatingUserDevices), title: Text(L10n.of(context).participatingUserDevices),
), ),
body: StreamBuilder( body: StreamBuilder(

View File

@ -45,7 +45,10 @@ class ChatPermissionsSettings extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context).editChatPermissions)), appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).editChatPermissions),
),
body: StreamBuilder( body: StreamBuilder(
stream: Matrix.of(context).client.onSync.stream.where( stream: Matrix.of(context).client.onSync.stream.where(
(e) => (e) =>

View File

@ -122,6 +122,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
); );
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
titleSpacing: 0, titleSpacing: 0,
elevation: _scrolledToTop ? 0 : null, elevation: _scrolledToTop ? 0 : null,
title: DefaultAppBarSearchField( title: DefaultAppBarSearchField(

View File

@ -123,6 +123,7 @@ class _InvitationSelectionState extends State<InvitationSelection> {
room.name?.isEmpty ?? false ? L10n.of(context).group : room.name; room.name?.isEmpty ?? false ? L10n.of(context).group : room.name;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
titleSpacing: 0, titleSpacing: 0,
title: DefaultAppBarSearchField( title: DefaultAppBarSearchField(
autofocus: true, autofocus: true,

View File

@ -156,7 +156,7 @@ class _LoginState extends State<Login> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: loading ? Container() : null, leading: loading ? Container() : BackButton(),
elevation: 0, elevation: 0,
title: Text( title: Text(
L10n.of(context).logInTo(Matrix.of(context) L10n.of(context).logInTo(Matrix.of(context)

View File

@ -40,6 +40,7 @@ class _NewGroupState extends State<NewGroup> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).createNewGroup), title: Text(L10n.of(context).createNewGroup),
elevation: 0, elevation: 0,
), ),

View File

@ -85,6 +85,7 @@ class _NewPrivateChatState extends State<NewPrivateChat> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).newPrivateChat), title: Text(L10n.of(context).newPrivateChat),
elevation: 0, elevation: 0,
), ),

View File

@ -260,6 +260,7 @@ class _SettingsState extends State<Settings> {
if (mounted) setState(() => profile = p); if (mounted) setState(() => profile = p);
return p; return p;
}); });
if (client.encryption != null) {
crossSigningCachedFuture ??= crossSigningCachedFuture ??=
client.encryption.crossSigning.isCached().then((c) { client.encryption.crossSigning.isCached().then((c) {
if (mounted) setState(() => crossSigningCached = c); if (mounted) setState(() => crossSigningCached = c);
@ -270,11 +271,13 @@ class _SettingsState extends State<Settings> {
if (mounted) setState(() => megolmBackupCached = c); if (mounted) setState(() => megolmBackupCached = c);
return c; return c;
}); });
}
return Scaffold( return Scaffold(
body: NestedScrollView( body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) =>
<Widget>[ <Widget>[
SliverAppBar( SliverAppBar(
leading: BackButton(),
expandedHeight: 300.0, expandedHeight: 300.0,
floating: true, floating: true,
pinned: true, pinned: true,
@ -434,6 +437,7 @@ class _SettingsState extends State<Settings> {
), ),
onTap: () => _deleteAccountAction(context), onTap: () => _deleteAccountAction(context),
), ),
if (client.encryption != null) ...{
Divider(thickness: 1), Divider(thickness: 1),
ListTile( ListTile(
title: Text( title: Text(
@ -554,6 +558,7 @@ class _SettingsState extends State<Settings> {
), ),
trailing: Icon(Icons.vpn_key_outlined), trailing: Icon(Icons.vpn_key_outlined),
), ),
},
Divider(thickness: 1), Divider(thickness: 1),
ListTile( ListTile(
title: Text( title: Text(

View File

@ -95,6 +95,7 @@ class _Settings3PidState extends State<Settings3Pid> {
_request ??= Matrix.of(context).client.requestThirdPartyIdentifiers(); _request ??= Matrix.of(context).client.requestThirdPartyIdentifiers();
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).passwordRecovery), title: Text(L10n.of(context).passwordRecovery),
actions: [ actions: [
IconButton( IconButton(

View File

@ -88,7 +88,10 @@ class DevicesSettingsState extends State<DevicesSettings> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context).devices)), appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).devices),
),
body: FutureBuilder<bool>( body: FutureBuilder<bool>(
future: _loadUserDevices(context), future: _loadUserDevices(context),
builder: (BuildContext context, snapshot) { builder: (BuildContext context, snapshot) {

View File

@ -169,6 +169,7 @@ class _EmotesSettingsState extends State<EmotesSettings> {
} }
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).emoteSettings), title: Text(L10n.of(context).emoteSettings),
), ),
floatingActionButton: showSave floatingActionButton: showSave

View File

@ -22,7 +22,10 @@ class SettingsIgnoreList extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(L10n.of(context).ignoredUsers)), appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).ignoredUsers),
),
body: Column( body: Column(
children: [ children: [
Padding( Padding(

View File

@ -14,6 +14,7 @@ class MultipleEmotesSettings extends StatelessWidget {
final room = Matrix.of(context).client.getRoomById(roomId); final room = Matrix.of(context).client.getRoomById(roomId);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).emotePacks), title: Text(L10n.of(context).emotePacks),
), ),
body: StreamBuilder( body: StreamBuilder(

View File

@ -109,6 +109,7 @@ class SettingsNotifications extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).notifications), title: Text(L10n.of(context).notifications),
), ),
body: StreamBuilder( body: StreamBuilder(

View File

@ -51,6 +51,7 @@ class _SettingsStyleState extends State<SettingsStyle> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
leading: BackButton(),
title: Text(L10n.of(context).changeTheme), title: Text(L10n.of(context).changeTheme),
), ),
body: ListView( body: ListView(

View File

@ -70,7 +70,7 @@ class _SignUpState extends State<SignUp> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
leading: loading ? Container() : null, leading: loading ? Container() : BackButton(),
title: Text( title: Text(
Matrix.of(context) Matrix.of(context)
.client .client

View File

@ -110,7 +110,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
leading: loading ? Container() : null, leading: loading ? Container() : BackButton(),
title: Text( title: Text(
L10n.of(context).chooseAStrongPassword, L10n.of(context).chooseAStrongPassword,
), ),