Merge branch 'krille/redesign-empty-stories' into 'main'

design: Use IconButton instead of listTile for first story

See merge request famedly/fluffychat!710
This commit is contained in:
Krille Fear 2022-02-03 08:11:58 +00:00
commit c67459dbc2
2 changed files with 61 additions and 50 deletions

View File

@ -14,6 +14,7 @@ import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
import 'package:fluffychat/pages/chat_list/client_chooser_button.dart'; import 'package:fluffychat/pages/chat_list/client_chooser_button.dart';
import 'package:fluffychat/pages/chat_list/spaces_bottom_bar.dart'; import 'package:fluffychat/pages/chat_list/spaces_bottom_bar.dart';
import 'package:fluffychat/pages/chat_list/stories_header.dart'; import 'package:fluffychat/pages/chat_list/stories_header.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
import 'package:fluffychat/widgets/connection_status_header.dart'; import 'package:fluffychat/widgets/connection_status_header.dart';
import '../../utils/stream_extension.dart'; import '../../utils/stream_extension.dart';
import '../../widgets/matrix.dart'; import '../../widgets/matrix.dart';
@ -99,6 +100,14 @@ class ChatListView extends StatelessWidget {
onPressed: () => onPressed: () =>
VRouter.of(context).to('/search'), VRouter.of(context).to('/search'),
), ),
if (selectMode == SelectMode.normal &&
Matrix.of(context).client.storiesRooms.isEmpty)
IconButton(
icon: const Icon(Icons.camera_alt_outlined),
tooltip: L10n.of(context)!.addToStory,
onPressed: () =>
VRouter.of(context).to('/stories/create'),
),
PopupMenuButton<PopupMenuAction>( PopupMenuButton<PopupMenuAction>(
onSelected: controller.onPopupMenuSelect, onSelected: controller.onPopupMenuSelect,
itemBuilder: (_) => [ itemBuilder: (_) => [

View File

@ -87,15 +87,13 @@ class StoriesHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final client = Matrix.of(context).client; final client = Matrix.of(context).client;
return StreamBuilder<Object>( return StreamBuilder(
stream: Matrix.of(context).onShareContentChanged.stream,
builder: (context, _) => StreamBuilder<Object>(
stream: client.onSync.stream stream: client.onSync.stream
.where((syncUpdate) => syncUpdate.hasRoomUpdate), .where((syncUpdate) => syncUpdate.hasRoomUpdate),
builder: (context, snapshot) { builder: (context, snapshot) {
if (client.storiesRooms.isEmpty && client.contacts.isEmpty) { if (Matrix.of(context).shareContent != null) {
return Container();
}
if (client.storiesRooms.isEmpty ||
Matrix.of(context).shareContent != null) {
return ListTile( return ListTile(
leading: CircleAvatar( leading: CircleAvatar(
radius: Avatar.defaultSize / 2, radius: Avatar.defaultSize / 2,
@ -107,6 +105,9 @@ class StoriesHeader extends StatelessWidget {
onTap: () => _addToStoryAction(context), onTap: () => _addToStoryAction(context),
); );
} }
if (client.storiesRooms.isEmpty) {
return Container();
}
return SizedBox( return SizedBox(
height: 98, height: 98,
child: ListView( child: ListView(
@ -141,7 +142,8 @@ class StoriesHeader extends StatelessWidget {
], ],
), ),
); );
}); }),
);
} }
} }